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('GetByTimestamp');
18 app.controller('GetByTimestampController',
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 = [];
39 $scope.selectedBlueprint = {};
40 $scope.selectedVersion = {};
41 restAPISvc.getRestAPI("/api/v1/results/getblueprintnamesoflab/"
42 + $scope.selectedLab, function(data) {
43 $scope.blueprints = data;
44 $scope.loadingBlueprints = false;
48 $scope.selectedBlueprintChange = function() {
49 if (!$scope.selectedLab) {
52 $scope.loadingLabs = false;
53 $scope.loadingBlueprints = false;
54 $scope.loadingVersions = true;
56 $scope.selectedVersion = {};
57 restAPISvc.getRestAPI("/api/v1/results/getblueprintversions/"
58 + $scope.selectedBlueprint + "/" + $scope.selectedLab,
60 $scope.versions = data;
61 $scope.loadingVersions = false;
65 $scope.selectedVersionChange = function() {
66 $scope.loadingLabs = false;
67 $scope.loadingBlueprints = false;
68 $scope.loadingVersions = false;
69 $scope.loadingResults = false;
72 $scope.get = function() {
73 if (!$scope.selectedLab || !$scope.selectedBlueprint
74 || !$scope.selectedVersion || !$scope.definedTimestamp) {
75 confirm("You must specify all data fields");
79 $window.location.href = appContext
80 + "/validationresults#?blueprintName="
81 + $scope.selectedBlueprint + "&" + "version="
82 + $scope.selectedVersion + "&" + "lab=" + $scope.selectedLab
83 + "&" + "timestamp=" + $scope.definedTimestamp;