X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2Finstantiate%2FinstantiateStore.js;h=0e91ee38419017665bd772a30d9401fc2cfe2e1d;hp=5cf0807be3c7dce9f5284cfde30a5b77d09c3fd8;hb=8d3a5ec71ebb2f7f2932fee5732ae62718ca8efb;hpb=9a546bd5bcb6db7488f6a4059a356d8beb9b5b11 diff --git a/skyquake/plugins/launchpad/src/instantiate/instantiateStore.js b/skyquake/plugins/launchpad/src/instantiate/instantiateStore.js index 5cf0807be..0e91ee384 100644 --- a/skyquake/plugins/launchpad/src/instantiate/instantiateStore.js +++ b/skyquake/plugins/launchpad/src/instantiate/instantiateStore.js @@ -20,7 +20,8 @@ import NetworkServiceSource from './launchNetworkServiceSource.js'; import GUID from 'utils/guid.js'; import AppHeaderActions from 'widgets/header/headerActions.js'; import Alt from '../alt'; -import _ from 'lodash'; +import _cloneDeep from 'lodash/cloneDeep'; +import _find from 'lodash/find'; class LaunchNetworkServiceStore { @@ -131,7 +132,13 @@ class LaunchNetworkServiceStore { } getLaunchCloudAccountSuccess(cloudAccounts) { let newState = {}; - newState.cloudAccounts = cloudAccounts || []; + newState.cloudAccounts = cloudAccounts.filter(function(v) { + console.log(v) + return v['connection-status'].status == 'success'; + }) || []; + if(cloudAccounts.length != newState.cloudAccounts.length) { + Alt.actions.global.showNotification.defer({type: 'warning', msg: 'One or more VIM accounts have failed to connect'}); + } if(cloudAccounts && cloudAccounts.length > 0) { newState.selectedCloudAccount = cloudAccounts[0]; if (cloudAccounts[0]['account-type'] == 'openstack') { @@ -156,7 +163,7 @@ class LaunchNetworkServiceStore { let newState = { dataCenters: dataCenters || [] }; - if (this.state.ro && this.state.ro['account-type'] == 'openmano') { + if (this.ro && this.ro['account-type'] == 'openmano') { newState.dataCenterID = dataCenters[this.ro.name][0].uuid } this.setState(newState) @@ -182,8 +189,12 @@ class LaunchNetworkServiceStore { }); return window.location.hash = 'launchpad/' + tokenizedHash[2]; } - launchNSRError(error) { - Alt.actions.global.showError.defer('Something went wrong while trying to instantiate. Check the error logs for more information'); + launchNSRError(data) { + var msg = 'Something went wrong while trying to instantiate. Check the error logs for more information'; + if (data.error) { + msg = data.error; + } + Alt.actions.global.showNotification.defer(msg); Alt.actions.global.hideScreenLoader.defer(); this.setState({ isLoading: false @@ -474,6 +485,11 @@ class LaunchNetworkServiceStore { let value = e.target.nodeName == "SELECT" ? JSON.parse(e.target.value) : e.target.value; self.ipProfiles[i]['ip-profile-params'][key] = value; + if (value == '') { + // Don't send this key + delete self.ipProfiles[i]['ip-profile-params'][key]; + } + self.setState({ipProfiles:self.ipProfiles}); } }, @@ -625,7 +641,7 @@ class LaunchNetworkServiceStore { }, updateSSHkeyRef: function(i, j, remove){ return function(e) { - let usersList = _.cloneDeep(self.usersList) + let usersList = _cloneDeep(self.usersList) let keys = usersList[i]['ssh-authorized-key']; if(!remove) { let keyRef = JSON.parse(e.target.value).name; @@ -657,7 +673,7 @@ class LaunchNetworkServiceStore { // Create a filtered NSD payload from the decorated one as RW.REST cannot handle extra parameters now let nsdPayload = {}; - nsdPayload = _.cloneDeep(_.find(this.state.nsd[0].descriptors, {id: this.state.selectedNSDid})); + nsdPayload = _cloneDeep(_find(this.state.nsd[0].descriptors, {id: this.state.selectedNSDid})); if (nsdPayload != {}) { nsdPayload['meta'] && delete nsdPayload['meta']; @@ -836,5 +852,4 @@ function getMockData() { pnfd: data.pnfd }); } -// export default Alt.createStore(LaunchNetworkServiceStore); export default LaunchNetworkServiceStore;