2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
24 appDS2.controller("changeManagementManualTasksController", ["$uibModalInstance", "jobInfo", "MsoService", "COMPONENT",
25 "$log", changeManagementManualTasksController]);
27 function changeManagementManualTasksController($uibModalInstance, jobInfo, MsoService, COMPONENT, $log) {
31 vm.MANUAL_TASKS = COMPONENT.MANUAL_TASKS;
32 var init = function() {
33 vm.requestState = jobInfo.requestState;
35 if (jobInfo && jobInfo.details) {
36 vm.content = jobInfo.details;
38 vm.content = "The VNF change alerted due to unknown reason.";
41 loadAvailableTasks(jobInfo.job.requestId);
45 function loadAvailableTasks(requestId) {
46 MsoService.getManualTasks(requestId)
47 .then(function(response) {
48 vm.task = response.data[0];
49 vm.manualTasks = vm.task && vm.task.validResponses;
51 .catch(function(error) {
56 vm.completeTask = function(task) {
57 MsoService.completeTask(vm.task.taskId, task)
58 .then(function(response) {
59 vm.manualTasks = response.data;
60 $uibModalInstance.close(task + " action completed successfully.");
62 .catch(function(error) {
63 $uibModalInstance.close(task + " action failed.");
68 vm.close = function () {
69 $uibModalInstance.close();
72 vm.isTaskAvailable = function(task) {
73 return vm.manualTasks.includes(task);