From 932fe9ccb9bfad7f454c5f53d35ec06c27328281 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 30 Jun 2018 19:12:58 +0200 Subject: fixing up dashboard --- app/client/dashboard/dashboard.actions.js | 5 ++-- app/client/dashboard/dashboard.component.js | 32 +++++++++-------------- app/client/dashboard/dashboardHeader.component.js | 22 +++++++--------- 3 files changed, 24 insertions(+), 35 deletions(-) (limited to 'app/client/dashboard') diff --git a/app/client/dashboard/dashboard.actions.js b/app/client/dashboard/dashboard.actions.js index 2757830..8b5502a 100644 --- a/app/client/dashboard/dashboard.actions.js +++ b/app/client/dashboard/dashboard.actions.js @@ -10,7 +10,7 @@ export const load = () => (dispatch) => { actions.file.index({ module: 'pix2pixhd', generated: 1, limit: 15, orderBy: 'created_at desc', }), actions.file.index({ module: 'morph', generated: 1, limit: 15, orderBy: 'created_at desc', }), ], (percent, i, n) => { - console.log('dashboard load progress', i, n) + // console.log('dashboard load progress', i, n) dispatch({ type: types.app.load_progress, progress: { i, n }}) }).then(res => { const [ tasks, folders, samplernn, pix2pixhd, morph ] = res @@ -26,14 +26,13 @@ export const load = () => (dispatch) => { data: { tasks, folders, + foldersByModule, renders: { samplernn, pix2pixhd, morph, }, - foldersByModule, }, }) - }) } diff --git a/app/client/dashboard/dashboard.component.js b/app/client/dashboard/dashboard.component.js index a75535f..3c9b2de 100644 --- a/app/client/dashboard/dashboard.component.js +++ b/app/client/dashboard/dashboard.component.js @@ -32,18 +32,16 @@ class Dashboard extends Component { render(){ const { site, foldersByModule, renders, queue, images } = this.props const { tasks } = queue + console.log(foldersByModule) const folders = foldersByModule && Object.keys(modules).sort().map(key => { - let path, folder_list - if (foldersByModule[key]) { - path = key === 'samplernn' ? '/samplernn/datasets/' : '/' + key + '/sequences/' - folder_list = foldersByModule[key].map(folder => { - return ( -
- {folder.name} -
- ) - }) - } + let path = key === 'samplernn' ? '/samplernn/datasets/' : '/' + key + '/sequences/' + let folder_list = (foldersByModule[key] || []).map(folder => { + return ( +
+ {folder.name} +
+ ) + }) let files = renders[key] && (

{key}

- {folder_list && - -
- new -
- {folders} -
- } +
+ new +
+ {folder_list}
{files} diff --git a/app/client/dashboard/dashboardHeader.component.js b/app/client/dashboard/dashboardHeader.component.js index 10b2241..5f1306c 100644 --- a/app/client/dashboard/dashboardHeader.component.js +++ b/app/client/dashboard/dashboardHeader.component.js @@ -13,43 +13,39 @@ class DashboardHeader extends Component { this.props.onClick && this.props.onClick() } render() { - const { site } = this.props + const { site, runner } = this.props return (

{site.name} cortex

- {this.renderGPUStatus()} + {this.renderStatus("GPU", runner.gpu)} + {this.renderStatus("CPU", runner.cpu)}
) } - renderGPUStatus(){ - const { runner } = this.props - const gpu = runner.cpu + renderStatus(name, gpu){ + console.log(gpu) if (gpu.status === 'IDLE') { - return null + return
{name} idle
} const task = gpu.task - const eta = task.epoch - ? ((task.epochs - (task.epoch || 0)) * 1000 / 60) + " minutes" - : null let activityPhrase, liveMessage if (task.activity === 'live') { return (
- Currently running {task.module} live on "{task.dataset}" + {name} running {task.module} live on "{task.dataset}"
) } else { return (
- Currently {util.gerund(task.activity)} {task.module} on {task.dataset}
- {eta && Epoch: {task.epoch} / {task.epochs}, ETA {eta}
} + {name} {util.gerund(task.activity)} {task.module} on {task.dataset} + {!!task.epoch && Epoch: {task.epoch} / {task.epochs}
}
) } } } -// Want to play live? const mapStateToProps = state => ({ runner: state.system.runner, -- cgit v1.2.3-70-g09d2