X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2Fvirtual_links%2FnsVirtualLinkCreateStore.js;h=ac050e4ccfa201017f5b4eec625b9ddad0846f09;hb=418d4715ca387732a401d7041a1d3c77e3a97df8;hp=a3708feb549b172fcfcf2d9163710618411f782c;hpb=e29efc315df33d546237e270470916e26df391d6;p=osm%2FUI.git diff --git a/skyquake/plugins/launchpad/src/virtual_links/nsVirtualLinkCreateStore.js b/skyquake/plugins/launchpad/src/virtual_links/nsVirtualLinkCreateStore.js index a3708feb5..ac050e4cc 100644 --- a/skyquake/plugins/launchpad/src/virtual_links/nsVirtualLinkCreateStore.js +++ b/skyquake/plugins/launchpad/src/virtual_links/nsVirtualLinkCreateStore.js @@ -18,7 +18,9 @@ import NSVirtualLinkCreateActions from './nsVirtualLinkCreateActions.js'; import NSVirtualLinkCreateSource from './nsVirtualLinkCreateSource.js'; import Alt from '../alt'; -import _ from 'lodash'; +import _cloneDeep from 'lodash/cloneDeep'; +import _pickBy from 'lodash/pickBy'; +import _identity from 'lodash/identity'; class NSVirtualLinkCreateStore { constructor() { @@ -84,7 +86,8 @@ class NSVirtualLinkCreateStore { saveVnfdIdRefs: this.saveVnfdIdRefs, saveIpProfileNames: this.saveIpProfileNames, removeVirtualLink: this.removeVirtualLink, - saveMode: this.saveMode + saveMode: this.saveMode, + saveOnSuccess: this.saveOnSuccess }); } @@ -97,6 +100,12 @@ class NSVirtualLinkCreateStore { }); } + saveOnSuccess = (onSuccess) => { + this.setState({ + onSuccess: onSuccess + }) + } + saveMode = (mode) => { this.setState({ mode: mode @@ -134,7 +143,7 @@ class NSVirtualLinkCreateStore { } updateFirstLevelKey = (key, e) => { - let vld = _.cloneDeep(this.vld); + let vld = _cloneDeep(this.vld); let value = e.target.nodeName == "SELECT" ? JSON.parse(e.target.value) : e.target.value; vld[key] = value; this.setState({ @@ -143,7 +152,7 @@ class NSVirtualLinkCreateStore { } updateSecondLevelKey = (firstLevelKey, secondLevelKey, e) => { - let vld = _.cloneDeep(this.vld); + let vld = _cloneDeep(this.vld); if (!vld[firstLevelKey]) { vld[firstLevelKey] = {}; } @@ -169,10 +178,11 @@ class NSVirtualLinkCreateStore { } updateVLDInitParamsValue = (currentVLDInitParamsType, e) => { - let vld = _.cloneDeep(this.vld); + let vld = _cloneDeep(this.vld); this.vldInitParamsTypes.map((vldInitParamType) => { if (currentVLDInitParamsType == vldInitParamType) { - vld[currentVLDInitParamsType] = e.target.value; + let value = e.target.nodeName == "SELECT" ? JSON.parse(e.target.value) : e.target.value; + vld[currentVLDInitParamsType] = value; } else { vld[vldInitParamType] && delete vld[vldInitParamType]; } @@ -184,7 +194,7 @@ class NSVirtualLinkCreateStore { } updateFirstLevelListKeyChange = (listName, index, keyName, e) => { - let vld = _.cloneDeep(this.vld); + let vld = _cloneDeep(this.vld); !vld[listName] && (vld[listName] = []); @@ -199,7 +209,7 @@ class NSVirtualLinkCreateStore { addConnectionPointRef = () => { let vld = {}; if (this.vld) { - vld = _.cloneDeep(this.vld); + vld = _cloneDeep(this.vld); if (!vld['vnfd-connection-point-ref']) { vld['vnfd-connection-point-ref'] = []; } @@ -216,7 +226,7 @@ class NSVirtualLinkCreateStore { } removeConnectionPointRef = (vnfdConnectionPointRefIndex) => { - let vld = _.cloneDeep(this.vld); + let vld = _cloneDeep(this.vld); vld['vnfd-connection-point-ref'].splice(vnfdConnectionPointRefIndex, 1); this.setState({ vld: vld @@ -239,27 +249,18 @@ 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) => { // Do necessary cleanup here - let cleanVld = _.pickBy(vld, _.identity); + let cleanVld = _pickBy(vld, _identity); return cleanVld; }