From: Laurence Maultsby Date: Thu, 26 Jan 2017 15:52:59 +0000 (-0500) Subject: Composer rendering optimization X-Git-Tag: v1.1.0~10^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=b9f1c7528b426e858bb78b00c5a22033971e0a2e;p=osm%2FUI.git Composer rendering optimization Signed-off-by: Laurence Maultsby --- diff --git a/skyquake/plugins/composer/src/src/components/ComposerApp.js b/skyquake/plugins/composer/src/src/components/ComposerApp.js index b5cfa7528..6507b3419 100644 --- a/skyquake/plugins/composer/src/src/components/ComposerApp.js +++ b/skyquake/plugins/composer/src/src/components/ComposerApp.js @@ -163,7 +163,7 @@ const ComposerApp = React.createClass({ } } - let cpNumber = 0; + let AppHeader = (
); @@ -174,12 +174,7 @@ const ComposerApp = React.createClass({ const isModified = self.state.item && self.state.item.uiState.modified; const isEditingNSD = self.state.item && self.state.item.uiState && /nsd/.test(self.state.item.uiState.type); const isEditingVNFD = self.state.item && self.state.item.uiState && /vnfd/.test(self.state.item.uiState.type); - const containers = [self.state.item].reduce(DescriptorModelFactory.buildCatalogItemFactory(CatalogDataStore.getState().catalogs), []); - - containers.filter(d => DescriptorModelFactory.isConnectionPoint(d)).forEach(d => { - d.cpNumber = ++cpNumber; - containers.filter(d => DescriptorModelFactory.isVnfdConnectionPointRef(d)).filter(ref => ref.key === d.key).forEach(ref => ref.cpNumber = d.cpNumber); - }); + const containers = self.state.containers; const canvasTitle = containers.length ? containers[0].model.name : ''; const hasNoCatalogs = CatalogDataStore.getState().catalogs.length === 0; const isLoading = self.state.isLoading; diff --git a/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js b/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js index 3671890b5..75276d22a 100644 --- a/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js +++ b/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js @@ -125,6 +125,7 @@ class ComposerAppStore { this.files = false; this.filesState = {}; this.downloadJobs = {}; + this.containers = []; //End File manager values this.bindListeners({ onResize: PanelResizeAction.RESIZE, @@ -201,8 +202,17 @@ class ComposerAppStore { } updateItem(item) { + const self = this; + let containers = []; + let cpNumber = 0; if(!document.body.classList.contains('resizing')) { - this.setState({item: _.cloneDeep(item)}); + containers = [item].reduce(DescriptorModelFactory.buildCatalogItemFactory(CatalogDataStore.getState().catalogs), []); + + containers.filter(d => DescriptorModelFactory.isConnectionPoint(d)).forEach(d => { + d.cpNumber = ++cpNumber; + containers.filter(d => DescriptorModelFactory.isVnfdConnectionPointRef(d)).filter(ref => ref.key === d.key).forEach(ref => ref.cpNumber = d.cpNumber); + }); + this.setState({containers: containers, item: _.cloneDeep(item)}); } SelectionManager.refreshOutline(); }