diff options
| -rw-r--r-- | app/client/common/fileViewer.component.js | 32 | ||||
| -rw-r--r-- | public/assets/css/css.css | 3 |
2 files changed, 23 insertions, 12 deletions
diff --git a/app/client/common/fileViewer.component.js b/app/client/common/fileViewer.component.js index fcc4e9c..d9f3f4b 100644 --- a/app/client/common/fileViewer.component.js +++ b/app/client/common/fileViewer.component.js @@ -29,7 +29,7 @@ class FileViewer extends Component { } fetch() { - const { file, path } = this.props + const { file, path, thumbnail } = this.props if (!file) return if (this.state.loading) { this.setState({ stale: true }) @@ -39,16 +39,26 @@ class FileViewer extends Component { console.log('fetch file', fn) const { tool: module } = this.props.app this.setState({ buffer: null, loading: true }) - - actions.socket.read_file({ module, fn }).then(buffer => { - console.log('fetched buffer') - const { stale } = this.state - this.setState({ buffer, loading: false, stale: false, }, () => { - if (stale) { - console.log('stale, fetching...') - this.fetch() - } - }) + + if (thumbnail) { + const size = parseInt(thumbnail) || 200 + actions.socket + .thumbnail({ module, fn, size }) + .then(this.loadBuffer.bind(this)) + } else { + actions.socket + .read_file({ module, fn }) + .then(this.loadBuffer.bind(this)) + } + } + loadBuffer(buffer) { + console.log('fetched buffer') + const { stale } = this.state + this.setState({ buffer, loading: false, stale: false, }, () => { + if (stale) { + console.log('stale, fetching...') + this.fetch() + } }) } diff --git a/public/assets/css/css.css b/public/assets/css/css.css index a1d29e5..cd992f7 100644 --- a/public/assets/css/css.css +++ b/public/assets/css/css.css @@ -694,7 +694,8 @@ input.small { .timeline { display: block; - border: 1px solid #333; + border: 1px solid #ddd; + border-radius: 2px; background: #fff; position: relative; margin-bottom: 5px; |
