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 AECBlueprintValidationUIApp = angular
18 .module('BlueprintValidationUIManagement');
20 AECBlueprintValidationUIApp
22 'AECNewSubmissionController',
23 function($scope, appContext, restAPISvc) {
27 function initialize() {
30 "/api/blueprintInstance/",
32 $scope.blueprintInstances = data;
33 $scope.blueprintNames = [];
36 $scope.blueprintInstances,
39 if ($scope.blueprintNames
40 .indexOf(blueprintInstance["blueprint"]["blueprintName"]) === -1) {
42 .push(blueprintInstance["blueprint"]["blueprintName"]);
47 $scope.selectedBluePrintNameChange = function() {
48 $scope.blueprintVersions = [];
49 $scope.blueprintLayers = [];
50 $scope.declerativeTimeslots = [];
53 $scope.blueprintInstances,
54 function(blueprintInstance) {
55 if ($scope.selectedBlueprintName === blueprintInstance["blueprint"]["blueprintName"]) {
56 if ($scope.blueprintVersions
57 .indexOf(blueprintInstance["version"]) === -1) {
58 $scope.blueprintVersions
59 .push(blueprintInstance["version"]);
64 $scope.selectedBluePrintVersionChange = function() {
65 $scope.blueprintLayers = [];
66 $scope.declerativeTimeslots = [];
69 $scope.blueprintInstances,
70 function(blueprintInstance) {
71 if ($scope.selectedBlueprintName === blueprintInstance["blueprint"]["blueprintName"]) {
72 if ($scope.selectedBlueprintVersion === blueprintInstance["version"]) {
73 if ($scope.blueprintLayers
74 .indexOf(blueprintInstance["layer"]) === -1) {
75 $scope.blueprintLayers
76 .push(blueprintInstance["layer"]);
82 $scope.selectedBluePrintLayerChange = function() {
83 $scope.declerativeTimeslots = [];
86 $scope.blueprintInstances,
87 function(blueprintInstance) {
88 if ($scope.selectedBlueprintName === blueprintInstance["blueprint"]["blueprintName"]) {
89 if ($scope.selectedBlueprintVersion === blueprintInstance["version"]) {
90 if ($scope.selectedBlueprintLayer === blueprintInstance["layer"]) {
92 + blueprintInstance["timeslot"].timeslotId
93 + " Start date and time: "
94 + blueprintInstance["timeslot"].startDateTime
95 + " duration(in sec) :"
96 + blueprintInstance["timeslot"].duration
98 + blueprintInstance["timeslot"].lab;
99 if ($scope.declerativeTimeslots
100 .indexOf(temp) === -1) {
101 $scope.declerativeTimeslots
109 $scope.submit = function() {
113 $scope.blueprintInstances,
114 function(blueprintInstance) {
115 if (blueprintInstance["blueprint"]["blueprintName"] === $scope.selectedBlueprintName) {
116 if (blueprintInstance["version"] === $scope.selectedBlueprintVersion) {
117 if (blueprintInstance["layer"] === $scope.selectedBlueprintLayer) {
118 var selectedDeclerativeTimeslotId = $scope.selectedDeclerativeTimeslot
120 $scope.selectedDeclerativeTimeslot
122 $scope.selectedDeclerativeTimeslot
123 .indexOf("Start date and time:") - 1);
124 if (selectedDeclerativeTimeslotId
126 .trim() === blueprintInstance["timeslot"]["timeslotId"]
129 finalBlueprint = blueprintInstance;
136 "blueprintInstance" : finalBlueprint
143 if (data !== undefined) {
144 confirm("Submission committed successfully");
146 confirm("Error when committing the submission");