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('ValidationResults');
18 app.controller('TestSuiteResultsController', function($scope,
19 generalValidationResultsSvc) {
23 function initialize() {
24 $scope.showTestSuitesResults = false;
25 $scope.wrobotTestResults = [];
26 $scope.selectedTestId = '';
27 $scope.selectedTest = '';
28 $scope.resultsLayers = [];
29 $scope.resultsLayerTestSuitesNames = [];
30 $scope.selectedRobotTestResult = '';
31 $scope.selectedLayer = '';
32 $scope.selectedTestSuiteName = '';
33 $scope.validationDbTestResult = $scope.params;
34 $scope.wrobotTestResults = $scope.params.wrobotDbTestResults;
35 if (generalValidationResultsSvc
36 .mapResult($scope.validationDbTestResult) === null) {
37 confirm("No data was found");
39 $scope.showTestSuitesResults = true;
40 angular.forEach($scope.wrobotTestResults, function(result) {
41 $scope.resultsLayers.push(result.layer);
47 $scope.selectedResultsLayerChange = function(selectedLayer) {
48 $scope.selectedTestId = null;
49 $scope.selectedTest = null;
50 $scope.resultsLayerTestSuitesNames = [];
51 $scope.robotTestResults = [];
52 $scope.selectedRobotTestResult = '';
53 $scope.selectedTestSuiteName = '';
54 var selectedLayerResult = [];
55 angular.forEach($scope.wrobotTestResults, function(result) {
56 if (result.layer === selectedLayer) {
57 selectedLayerResult = result;
60 $scope.robotTestResults = angular
61 .fromJson(selectedLayerResult.robotTestResults);
62 angular.forEach($scope.robotTestResults, function(robotTestResult) {
63 $scope.resultsLayerTestSuitesNames.push(robotTestResult.name);
67 $scope.selectedTestSuitesNameChange = function(selectedTestSuiteName) {
68 if (!selectedTestSuiteName) {
71 $scope.selectedTestId = '';
72 $scope.selectedTest = '';
73 angular.forEach($scope.robotTestResults, function(robotTestResult) {
74 if (robotTestResult.name.trim() === selectedTestSuiteName.trim()) {
75 $scope.selectedRobotTestResult = robotTestResult;
80 $scope.setClickedTest = function(test) {
81 $scope.selectedTestId = test.id;
82 $scope.selectedTest = test;