diff options
Diffstat (limited to 'app/client/dashboard')
| -rw-r--r-- | app/client/dashboard/dashboard.actions.js | 6 | ||||
| -rw-r--r-- | app/client/dashboard/dashboard.component.js | 12 | ||||
| -rw-r--r-- | app/client/dashboard/dashboard.reducer.js | 10 | ||||
| -rw-r--r-- | app/client/dashboard/dashboardHeader.component.js | 1 |
4 files changed, 23 insertions, 6 deletions
diff --git a/app/client/dashboard/dashboard.actions.js b/app/client/dashboard/dashboard.actions.js index 8b5502a..c428d0b 100644 --- a/app/client/dashboard/dashboard.actions.js +++ b/app/client/dashboard/dashboard.actions.js @@ -11,7 +11,11 @@ export const load = () => (dispatch) => { actions.file.index({ module: 'morph', generated: 1, limit: 15, orderBy: 'created_at desc', }), ], (percent, i, n) => { // console.log('dashboard load progress', i, n) - dispatch({ type: types.app.load_progress, progress: { i, n }}) + dispatch({ + type: types.app.load_progress, + progress: { i, n }, + data: { module: 'dashboard' } + }) }).then(res => { const [ tasks, folders, samplernn, pix2pixhd, morph ] = res const { mapFn, sortFn } = util.sort.orderByFn('date desc') diff --git a/app/client/dashboard/dashboard.component.js b/app/client/dashboard/dashboard.component.js index 3c9b2de..0c15f99 100644 --- a/app/client/dashboard/dashboard.component.js +++ b/app/client/dashboard/dashboard.component.js @@ -11,7 +11,7 @@ import Button from '../common/button.component' import DashboardHeader from './dashboardheader.component' import TaskList from './tasklist.component' -import { FolderList, FileList } from '../common' +import { Loading, FolderList, FileList } from '../common' import Gallery from '../common/gallery.component' import * as dashboardActions from './dashboard.actions' @@ -22,7 +22,7 @@ import actions from '../actions' class Dashboard extends Component { constructor(props){ super() - console.log(props) + // console.log(props) props.actions.load() } componentWillUpdate(nextProps) { @@ -30,9 +30,11 @@ class Dashboard extends Component { // this.props.actions.list_epochs(nextProps.opt.checkpoint_name) } render(){ - const { site, foldersByModule, renders, queue, images } = this.props + const { loading, progress, site, foldersByModule, renders, queue, images } = this.props + if (loading) { + return <Loading progress={progress} /> + } const { tasks } = queue - console.log(foldersByModule) const folders = foldersByModule && Object.keys(modules).sort().map(key => { let path = key === 'samplernn' ? '/samplernn/datasets/' : '/' + key + '/sequences/' let folder_list = (foldersByModule[key] || []).map(folder => { @@ -99,6 +101,8 @@ class Dashboard extends Component { } } const mapStateToProps = state => ({ + loading: state.dashboard.loading, + progress: state.dashboard.progress, site: state.system.site, foldersByModule: state.dashboard.data.foldersByModule, renders: state.dashboard.data.renders, diff --git a/app/client/dashboard/dashboard.reducer.js b/app/client/dashboard/dashboard.reducer.js index 812a501..f10f3fa 100644 --- a/app/client/dashboard/dashboard.reducer.js +++ b/app/client/dashboard/dashboard.reducer.js @@ -5,6 +5,7 @@ let FileSaver = require('file-saver') const dashboardInitialState = { loading: false, + progress: null, error: null, data: {}, images: [ @@ -15,6 +16,15 @@ const dashboardInitialState = { const dashboardReducer = (state = dashboardInitialState, action) => { switch(action.type) { + case types.app.load_progress: + if (!action.data || action.data.module !== 'dashboard') { + return state + } + return { + ...state, + loading: true, + progress: action.progress, + } case types.dashboard.load: return { ...state, diff --git a/app/client/dashboard/dashboardHeader.component.js b/app/client/dashboard/dashboardHeader.component.js index 5f1306c..063cd47 100644 --- a/app/client/dashboard/dashboardHeader.component.js +++ b/app/client/dashboard/dashboardHeader.component.js @@ -23,7 +23,6 @@ class DashboardHeader extends Component { ) } renderStatus(name, gpu){ - console.log(gpu) if (gpu.status === 'IDLE') { return <div>{name} idle</div> } |
