X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Faccounts%2Fsrc%2Faccount%2FaccountSource.js;h=c0fd36b3d291f8e4f79e6bb0b0b2bd8d10f084e0;hp=5fa7869f3a3dca576a07307db5aa8a95816c8a70;hb=b78fbe20fd7d976b3e15abb2387b4e329a5ea918;hpb=e29efc315df33d546237e270470916e26df391d6 diff --git a/skyquake/plugins/accounts/src/account/accountSource.js b/skyquake/plugins/accounts/src/account/accountSource.js index 5fa7869f3..c0fd36b3d 100644 --- a/skyquake/plugins/accounts/src/account/accountSource.js +++ b/skyquake/plugins/accounts/src/account/accountSource.js @@ -1,5 +1,5 @@ /* - * + * * Copyright 2016 RIFT.IO Inc * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,6 +34,7 @@ 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({ @@ -41,7 +42,7 @@ module.exports = function(Alt) { 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); @@ -212,7 +213,42 @@ module.exports = function(Alt) { success: Alt.actions.global.deleteAccountSuccess, loading: Alt.actions.global.deleteAccountLoading, error: Alt.actions.global.showNotification - } + }, + getResourceOrchestrator: { + remote: function() { + return new Promise(function(resolve, reject) { + $.ajax({ + url: 'passthrough/data/api/running/resource-orchestrator' + '?api_server=' + API_SERVER, + type: 'GET', + beforeSend: Utils.addAuthorizationStub, + contentType: "application/json", + success: function(data) { + 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); + + } + }).fail(function(xhr){ + //Authentication and the handling of fail states should be wrapped up into a connection class. + Utils.checkAuthentication(xhr.status); + return reject('error'); + }); + }); + }, + interceptResponse: interceptResponse({ + 'error': 'There was an error retrieving the resource orchestrator information.' + }), + success: Alt.actions.global.getResourceOrchestratorSuccess, + loading: Alt.actions.global.showScreenLoader, + error: Alt.actions.global.showNotification + }, } }