Account and Instantiate fix for when RO account api is 204 28/328/1
authorLaurence Maultsby <laurence.maultsby@riftio.com>
Wed, 14 Sep 2016 16:45:20 +0000 (12:45 -0400)
committerLaurence Maultsby <laurence.maultsby@riftio.com>
Wed, 14 Sep 2016 16:45:20 +0000 (12:45 -0400)
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
skyquake/plugins/accounts/src/account/accountSource.js
skyquake/plugins/launchpad/src/instantiate/launchNetworkServiceSource.js

index c2aa4d4..4506724 100644 (file)
@@ -41,7 +41,7 @@ module.exports = function(Alt) {
                 type: 'POST',
                 beforeSend: Utils.addAuthorizationStub,
                 data: {
                 type: 'POST',
                 beforeSend: Utils.addAuthorizationStub,
                 data: {
-                  url:window.location.protocol + '//' + window.location.host + '/accounts/all?api_server=' + API_SERVER
+                    url:window.location.protocol + '//' + window.location.host + '/accounts/all?api_server=' + API_SERVER
                 },
                 success: function(data, textStatus, jqXHR) {
                   Utils.checkAndResolveSocketRequest(data, resolve, reject);
                 },
                 success: function(data, textStatus, jqXHR) {
                   Utils.checkAndResolveSocketRequest(data, resolve, reject);
@@ -222,7 +222,13 @@ module.exports = function(Alt) {
                   beforeSend: Utils.addAuthorizationStub,
                   contentType: "application/json",
                   success: function(data) {
                   beforeSend: Utils.addAuthorizationStub,
                   contentType: "application/json",
                   success: function(data) {
-                    resolve(data["rw-launchpad:resource-orchestrator"]);
+                    let returnedData;
+                    if (data.hasOwnProperty("rw-launchpad:resource-orchestrator")) {
+                      returnedData = data;
+                    } else {
+                      returnedData = {};
+                    }
+                    resolve(returnedData);
                   },
                   error: function(error) {
                     console.log("There was an error updating the account: ", arguments);
                   },
                   error: function(error) {
                     console.log("There was an error updating the account: ", arguments);
@@ -239,7 +245,7 @@ module.exports = function(Alt) {
             'error': 'There was an error retrieving the resource orchestrator information.'
           }),
           success: Alt.actions.global.getResourceOrchestratorSuccess,
             'error': 'There was an error retrieving the resource orchestrator information.'
           }),
           success: Alt.actions.global.getResourceOrchestratorSuccess,
-                    loading: Alt.actions.global.showScreenLoader,
+          loading: Alt.actions.global.showScreenLoader,
           error: Alt.actions.global.showNotification
         },
     }
           error: Alt.actions.global.showNotification
         },
     }
index 3a8886c..5bd3443 100644 (file)
@@ -200,7 +200,13 @@ export default function(Alt){
                   beforeSend: Utils.addAuthorizationStub,
                   contentType: "application/json",
                   success: function(data) {
                   beforeSend: Utils.addAuthorizationStub,
                   contentType: "application/json",
                   success: function(data) {
-                    resolve(data["rw-launchpad:resource-orchestrator"]);
+                    let returnedData;
+                    if (data.hasOwnProperty("rw-launchpad:resource-orchestrator")) {
+                      returnedData = data;
+                    } else {
+                      returnedData = {};
+                    }
+                    resolve(returnedData);
                   },
                   error: function(error) {
                     console.log("There was an error updating the account: ", arguments);
                   },
                   error: function(error) {
                     console.log("There was an error updating the account: ", arguments);