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;
29 restAPISvc.getRestAPI("/api/v1/results/getlabs/", function(data) {
31 $scope.loadingLabs = false;
35 $scope.selectedLabChange = function() {
36 $scope.loadingLabs = false;
37 $scope.loadingBlueprints = true;
38 $scope.loadingVersions = false;
39 $scope.blueprints = [];
41 $scope.selectedBlueprint = {};
42 $scope.selectedVersion = {};
43 restAPISvc.getRestAPI("/api/v1/results/getblueprintnamesoflab/"
44 + $scope.selectedLab, function(data) {
45 $scope.blueprints = data;
46 $scope.loadingBlueprints = false;
50 $scope.selectedBlueprintChange = function() {
51 if (!$scope.selectedLab) {
54 $scope.loadingLabs = false;
55 $scope.loadingBlueprints = false;
56 $scope.loadingVersions = true;
58 $scope.selectedVersion = {};
59 restAPISvc.getRestAPI("/api/v1/results/getblueprintversions/"
60 + $scope.selectedBlueprint + "/" + $scope.selectedLab,
62 $scope.versions = data;
63 $scope.loadingVersions = false;
67 $scope.selectedVersionChange = function() {
70 $scope.get = function() {
71 if (!$scope.selectedLab || !$scope.selectedBlueprint
72 || !$scope.selectedVersion) {
73 confirm("You must specify all data fields");
76 $window.location.href = appContext + "/validationresults#?lab="
77 + $scope.selectedLab + "&" + "blueprintName="
78 + $scope.selectedBlueprint + "&" + "version="
79 + $scope.selectedVersion;