Composer rendering optimization 30/1030/1
authorLaurence Maultsby <laurence.maultsby@riftio.com>
Thu, 26 Jan 2017 15:52:59 +0000 (10:52 -0500)
committerLaurence Maultsby <laurence.maultsby@riftio.com>
Thu, 26 Jan 2017 15:52:59 +0000 (10:52 -0500)
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
skyquake/plugins/composer/src/src/components/ComposerApp.js
skyquake/plugins/composer/src/src/stores/ComposerAppStore.js

index b5cfa75..6507b34 100644 (file)
@@ -163,7 +163,7 @@ const ComposerApp = React.createClass({
                                }
                        }
 
-                       let cpNumber = 0;
+
                        let AppHeader = (<div className="AppHeader">
                                                                <RiftHeader />
                                                        </div>);
@@ -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;
index 3671890..75276d2 100644 (file)
@@ -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();
        }