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('GetMostRecent');
18 app.controller('GetMostRecentController', function($scope, restAPISvc, $window,
23 function initialize() {
25 $scope.loadingLabs = true;
26 $scope.loadingBlueprints = false;
27 $scope.loadingVersions = false;
28 $scope.loadingResults = false;
30 restAPISvc.getRestAPI("/api/v1/lab/", function(data) {
31 angular.forEach(data, function(lab) {
32 $scope.labs.push(lab.lab);
34 $scope.loadingLabs = false;
38 $scope.selectedLabChange = function() {
39 $scope.loadingLabs = false;
40 $scope.loadingBlueprints = true;
41 $scope.loadingVersions = false;
42 $scope.blueprints = [];
44 $scope.selectedBlueprint = {};
45 $scope.selectedVersion = {};
46 restAPISvc.getRestAPI("/api/v1/results/getblueprintnamesoflab/"
47 + $scope.selectedLab, function(data) {
48 $scope.blueprints = data;
49 $scope.loadingBlueprints = false;
53 $scope.selectedBlueprintChange = function() {
54 if (!$scope.selectedLab) {
57 $scope.loadingLabs = false;
58 $scope.loadingBlueprints = false;
59 $scope.loadingVersions = true;
61 $scope.selectedVersion = {};
62 restAPISvc.getRestAPI("/api/v1/results/getblueprintversions/"
63 + $scope.selectedBlueprint + "/" + $scope.selectedLab,
65 $scope.versions = data;
66 $scope.loadingVersions = false;
70 $scope.selectedVersionChange = function() {
73 $scope.get = function() {
74 if (!$scope.selectedLab || !$scope.selectedBlueprint
75 || !$scope.selectedVersion) {
76 confirm("You must specify all data fields");
79 $window.location.href = appContext + "/validationresults#?lab="
80 + $scope.selectedLab + "&" + "blueprintName="
81 + $scope.selectedBlueprint + "&" + "version="
82 + $scope.selectedVersion;