X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Faccounts%2Fsrc%2Faccount%2FaccountSource.js;h=52af8578b2103de8aafa4a2b387cefae0b226b49;hp=c2aa4d495cd0cc62ec9a3dff578cd9d66cf19ffa;hb=ab1a488edf76171354e4278c1fb11bac9069cf68;hpb=dfe972ff7c9f7b6b1d730e66b0b2aa8df2ce329b diff --git a/skyquake/plugins/accounts/src/account/accountSource.js b/skyquake/plugins/accounts/src/account/accountSource.js index c2aa4d495..52af8578b 100644 --- a/skyquake/plugins/accounts/src/account/accountSource.js +++ b/skyquake/plugins/accounts/src/account/accountSource.js @@ -34,14 +34,15 @@ module.exports = function(Alt) { return new Promise(function(resolve, reject) { //If socket connection already exists, eat the request. if(state.socket) { + console.log('connection already exists') return resolve(false); } $.ajax({ - url: '//' + window.location.hostname + ':' + NODE_PORT + '/socket-polling?api_server=' + API_SERVER , + url: '/socket-polling?api_server=' + API_SERVER, type: 'POST', beforeSend: Utils.addAuthorizationStub, data: { - url:window.location.protocol + '//' + window.location.host + '/accounts/all?api_server=' + API_SERVER + url: 'accounts/all?api_server=' + API_SERVER }, success: function(data, textStatus, jqXHR) { Utils.checkAndResolveSocketRequest(data, resolve, reject); @@ -222,7 +223,13 @@ module.exports = function(Alt) { 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); @@ -239,7 +246,7 @@ module.exports = function(Alt) { '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 }, }