X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2Finstantiate%2FlaunchNetworkServiceSource.js;h=1b2d526750a6a05e3fc6702f7307d0d2ceaf6558;hp=d2d950f08e8f1d05a53763b5b4543fe507534c5a;hb=8dd157ab3bfef0f8a1753390959dd1ee9c9b1e31;hpb=e29efc315df33d546237e270470916e26df391d6 diff --git a/skyquake/plugins/launchpad/src/instantiate/launchNetworkServiceSource.js b/skyquake/plugins/launchpad/src/instantiate/launchNetworkServiceSource.js index d2d950f08..1b2d52675 100644 --- a/skyquake/plugins/launchpad/src/instantiate/launchNetworkServiceSource.js +++ b/skyquake/plugins/launchpad/src/instantiate/launchNetworkServiceSource.js @@ -1,6 +1,6 @@ /* - * + * * Copyright 2016 RIFT.IO Inc * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -190,6 +190,54 @@ export default function(Alt){ }, success: Alt.actions.global.getConfigAgentSuccess, error: Alt.actions.global.getConfigAgentError + }, + 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['rw-launchpad:resource-orchestrator']; + } 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 + } + } } +function interceptResponse (responses) { + return function(data, action, args) { + if(responses.hasOwnProperty(data)) { + return { + type: data, + msg: responses[data] + } + } else { + return data; + } + } }