*/\r
\r
var msoCommitController = function(COMPONENT, FIELD, $scope, $http, $timeout, $window, $log,\r
- MsoService, PropertyService, UtilityService, DataService) {\r
+ MsoService, PropertyService, UtilityService, TestEnvironmentsService) {\r
\r
$scope.isViewVisible = false;\r
$scope.progressBarControl = {};\r
$scope.popupWindowControl = {};\r
-\r
+ var getRequestStatusFunc = getOrchestrationRequestStatus; //default\r
var _this = this;\r
\r
$scope.$on("createInstance", function(event, request) {\r
- init(request, COMPONENT.MSO_CREATE_REQ );\r
+ init(request, COMPONENT.MSO_CREATE_REQ, getOrchestrationRequestStatus );\r
MsoService.createInstance(request, handleInitialResponse);\r
});\r
\r
$scope.$on("deleteInstance", function(event, request) {\r
- init(request, COMPONENT.MSO_DELETE_REQ);\r
+ init(request, COMPONENT.MSO_DELETE_REQ, getOrchestrationRequestStatus);\r
MsoService.deleteInstance(request, handleInitialResponse);\r
});\r
\r
- var init = function(request, msoRequestType ) {\r
+ $scope.$on(COMPONENT.MSO_CREATE_ENVIRONMENT, function(event, request) {\r
+ init(request, COMPONENT.MSO_CREATE_ENVIRONMENT, getCloudResourcesRequestStatus);\r
+ TestEnvironmentsService.createApplicationEnv(request).then(handleInitialResponse);\r
+ });\r
+\r
+ $scope.$on(COMPONENT.MSO_DEACTIVATE_ENVIRONMENT, function(event, request) {\r
+ init(request, COMPONENT.MSO_DEACTIVATE_ENVIRONMENT, getCloudResourcesRequestStatus);\r
+ TestEnvironmentsService.deactivateApplicationEnv(request).then(handleInitialResponse)\r
+ });\r
+\r
+ $scope.$on(COMPONENT.MSO_ACTIVATE_ENVIRONMENT, function(event, request) {\r
+ init(request, COMPONENT.MSO_ACTIVATE_ENVIRONMENT, getCloudResourcesRequestStatus);\r
+ TestEnvironmentsService.activateApplicationEnv(request).then(handleInitialResponse)\r
+ });\r
+\r
+\r
+ var init = function(request, msoRequestType, getStatusRequest ) {\r
+ getRequestStatusFunc = getStatusRequest;\r
$scope.status = FIELD.STATUS.SUBMITTING_REQUEST;\r
$scope.isSpinnerVisible = true;\r
$scope.isProgressVisible = true;\r
showError(FIELD.ERROR.SYSTEM_FAILURE, UtilityService\r
.getHttpErrorMessage(response));\r
});\r
- }\r
+ };\r
\r
var handleInitialResponse = function(response) {\r
try {\r
updateViewAfterInitialResponse(response);\r
\r
- _this.timer = $timeout(getRequestStatus, PropertyService\r
+ _this.timer = $timeout(getRequestStatusFunc, PropertyService\r
.getMsoMaxPollingIntervalMsec());\r
\r
$scope.instanceId = response.data.entity.instanceId;\r
}\r
}\r
\r
- var getRequestStatus = function() {\r
- MsoService.getOrchestrationRequest(_this.requestId, handleGetResponse);\r
+ function getOrchestrationRequestStatus() {\r
+ MsoService.getOrchestrationRequest(_this.requestId, handleGetStatusResponse);\r
}\r
\r
- var handleGetResponse = function(response) {\r
+ function getCloudResourcesRequestStatus() {\r
+ TestEnvironmentsService.getRequestStatus(_this.requestId, handleGetStatusResponse);\r
+ }\r
+\r
+\r
+ var handleGetStatusResponse = function(response) {\r
try {\r
if (isUpdateViewAfterGetResponseComplete(response)) {\r
return;\r
_this.isMsoError = true;\r
showError(FIELD.ERROR.MAX_POLLS_EXCEEDED);\r
} else {\r
- _this.timer = $timeout(getRequestStatus, PropertyService\r
+ _this.timer = $timeout(getRequestStatusFunc, PropertyService\r
.getMsoMaxPollingIntervalMsec());\r
}\r
} catch (error) {\r
}\r
\r
appDS2.controller("msoCommitController", [ "COMPONENT", "FIELD", "$scope", "$http", "$timeout",\r
- "$window", "$log", "MsoService", "PropertyService", "UtilityService",\r
+ "$window", "$log", "MsoService", "PropertyService", "UtilityService", "TestEnvironmentsService",\r
msoCommitController ]);\r