From 3c9ccd38751501bbf5b9cd2c54dee370681fdb5b Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 20 Sep 2018 02:52:55 +0200 Subject: stub file viewer --- app/client/browser/browser.component.js | 20 +++- app/client/common/currentTask.component.js | 2 +- app/client/common/fileList.component.js | 12 +- app/client/common/folderList.component.js | 6 +- app/client/common/slider.component.js | 2 +- app/client/common/taskList.component.js | 12 +- app/client/common/views/new.view.js | 6 +- app/client/dashboard/dashboardHeader.component.js | 2 +- app/client/dataset/dataset.component.js | 12 +- app/client/dataset/dataset.new.js | 6 +- app/client/dataset/upload.status.js | 2 +- app/client/modules/morph/views/morph.app.js | 4 +- app/client/modules/pix2pix/views/pix2pix.live.js | 2 +- app/client/modules/pix2pix/views/pix2pix.show.js | 26 ++--- app/client/socket/socket.actions.js | 1 + app/relay/remote.js | 10 ++ app/relay/runner.js | 19 ++++ public/bundle.js | 131 +++++++++++++--------- public/bundle.js.map | 2 +- 19 files changed, 173 insertions(+), 104 deletions(-) diff --git a/app/client/browser/browser.component.js b/app/client/browser/browser.component.js index 767c5fb..5183161 100644 --- a/app/client/browser/browser.component.js +++ b/app/client/browser/browser.component.js @@ -27,7 +27,11 @@ class Browser extends Component { } handlePick(file) { console.log(file) - this.fetch([this.state.dir, file.name].join('/').replace('//','/')) + if (file.dir) { + this.fetch([this.state.dir, file.name].join('/').replace('//','/')) + } else { + this.fetchFile([this.state.dir, file.name].join('/').replace('//','/')) + } } fetch(dir) { console.log('fetch', dir) @@ -38,10 +42,21 @@ class Browser extends Component { this.setState({ dir, files, loading: false }) }) } + fetchFile(fn) { + console.log('fetch file', fn) + const { module } = this.state + this.setState({ file: null, loadingFile: true }) + actions.socket.read_file({ module, fn }).then(file => { + this.setState({ file, loadingFile: false }) + }) + } render() { const { app } = this.props - const { loading, dir, module, files } = this.state + const { + loading, dir, module, files, + loadingFile, file, + } = this.state console.log(this.props, this.state) return (
@@ -65,6 +80,7 @@ class Browser extends Component { this.fetch(this.state.dir.split('/').slice(0, -1).join('') || '/') }} /> + {loadingFile && }
) } diff --git a/app/client/common/currentTask.component.js b/app/client/common/currentTask.component.js index 3c71a88..ef976bc 100644 --- a/app/client/common/currentTask.component.js +++ b/app/client/common/currentTask.component.js @@ -31,7 +31,7 @@ function CurrentTask ({ cpu, gpu, processor }) { ? (currently #{epoch}) : ""}

-
{last_message}
+
{last_message}
) } diff --git a/app/client/common/fileList.component.js b/app/client/common/fileList.component.js index 0e6b25e..f932274 100644 --- a/app/client/common/fileList.component.js +++ b/app/client/common/fileList.component.js @@ -41,8 +41,8 @@ export const FileList = props => { if (!fileList || !fileList.length) { return (
-
-

No files

+
+

No files

) @@ -51,7 +51,7 @@ export const FileList = props => { return (
{title && -
+

{title}

}
} @@ -60,7 +60,7 @@ export const FileList = props => { {parentDirectory &&
- onClickParent && onClickParent(e)}> + onClickParent && onClickParent(e)}> Parent Directory
@@ -98,14 +98,14 @@ export const FileRow = props => { } return ( -
+
{fields.has('name') &&
{file.persisted === false ? {name} : (linkFiles && file.url) ? { if (!(e.metaKey || e.ctrlKey || e.altKey) && onClick) { e.preventDefault(); onClick && onClick(file, e) }}} href={file.url}>{name} - : onClick && onClick(file, e)}>{name} + : onClick && onClick(file, e)}>{name} }
} diff --git a/app/client/common/folderList.component.js b/app/client/common/folderList.component.js index a6c6ae5..91d0bff 100644 --- a/app/client/common/folderList.component.js +++ b/app/client/common/folderList.component.js @@ -12,7 +12,7 @@ export default function FolderList ({ db, path, emptyText, activity }) { if (! db) return null if (db.loading || !db.data) { return ( -
+
) @@ -23,7 +23,7 @@ export default function FolderList ({ db, path, emptyText, activity }) { } if (! folderList.length && emptyText) { return ( -
+
{emptyText}
) @@ -41,7 +41,7 @@ export default function FolderList ({ db, path, emptyText, activity }) { }) return ( -
+
{folders} diff --git a/app/client/common/slider.component.js b/app/client/common/slider.component.js index 7252ca3..9dba730 100644 --- a/app/client/common/slider.component.js +++ b/app/client/common/slider.component.js @@ -81,7 +81,7 @@ class Slider extends Component { text_value = parseFloat(value).toFixed(2) } return ( -
+