X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fconfig%2Fsrc%2Fdashboard%2FconfigSource.js;fp=skyquake%2Fplugins%2Fconfig%2Fsrc%2Fdashboard%2FconfigSource.js;h=0000000000000000000000000000000000000000;hb=03156e335275de1dafbc2a816e98006afdf249bf;hp=860d1f79e173d8451caff76188560a004b2cecb3;hpb=f2dc2462571800e62cba969964de621dca09299c;p=osm%2FUI.git diff --git a/skyquake/plugins/config/src/dashboard/configSource.js b/skyquake/plugins/config/src/dashboard/configSource.js deleted file mode 100644 index 860d1f79e..000000000 --- a/skyquake/plugins/config/src/dashboard/configSource.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * STANDARD_RIFT_IO_COPYRIGHT - */ -import $ from 'jquery'; -var Utils = require('utils/utils.js'); -let API_SERVER = require('utils/rw.js').getSearchParams(window.location).api_server; -let HOST = API_SERVER; -let NODE_PORT = require('utils/rw.js').getSearchParams(window.location).api_port || ((window.location.protocol == 'https:') ? 8443 : 8000); -let DEV_MODE = require('utils/rw.js').getSearchParams(window.location).dev_mode || false; - -if (DEV_MODE) { - HOST = window.location.protocol + '//' + window.location.hostname; -} - - -module.exports = function(Alt) { - return { - 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) { - resolve(data["rw-launchpad:resource-orchestrator"]); - }, - 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 - }, - update: { - remote: function(state, account) { - - return new Promise(function(resolve, reject) { - $.ajax({ - url: 'resource-orchestrator' + '?api_server=' + API_SERVER, - type:'PUT', - beforeSend: Utils.addAuthorizationStub, - data: JSON.stringify(account), - contentType: "application/json", - success: function(data) { - resolve({data}); - }, - error: function(error) { - console.log("There was an error updating the account: ", arguments); - return null; - } - }).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 updating the account.' - }), - success: Alt.actions.global.updateResourceOrchestratorSuccess, - 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; - } - } -}