aboutsummaryrefslogtreecommitdiffstats
path: root/3rd_party/static/onap-ui/components/results-report
diff options
context:
space:
mode:
authorpkaralis <pkaralis@intracom-telecom.com>2018-12-06 00:43:12 +0200
committerPanagiotis Karalis <pkaralis@intracom-telecom.com>2019-03-20 15:28:23 +0200
commitd0bbf3b8952379883550c6eb2062476a6d15043e (patch)
tree106f65b223054077279bda7ff988a73bea314a34 /3rd_party/static/onap-ui/components/results-report
parent5f20495d6e3ec984c4e86fd76399ddf0d042b336 (diff)
Enable Web Portal for ONAP results
The web portal needs to be able to read test results of the ONAP compliance program and display them. In order for the above goal to be achieved, the following two parts should be impacted: 1- A new front-end should be prepared in order to handle and display the results 2- The REST API should be extended in order to support the aforementioned operation. JIRA: DOVETAIL-669 Change-Id: I36bbb6e602a67020d7e27aedbfc776f5cf4f3dc3 Signed-off-by: pkaralis <pkaralis@intracom-telecom.com> Co-Authored-By: Stamatis Katsaounis <mokats@intracom-telecom.com>
Diffstat (limited to '3rd_party/static/onap-ui/components/results-report')
-rw-r--r--3rd_party/static/onap-ui/components/results-report/data/2019.04/heat-testcases.json13
-rw-r--r--3rd_party/static/onap-ui/components/results-report/data/2019.04/tosca-testcases.json13
-rw-r--r--3rd_party/static/onap-ui/components/results-report/partials/reportDetails.html60
-rw-r--r--3rd_party/static/onap-ui/components/results-report/resultsReport.html33
-rw-r--r--3rd_party/static/onap-ui/components/results-report/resultsReportController.js224
5 files changed, 343 insertions, 0 deletions
diff --git a/3rd_party/static/onap-ui/components/results-report/data/2019.04/heat-testcases.json b/3rd_party/static/onap-ui/components/results-report/data/2019.04/heat-testcases.json
new file mode 100644
index 0000000..1f584f4
--- /dev/null
+++ b/3rd_party/static/onap-ui/components/results-report/data/2019.04/heat-testcases.json
@@ -0,0 +1,13 @@
+{
+ "mandatory": {
+ "onap-vvp.validate.heat": {
+ "cases": [
+ "onap-vvp.validate.heat"
+ ],
+ "total": 1
+ }
+ },
+ "optional": {
+
+ }
+}
diff --git a/3rd_party/static/onap-ui/components/results-report/data/2019.04/tosca-testcases.json b/3rd_party/static/onap-ui/components/results-report/data/2019.04/tosca-testcases.json
new file mode 100644
index 0000000..de01e83
--- /dev/null
+++ b/3rd_party/static/onap-ui/components/results-report/data/2019.04/tosca-testcases.json
@@ -0,0 +1,13 @@
+{
+ "mandatory": {
+ "onap-vtp.validate.csar": {
+ "cases": [
+ "onap-vtp.validate.csar"
+ ],
+ "total": 1
+ }
+ },
+ "optional": {
+
+ }
+}
diff --git a/3rd_party/static/onap-ui/components/results-report/partials/reportDetails.html b/3rd_party/static/onap-ui/components/results-report/partials/reportDetails.html
new file mode 100644
index 0000000..3f3e9c9
--- /dev/null
+++ b/3rd_party/static/onap-ui/components/results-report/partials/reportDetails.html
@@ -0,0 +1,60 @@
+<!--
+HTML for each accordion group that separates the status types on the results
+report page.
+-->
+
+Test Filters:<br>
+<div class="btn-toolbar" role="toolbar">
+ <div class="btn-group button-margin" data-toggle="buttons">
+ <label class="btn btn-default" ng-click="ctrl.changeStatus('total')"
+ ng-class="{'active': ctrl.testStatus === 'total'}">
+ <input type="radio" ng-model="ctrl.testStatus" value="total" name="total">
+ <span class="text-primary">All</span>
+ </label>
+ <label class="btn btn-default" ng-click="ctrl.changeStatus('passed')"
+ ng-class="{'active': ctrl.testStatus === 'passed'}">
+ <input type="radio" ng-model="ctrl.testStatus" value="passed" name="passed">
+ <span class="text-success">Passed</span>
+ </label>
+ <label class="btn btn-default" ng-click="ctrl.changeStatus('not passed')"
+ ng-class="{'active': ctrl.testStatus === 'not passed'}">
+ <input type="radio" ng-model="ctrl.testStatus" value="not passed" name="not passed">
+ <span class="text-danger">Not Passed</span>
+ </label>
+ </div>
+ <div class="btn-group button-margin" style="float: right;">
+ <button type="button" class="btn btn-default" ng-click="ctrl.openAll()">Expand</button>
+ <button type="button" class="btn btn-default" ng-click="ctrl.folderAll()">Collapse</button>
+ </div>
+</div>
+
+<uib-accordion-group ng-repeat="(type,data) in ctrl.data" is-open="isOpen">
+ <uib-accordion-heading>
+ {{ type }}: {{ ctrl.statistics[type].total }} tests
+ <i class="pull-right glyphicon"
+ ng-class="{'glyphicon-chevron-down': isOpen, 'glyphicon-chevron-right': !isOpen}"></i>
+ </uib-accordion-heading>
+ <ol class="capabilities">
+ <li ng-repeat="(area, value) in data"
+ ng-show="(ctrl.testStatus == 'passed' && value.pass != 0) || (ctrl.testStatus == 'not passed' && value.fail != 0) || ctrl.testStatus == 'total'">
+ <a ng-click="value.folder = !value.folder">
+ {{ area }}
+ <span ng-if="ctrl.testStatus == 'total'"
+ ng-class="{'text-success': value.total == value.pass, 'text-warning': (value.pass < value.total && value.pass > 0), 'text-danger': value.pass == 0}">
+ [{{ value.pass }}/{{ value.total }}]
+ </span>
+ <span ng-if="ctrl.testStatus == 'passed'" class="text-success">[{{ value.pass }}]</span>
+ <span ng-if="ctrl.testStatus == 'not passed'" class="text-danger">[{{ value.fail }}]</span>
+ </a>
+ <a uib-tooltip="view log" ng-click="ctrl.gotoResultLog(area)"><span class="glyphicon glyphicon-cog"></span></a>
+ <ul class="list-unstyled" uib-collapse="value.folder">
+ <li ng-repeat="case in value.cases"
+ ng-if="(ctrl.testStatus=='passed' && ctrl.case_list.indexOf(case) > -1) || (ctrl.testStatus=='not passed' && ctrl.case_list.indexOf(case) == -1) || ctrl.testStatus=='total'">
+ <span ng-class="{'glyphicon glyphicon-ok text-success':ctrl.case_list.indexOf(case) > -1, 'glyphicon glyphicon-remove text-warning':ctrl.case_list.indexOf(case) == -1}"
+ aria-hidden="true"></span>
+ <a ng-click="ctrl.gotoDoc(case)">{{ case }}</a>
+ </li>
+ </ul>
+ </li>
+ </ol>
+</uib-accordion-group>
diff --git a/3rd_party/static/onap-ui/components/results-report/resultsReport.html b/3rd_party/static/onap-ui/components/results-report/resultsReport.html
new file mode 100644
index 0000000..38e602d
--- /dev/null
+++ b/3rd_party/static/onap-ui/components/results-report/resultsReport.html
@@ -0,0 +1,33 @@
+<div class="container-fluid common-main-container">
+ <h3>Test Run Results</h3>
+
+ <div ng-show="ctrl.testId" class="container-fluid">
+ <div class="row">
+ <div class="pull-left">
+ <div class="test-report">
+ <strong>ONAP Version:</strong> {{ctrl.version}}<br>
+ <strong>Test ID:</strong> {{ctrl.testId}}<br>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <strong>Total: {{ctrl.statistics.total}}, Pass: {{ ctrl.statistics.pass}}, Rate: {{ ctrl.statistics.pass / ctrl.statistics.total * 100 | number:2 }}%</strong><br>
+ <strong>Mandatory Total: {{ctrl.statistics.mandatory.total}}, Pass: {{ ctrl.statistics.mandatory.pass }}, Rate: {{ ctrl.statistics.mandatory.pass / ctrl.statistics.mandatory.total * 100 | number:2 }}%</strong><br>
+ <strong>Optional Total: {{ctrl.statistics.optional.total}}, Pass: {{ ctrl.statistics.optional.pass }}, Rate: {{ ctrl.statistics.optional.pass / ctrl.statistics.optional.total * 100 | number:2 }}%</strong><br>
+ <hr>
+ <strong>{{ ctrl.validation }}</strong><br>
+
+ <div>
+ <hr>
+ <h4>Test Result Overview</h4>
+ <uib-accordion close-others=false>
+ <!-- The ng-repeat is used to pass in a local variable to the template. -->
+ <ng-include
+ src="ctrl.detailsTemplate"
+ onload="isOpen = true">
+ </ng-include>
+ <br>
+ </uib-accordion>
+ </div>
+</div>
diff --git a/3rd_party/static/onap-ui/components/results-report/resultsReportController.js b/3rd_party/static/onap-ui/components/results-report/resultsReportController.js
new file mode 100644
index 0000000..09601ad
--- /dev/null
+++ b/3rd_party/static/onap-ui/components/results-report/resultsReportController.js
@@ -0,0 +1,224 @@
+/*
+ * 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.
+ */
+
+(function () {
+ 'use strict';
+
+ angular
+ .module('testapiApp')
+ .controller('ResultsReportController', ResultsReportController);
+
+ ResultsReportController.$inject = [
+ '$scope', '$http', '$stateParams', '$window',
+ 'testapiApiUrl'
+ ];
+
+ /**
+ * TestAPI Results Report Controller
+ * This controller is for the '/results/<test run ID>' page where a user can
+ * view details for a specific test run.
+ */
+ function ResultsReportController($scope, $http, $stateParams, $window,
+ testapiApiUrl) {
+
+ var ctrl = this;
+
+ ctrl.testStatus = 'total';
+ ctrl.case_list = [];
+ ctrl.data = {};
+ ctrl.statistics = {
+ 'total': 0, 'pass': 0, 'fail': 0,
+ 'mandatory': {'total': 0, 'pass': 0, 'fail': 0, 'area': 0},
+ 'optional': {'total': 0, 'pass': 0, 'fail': 0, 'area': 0}
+ };
+
+ ctrl.gotoDoc = gotoDoc;
+ ctrl.openAll = openAll;
+ ctrl.folderAll = folderAll;
+ ctrl.gotoResultLog = gotoResultLog;
+ ctrl.changeStatus = changeStatus;
+
+ /** The testID extracted from the URL route. */
+ ctrl.testId = $stateParams.testID;
+ ctrl.innerId = $stateParams.innerID;
+ ctrl.validation = '';
+ ctrl.vnf_type = '';
+ ctrl.vnf_checksum = '';
+ ctrl.version = '';
+
+ /** The HTML template that all accordian groups will use. */
+ ctrl.detailsTemplate = 'onap-ui/components/results-report/partials/' +
+ 'reportDetails.html';
+
+ $scope.load_finish = false;
+
+ function changeStatus(value) {
+ ctrl.testStatus = value;
+ }
+
+ function extend(case_list) {
+ angular.forEach(case_list, function(ele) {
+ ctrl.case_list.push(ele);
+ });
+ }
+
+ function strip(word) {
+ return word.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
+ }
+
+ function gotoResultLog(case_name) {
+ var case_area = case_name.split(".")[0];
+ var log_url = "/logs/" + ctrl.testId + "/results/";
+ log_url += case_area + "_logs/" + case_name + ".out";
+ var is_reachable = false;
+
+ $.ajax({
+ url: log_url,
+ async: false,
+ success: function (response) {
+ is_reachable = true;
+ },
+ error: function (response) {
+ alert("Log file could not be found. Please confirm this case has been executed successfully.");
+ }
+ });
+
+ if (is_reachable == true) {
+ window.open(log_url);
+ }
+ }
+
+ $scope.$watch('load_finish', function() {
+ if ($scope.load_finish == true) {
+ var case_url = 'onap-ui/components/results-report/data/' + ctrl.version + '/' + ctrl.vnf_type + '-testcases.json'
+ $http.get(case_url).then(function(response) {
+ ctrl.data = response.data;
+
+ angular.forEach(ctrl.data.mandatory, function(value, name) {
+ ctrl.data.mandatory[name].folder = true;
+ ctrl.data.mandatory[name].pass = 0;
+ ctrl.data.mandatory[name].fail = 0;
+ angular.forEach(value.cases, function(sub_case) {
+ ctrl.statistics.total += 1;
+ ctrl.statistics.mandatory.total += 1;
+ if (ctrl.case_list.indexOf(sub_case) > -1) {
+ ctrl.data.mandatory[name].pass += 1;
+ ctrl.statistics.mandatory.pass += 1;
+ ctrl.statistics.pass += 1;
+ } else {
+ ctrl.data.mandatory[name].fail += 1;
+ ctrl.statistics.mandatory.fail += 1;
+ ctrl.statistics.fail += 1;
+ }
+ });
+ });
+
+ angular.forEach(ctrl.data.optional, function(value, name) {
+ ctrl.data.optional[name].folder = true;
+ ctrl.data.optional[name].pass = 0;
+ ctrl.data.optional[name].fail = 0;
+ angular.forEach(value.cases, function(sub_case) {
+ ctrl.statistics.total += 1;
+ ctrl.statistics.optional.total += 1;
+ if (ctrl.case_list.indexOf(sub_case) > -1) {
+ ctrl.data.optional[name].pass += 1;
+ ctrl.statistics.optional.pass += 1;
+ ctrl.statistics.pass += 1;
+ } else {
+ ctrl.data.optional[name].fail += 1;
+ ctrl.statistics.optional.fail += 1;
+ ctrl.statistics.fail += 1;
+ }
+
+ });
+ });
+
+ ctrl.statistics.mandatory.area = Object.keys(ctrl.data.mandatory).length;
+ ctrl.statistics.optional.area = Object.keys(ctrl.data.optional).length;
+ }, function(error) {
+ alert('error to get test case info');
+ });
+ }
+ });
+
+ function generate_format_data() {
+ var test_url = testapiApiUrl + '/onap/tests/' + ctrl.innerId;
+ $http.get(test_url).then(function(test_resp) {
+ ctrl.validation = test_resp.data.validation;
+
+ angular.forEach(test_resp.data.results, function(result, index) {
+ var result_url = testapiApiUrl + '/results/' + result;
+ $http.get(result_url).then(function(result_resp) {
+
+ ctrl.version = result_resp.data.version;
+ ctrl.vnf_type = result_resp.data.vnf_type;
+
+ angular.forEach(result_resp.data.testcases_list, function(testcase, index) {
+ var sub_case_list = get_sub_case_list_2019_04(testcase);
+ extend(sub_case_list);
+ });
+
+ if (index == test_resp.data.results.length - 1) {
+ $scope.load_finish = true;
+ }
+ }, function(result_error) {
+ /* do nothing */
+ });
+ });
+
+ }, function(test_error) {
+ alert('Error when get test record');
+ });
+ }
+
+ function get_sub_case_list_2019_04(result) {
+ var case_list = [];
+ if (result.sub_testcase.length == 0 && result.result == "PASS") {
+ case_list.push(result.name);
+ } else {
+ angular.forEach(result.sub_testcase, function(subtest, index) {
+ if (subtest.result == "PASS") {
+ case_list.push(subtest.name)
+ }
+ });
+ }
+ return case_list;
+ }
+
+ function gotoDoc(sub_case) {
+ /* not implemented */
+ }
+
+ function openAll() {
+ angular.forEach(ctrl.data.mandatory, function(ele, id) {
+ ele.folder = false;
+ });
+ angular.forEach(ctrl.data.optional, function(ele, id) {
+ ele.folder = false;
+ });
+ }
+
+ function folderAll() {
+ angular.forEach(ctrl.data.mandatory, function(ele, id) {
+ ele.folder = true;
+ });
+ angular.forEach(ctrl.data.optional, function(ele, id) {
+ ele.folder = true;
+ });
+ }
+
+ generate_format_data();
+ }
+
+})();