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 {
}
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') {
let newState = {
dataCenters: dataCenters || []
};
- if (this.ro['account-type'] == 'openmano') {
+ if (this.ro && this.ro['account-type'] == 'openmano') {
newState.dataCenterID = dataCenters[this.ro.name][0].uuid
}
this.setState(newState)
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');
+ var msg = 'Something went wrong while trying to instantiate. Check the error logs for more information';
+ if(error) {
+ msg = error;
+ }
+ Alt.actions.global.showNotification.defer(msg);
Alt.actions.global.hideScreenLoader.defer();
this.setState({
isLoading: false
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});
}
},
},
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;
// 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'];
pnfd: data.pnfd
});
}
-// export default Alt.createStore(LaunchNetworkServiceStore);
export default LaunchNetworkServiceStore;