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');
21 'generalValidationResultsSvc',
24 svc.getBlueprintLayers = function(wrobotDbTestResults) {
25 if (!wrobotDbTestResults
26 || wrobotDbTestResults.length === 0) {
32 angular.fromJson(wrobotDbTestResults),
33 function(wrobotDbTestResult) {
34 if (wrobotDbTestResult.layer !== undefined) {
36 .push(wrobotDbTestResult.layer);
41 svc.mapResult = function(validationDbTestResult) {
42 if (validationDbTestResult
43 && validationDbTestResult.dateStorage) {
44 if (validationDbTestResult.result === true) {
51 svc.filterWithLayer = function(validationDbTestResults,
53 if (filterLayer === undefined || filterLayer === '') {
54 return validationDbTestResults;
56 var filteredResults = [];
59 validationDbTestResults,
60 function(validationDbTestResult) {
64 .fromJson(validationDbTestResult.wrobotDbTestResults),
67 if (wrobotDbTestResult.layer
73 .push(validationDbTestResult);
77 return filteredResults;
79 svc.filterWithResult = function(validationDbTestResults,
81 if (filterResult === undefined || filterResult === '') {
82 return validationDbTestResults;
84 var filteredResults = [];
85 angular.forEach(validationDbTestResults, function(
86 validationDbTestResult) {
87 if (validationDbTestResult.result === true
88 && 'success'.includes(filterResult
90 filteredResults.push(validationDbTestResult);
91 } else if (validationDbTestResult.result === false
92 && 'failure'.includes(filterResult
94 filteredResults.push(validationDbTestResult);
97 return filteredResults;
99 svc.filterWithTimestamp = function(validationDbTestResults,
101 if (filterTimestamp === undefined
102 || filterTimestamp === '') {
103 return validationDbTestResults;
105 var filteredResults = [];
106 angular.forEach(validationDbTestResults, function(
107 validationDbTestResult) {
108 if (validationDbTestResult.timestamp
109 && validationDbTestResult.timestamp
110 .toLowerCase().includes(
113 filteredResults.push(validationDbTestResult);
116 return filteredResults;