X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=validation.git;a=blobdiff_plain;f=ui%2Fsrc%2Fmain%2Fwebapp%2Fapp%2FBluvalUI%2FValidationResults%2FTestSuiteResults%2FTestSuiteResultsController.js;fp=ui%2Fsrc%2Fmain%2Fwebapp%2Fapp%2FBluvalUI%2FValidationResults%2FTestSuiteResults%2FTestSuiteResultsController.js;h=8804de8b9d9974e4ae6ebd470100dbce48c6c76e;hp=0000000000000000000000000000000000000000;hb=2eba847ebb6acb2686be08eb1cdafc1b12071e7d;hpb=f86b9715d156238532fcb0bf464bd72e9cf7ce96 diff --git a/ui/src/main/webapp/app/BluvalUI/ValidationResults/TestSuiteResults/TestSuiteResultsController.js b/ui/src/main/webapp/app/BluvalUI/ValidationResults/TestSuiteResults/TestSuiteResultsController.js new file mode 100644 index 0000000..8804de8 --- /dev/null +++ b/ui/src/main/webapp/app/BluvalUI/ValidationResults/TestSuiteResults/TestSuiteResultsController.js @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var app = angular.module('ValidationResults'); +app.controller('TestSuiteResultsController', function($scope, + generalValidationResultsSvc) { + + initialize(); + + function initialize() { + $scope.showTestSuitesResults = false; + $scope.wRobotTestResults = []; + $scope.selectedTestId = null; + $scope.selectedTest = null; + $scope.resultsLayers = []; + $scope.resultsLayerTestSuitesNames = []; + $scope.selectedRobotTestResult = []; + $scope.selectedLayer = []; + $scope.selectedTestSuiteName = []; + + $scope.validationNexusTestResult = $scope.params; + $scope.wRobotTestResults = $scope.params.wRobotNexusTestResults; + if (generalValidationResultsSvc + .mapResult($scope.validationNexusTestResult) === null) { + confirm("No data was found"); + } else { + $scope.showTestSuitesResults = true; + angular.forEach($scope.wRobotTestResults, function(result) { + $scope.resultsLayers.push(result.blueprintLayer); + }); + } + + } + + $scope.selectedResultsLayerChange = function(selectedLayer) { + $scope.selectedTestId = null; + $scope.selectedTest = null; + $scope.resultsLayerTestSuitesNames = []; + $scope.robotTestResults = []; + $scope.selectedRobotTestResult = []; + $scope.selectedTestSuiteName = []; + var selectedLayerResult = []; + angular.forEach($scope.wRobotTestResults, function(result) { + if (result.blueprintLayer === selectedLayer) { + selectedLayerResult = result; + } + }); + $scope.robotTestResults = selectedLayerResult.robotTestResults; + angular.forEach($scope.robotTestResults, function(robotTestResult) { + $scope.resultsLayerTestSuitesNames.push(robotTestResult.name); + }); + } + + $scope.selectedTestSuitesNameChange = function(selectedTestSuiteName) { + if (!selectedTestSuiteName) { + return; + } + $scope.selectedTestId = null; + $scope.selectedTest = null; + angular.forEach($scope.robotTestResults, function(robotTestResult) { + if (robotTestResult.name.trim() === selectedTestSuiteName.trim()) { + $scope.selectedRobotTestResult = robotTestResult; + } + }); + } + + $scope.setClickedTest = function(test) { + $scope.selectedTestId = test.id; + $scope.selectedTest = test; + } + +});