RIFT-15502: Create Virtual Link does not work after the first VL create 51/1051/1
authorKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Tue, 31 Jan 2017 05:35:09 +0000 (00:35 -0500)
committerKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Tue, 31 Jan 2017 05:35:09 +0000 (00:35 -0500)
Signed-off-by: KIRAN KASHALKAR <kiran.kashalkar@riftio.com>
skyquake/plugins/launchpad/src/virtual_links/nsVirtualLinkCreate.jsx
skyquake/plugins/launchpad/src/virtual_links/nsVirtualLinkCreateStore.js
skyquake/plugins/launchpad/src/virtual_links/nsVirtualLinks.jsx

index 30f7694..d3dc011 100644 (file)
@@ -39,6 +39,7 @@ class NsVirtualLinkCreate extends React.Component {
        componentWillMount() {
                (!this.state.nsrId && this.props.nsrId) && this.Store.saveNSRId(this.props.nsrId);
                this.Store.saveMode(this.props.mode);
+               this.Store.saveOnSuccess(this.props.onSuccess);
                switch (this.props.mode) {
                        case 'creating':
                                if (!this.state.vld) {
index 61ebe3d..dbd7f58 100644 (file)
@@ -84,7 +84,8 @@ class NSVirtualLinkCreateStore {
             saveVnfdIdRefs: this.saveVnfdIdRefs,
             saveIpProfileNames: this.saveIpProfileNames,
             removeVirtualLink: this.removeVirtualLink,
-            saveMode: this.saveMode
+            saveMode: this.saveMode,
+            saveOnSuccess: this.saveOnSuccess
         });
        }
 
@@ -97,6 +98,12 @@ class NSVirtualLinkCreateStore {
                });
        }
 
+       saveOnSuccess = (onSuccess) => {
+               this.setState({
+                       onSuccess: onSuccess
+               })
+       }
+
        saveMode = (mode) => {
                this.setState({
                        mode: mode
@@ -240,22 +247,13 @@ class NSVirtualLinkCreateStore {
        }
 
        createVirtualLinkSuccess(data) {
-               this.setState({
-                       // vld: this.vld,
-                       mode: 'editing',
-                       isLoading: false
-               });
+               this.onSuccess();
        }
        editVirtualLinkSuccess(data) {
-               this.setState({
-                       mode: 'editing',
-                       isLoading: false
-               });
+               this.onSuccess();
        }
        deleteVirtualLinkSuccess(data) {
-               this.setState({
-                       deleteState: 'success'
-               });
+               this.onSuccess();
        }
 
        cleanupPayload = (mode, vld) => {
index 8870dfc..fa09d9f 100644 (file)
@@ -137,7 +137,7 @@ class NsVirtualLinks extends React.Component {
                let nsd = nsr.nsd && nsr.nsd;
 
                nsr['decorated-vlrs'] && nsr['decorated-vlrs'].map((vlr, vlrIndex) => {
-                       let name = vlr.name || 'New virtual link being created';
+                       let name = vlr.name || 'Undergoing virtual link operation';
                        let operationalStatus = vlr['operational-status'];
                        let vlrId = vlr['id'];
                        let vldId = vlr['vld-ref'];
@@ -208,7 +208,7 @@ class NsVirtualLinks extends React.Component {
                        <div className="launchpadCard_title" style={{textAlign:'right'}}><span style={{float:'left'}}>VLD DETAILS</span>
                                        </div>
                        {
-                               <NSVirtualLinkCreate vld={this.state.editingVirtualLink} mode={this.state.mode} nsd={this.state.nsd} nsrId={this.state.nsrId} onCancel={this.handleCancelCreate}/>
+                               <NSVirtualLinkCreate vld={this.state.editingVirtualLink} mode={this.state.mode} nsd={this.state.nsd} nsrId={this.state.nsrId} onSuccess={this.resetState.bind(this)} onCancel={this.handleCancelCreate}/>
                        }
                 </div>
             );