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('GetLastRun');
18 app.controller('GetLastRunController',
20 function($scope, restAPISvc, $window, appContext) {
23 function initialize() {
24 $scope.loadingLabs = true;
25 $scope.loadingBlueprints = false;
26 $scope.loadingVersions = false;
27 restAPISvc.getRestAPI("/api/v1/results/getlabs/", function(data) {
29 $scope.loadingLabs = false;
33 $scope.selectedLabChange = function() {
34 $scope.loadingLabs = false;
35 $scope.loadingBlueprints = true;
36 $scope.loadingVersions = false;
37 $scope.blueprints = [];
40 $scope.optionals = [];
42 $scope.selectedBlueprint = {};
43 $scope.selectedVersion = {};
44 $scope.selectedLayer = {};
45 $scope.selectedOptional = {};
46 $scope.selectedOutcome = {};
47 restAPISvc.getRestAPI("/api/v1/results/getblueprintnamesoflab/"
48 + $scope.selectedLab, function(data) {
49 $scope.blueprints = data;
50 $scope.loadingBlueprints = false;
54 $scope.selectedBlueprintChange = function() {
55 if (!$scope.selectedLab) {
58 $scope.loadingLabs = false;
59 $scope.loadingBlueprints = false;
60 $scope.loadingVersions = true;
63 $scope.optionals = [];
65 $scope.selectedVersion = {};
66 $scope.selectedLayer = {};
67 $scope.selectedOptional = {};
68 $scope.selectedOutcome = {};
69 restAPISvc.getRestAPI("/api/v1/results/getblueprintversions/"
70 + $scope.selectedBlueprint + "/" + $scope.selectedLab,
72 $scope.versions = data;
73 $scope.loadingVersions = false;
77 $scope.selectedVersionChange = function() {
79 $scope.optionals = [];
81 $scope.selectedLayer = {};
82 $scope.selectedOptional = {};
83 $scope.selectedOutcome = {};
84 $scope.loadingLabs = false;
85 $scope.loadingBlueprints = false;
86 $scope.loadingVersions = false;
87 $scope.loadingResults = false;
88 $scope.layers = [ 'all', 'hardware', 'os', 'k8s', 'openstack' ];
91 $scope.selectedLayerChange = function() {
92 $scope.optionals = [];
94 $scope.selectedOptional = {};
95 $scope.selectedOutcome = {};
96 $scope.loadingLabs = false;
97 $scope.loadingBlueprints = false;
98 $scope.loadingVersions = false;
99 $scope.loadingResults = false;
100 $scope.optionals = [ 'true', 'false' ];
103 $scope.selectedOptionalChange = function() {
104 $scope.outcomes = [];
105 $scope.selectedOutcome = {};
106 $scope.loadingLabs = false;
107 $scope.loadingBlueprints = false;
108 $scope.loadingVersions = false;
109 $scope.loadingResults = false;
110 $scope.outcomes = [ 'SUCCESS', 'FAILURE' ];
113 $scope.selectedOutcomeChange = function() {
114 $scope.loadingLabs = false;
115 $scope.loadingBlueprints = false;
116 $scope.loadingVersions = false;
117 $scope.loadingResults = false;
120 $scope.get = function() {
121 if (!$scope.selectedLab || !$scope.selectedBlueprint
122 || !$scope.selectedVersion || !$scope.selectedLayer
123 || !$scope.selectedOptional || !$scope.selectedOutcome) {
124 confirm("You must specify all data fields");
128 if ($scope.selectedOutcome === 'SUCCESS') {
135 if ($scope.selectedLayer === 'all') {
138 layer = $scope.selectedLayer;
140 $window.location.href = appContext
141 + "/validationresults#?blueprintName="
142 + $scope.selectedBlueprint + "&" + "version="
143 + $scope.selectedVersion + "&" + "lab=" + $scope.selectedLab
144 + "&" + "allLayers=" + allLayers + "&" + "layer=" + layer + "&"
145 + "optional=" + $scope.selectedOptional + "&" + "outcome="