diff options
author | 2018-01-31 17:19:00 +0200 | |
---|---|---|
committer | 2018-01-31 17:19:00 +0200 | |
commit | 1cfb08779ea0e00be69e072a940b3063e049fe6b (patch) | |
tree | 6602a900387c8393ed0dcd81c0539381632903c6 /vid-app-common/src/main/webapp/app/vid/scripts/services/testEnvironmentsService.js | |
parent | 2f20b001b9243e0f8b44aecc768ec265fd538732 (diff) |
org.onap migration
Change-Id: I52f0b2851f2c765752b6d21f49b32136d7d72a3d
Issue-ID: VID-86
Signed-off-by: Ofir Sonsino <os0695@att.com>
Diffstat (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/services/testEnvironmentsService.js')
-rw-r--r-- | vid-app-common/src/main/webapp/app/vid/scripts/services/testEnvironmentsService.js | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/testEnvironmentsService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/testEnvironmentsService.js new file mode 100644 index 00000000..6ae675a0 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/testEnvironmentsService.js @@ -0,0 +1,79 @@ +(function () { + 'use strict'; + + appDS2.service('TestEnvironmentsService', ['$q', '$http', '$log', 'COMPONENT', 'UtilityService', testEnvironmentsService]); + + function testEnvironmentsService($q, $http, $log, COMPONENT, UtilityService) { + this.loadAAIestEnvironments = function(type) { + var deferred = $q.defer(); + $http.get(COMPONENT.AAI_GET_TEST_ENVIRONMENTS + type) + .success(function (response) { + if(response.httpCode == 200) { + deferred.resolve({operationalEnvironment: response.t.operationalEnvironment}); + } + else { + deferred.reject({message: response.errorMessage, status: response.httpCode}); + } + }) + .error(function(data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.createApplicationEnv = function(request) { + var deferred = $q.defer(); + + $http.post(COMPONENT.OPERATIONAL_ENVIRONMENT_CREATE, JSON.stringify(request.requestDetails)) + .success(function (response) { + deferred.resolve({data: response}); + }).error(function (data, status) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + } + + this.deactivateApplicationEnv = function(request) { + var deferred = $q.defer(); + + $http.post(COMPONENT.OPERATIONAL_ENVIRONMENT_DEACTIVATE + request.envId, JSON.stringify({})) + .success(function (response) { + deferred.resolve({data: response}); + }).error(function (data, status) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.activateApplicationEnv = function(request) { + var deferred = $q.defer(); + + $http.post(COMPONENT.OPERATIONAL_ENVIRONMENT_ACTIVATE + request.envId, JSON.stringify({ + "relatedInstanceId": request.relatedInstanceId + , "relatedInstanceName": request.relatedInstanceName + , "workloadContext": request.workloadContext + , "manifest": request.manifest + })) + .success(function (response) { + deferred.resolve({data: response}); + }).error(function (response, status) { + UtilityService.runHttpErrorHandler({data:response, status:status}); + }); + return deferred.promise; + }; + + this.getRequestStatus = function(requestId, successCallback) { + $http.get(COMPONENT.OPERATIONAL_ENVIRONMENT_STATUS + requestId) + .success(function(response) { + successCallback({data: response}); + } ) + .catch(UtilityService.runHttpErrorHandler); + }; + } + + +})(); + |