Check for vim account selection before instantiating- display error and prevent user...
authorLaurence Maultsby <laurence.maultsby@riftio.com>
Wed, 17 May 2017 20:28:22 +0000 (16:28 -0400)
committerkashalkar <kiran.kashalkar@riftio.com>
Thu, 18 May 2017 01:30:04 +0000 (02:30 +0100)
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
(cherry picked from commit 757cd367e122e32b5ac04d0196a932c8c35145e7)

Change-Id: I25412974e18befc79411c4d2478bdcacf939add3

skyquake/plugins/launchpad/src/instantiate/instantiateStore.js

index 0e91ee3..b673e3a 100644 (file)
@@ -140,7 +140,7 @@ class LaunchNetworkServiceStore {
             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];
+            newState.selectedCloudAccount = newState.cloudAccounts[0];
             if (cloudAccounts[0]['account-type'] == 'openstack') {
                 newState.displayPlacementGroups = true;
             } else {
@@ -707,6 +707,10 @@ class LaunchNetworkServiceStore {
         if (this.state.ro && this.state.ro['account-type'] == 'openmano') {
             payload['om-datacenter'] = this.state.dataCenterID;
         } else {
+            if(!this.state.selectedCloudAccount) {
+                Alt.actions.global.showNotification.defer("No VIM Account Selected");
+                return;
+            }
             payload["cloud-account"] = this.state.selectedCloudAccount.name;
         }
         if (this.state.hasConfigureNSD) {