2 * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 var app = angular.module('UnRegisterBlueprintInstance');
20 'UnRegisterBlueprintInstanceController',
21 function($scope, restAPISvc) {
25 function initialize() {
26 $scope.loadingBlueprintInstances = true;
27 $scope.blueprintInstanceInfos = [];
28 $scope.declerativeInsts = [];
29 $scope.selectedBlueprintInstance = '';
32 "/api/v1/blueprintinstance/",
35 $scope.blueprintInstanceInfos = data;
42 + blueprintInstance.blueprintInstanceId
44 + blueprintInstance["blueprint"]["blueprintName"]
46 + blueprintInstance["version"];
47 $scope.declerativeInsts
51 confirm("No blueprint instances found");
53 $scope.loadingBlueprintInstances = false;
57 $scope.unRegister = function() {
58 if (!$scope.selectedBlueprintInstance) {
59 confirm("You must select a blueprint instance");
62 var finalBlueprintInstanceInfo = '';
63 var id = $scope.selectedBlueprintInstance
64 .substring($scope.selectedBlueprintInstance
66 $scope.selectedBlueprintInstance
67 .indexOf("name") - 1);
70 $scope.blueprintInstanceInfos,
71 function(blueprintInstanceInfo) {
72 if (blueprintInstanceInfo.blueprintInstanceId
73 .toString().trim() === id
75 finalBlueprintInstanceInfo = blueprintInstanceInfo;
78 if (!finalBlueprintInstanceInfo) {
79 confirm("Error in blueprint instance data");
84 "/api/v1/blueprintinstance/",
85 finalBlueprintInstanceInfo,
88 var confirmText = "The blueprint instance has been unregistered successfully."
91 confirm("Error when unregistering the blueprint instance");