From: Laurence Maultsby Date: Thu, 19 Jan 2017 16:44:34 +0000 (-0500) Subject: RIFT-15318: Hide assets tab when there are none X-Git-Tag: v1.1.0~4^2~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=df332f582aae48baaf5b1fa51c15f3bf0bab0443;p=osm%2FUI.git RIFT-15318: Hide assets tab when there are none Signed-off-by: Laurence Maultsby --- diff --git a/skyquake/plugins/composer/api/composer.js b/skyquake/plugins/composer/api/composer.js index 8df1a9123..864f2b06e 100644 --- a/skyquake/plugins/composer/api/composer.js +++ b/skyquake/plugins/composer/api/composer.js @@ -612,6 +612,9 @@ FileManager.get = function(req) { data: data.body }); } + }).catch(function(err) { + console.log('Failed to retrieve FileManager.list') + resolve(err); }) } }) diff --git a/skyquake/plugins/composer/src/src/components/CanvasPanel.js b/skyquake/plugins/composer/src/src/components/CanvasPanel.js index 96904ea16..cb212cbfa 100644 --- a/skyquake/plugins/composer/src/src/components/CanvasPanel.js +++ b/skyquake/plugins/composer/src/src/components/CanvasPanel.js @@ -81,9 +81,13 @@ const CanvasPanel = React.createClass({ - + { + this.props.files ? + + : null + } ) diff --git a/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js b/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js index 854864b7c..347ba9a07 100644 --- a/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js +++ b/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js @@ -457,18 +457,27 @@ class ComposerAppStore { let self = this; let filesState = null; if (self.fileMonitoringSocketID) { - filesState = addInputState( _.cloneDeep(this.filesState),data); - // filesState = _.merge(self.filesState, addInputState({},data)); - let normalizedData = normalizeTree(data); - this.setState({ - files: { - data: _.mergeWith(normalizedData.data, self.files.data, function(obj, src) { - return _.uniqBy(obj? obj.concat(src) : src, 'name'); - }), - id: self.files.id || normalizedData.id - }, - filesState: filesState - }); + let newState = {}; + if(data.hasOwnProperty('contents')) { + filesState = addInputState( _.cloneDeep(this.filesState),data); + // filesState = _.merge(self.filesState, addInputState({},data)); + let normalizedData = normalizeTree(data); + newState = { + files: { + data: _.mergeWith(normalizedData.data, self.files.data, function(obj, src) { + return _.uniqBy(obj? obj.concat(src) : src, 'name'); + }), + id: self.files.id || normalizedData.id + }, + filesState: filesState + } + } else { + newState = { + files: false + } + } + + this.setState(newState); } function normalizeTree(data) { let f = {