diff options
| author | Jules <jules@asdf.us> | 2018-09-22 10:47:50 -0400 |
|---|---|---|
| committer | Jules <jules@asdf.us> | 2018-09-22 10:47:50 -0400 |
| commit | 7e39114e27520e382f26368ae8f4d08ae7f3071b (patch) | |
| tree | 01e7f210b0c3a119622e92d56d01f5c7951ad631 /app/client/common/browser.component.js | |
| parent | 46889933fd9c36c527014410823e88a7d838d239 (diff) | |
| parent | 8d1c19852fcce52e369978dfc195d5da4f12180a (diff) | |
merge
Diffstat (limited to 'app/client/common/browser.component.js')
| -rw-r--r-- | app/client/common/browser.component.js | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/app/client/common/browser.component.js b/app/client/common/browser.component.js index 50b31cf..19cd0f6 100644 --- a/app/client/common/browser.component.js +++ b/app/client/common/browser.component.js @@ -11,19 +11,23 @@ class Browser extends Component { state = { dir: '/', files: [], + file: null, loading: true } + componentDidMount() { this.fetch(this.state.dir) } + handlePick(file) { console.log(file) if (file.dir) { this.fetch([this.state.dir, file.name].join('/').replace('//','/')) } else { - this.fetchFile([this.state.dir, file.name].join('/').replace('//','/')) + this.setState({ file: { ...file, path: this.state.dir } }) } } + fetch(dir) { console.log('fetch', dir) const { tool: module } = this.props.app @@ -33,15 +37,7 @@ class Browser extends Component { this.setState({ dir, files, loading: false }) }) } - fetchFile(fn) { - console.log('fetch file', fn) - const { tool: module } = this.props.app - this.setState({ file: null, loadingFile: true }) - actions.socket.read_file({ module, fn }).then(file => { - console.log(file) - this.setState({ file, loadingFile: false }) - }) - } + render() { const { app } = this.props const { @@ -68,7 +64,7 @@ class Browser extends Component { }} onClickParent={e => { console.log('navigate up') - this.fetch(this.state.dir.split('/').slice(0, -1).join('/') || '/') + this.fetch(dir.split('/').slice(0, -1).join('/') || '/') }} /> {loadingFile && <Loading />} |
