1 /* Copyright (c) 2019 AT&T Intellectual Property. #
\r
3 # Licensed under the Apache License, Version 2.0 (the "License"); #
\r
4 # you may not use this file except in compliance with the License. #
\r
5 # You may obtain a copy of the License at #
\r
7 # http://www.apache.org/licenses/LICENSE-2.0 #
\r
9 # Unless required by applicable law or agreed to in writing, software #
\r
10 # distributed under the License is distributed on an "AS IS" BASIS, #
\r
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
\r
12 # See the License for the specific language governing permissions and #
\r
13 # limitations under the License. #
\r
14 ##############################################################################*/
\r
17 import { Component, OnInit, OnDestroy } from '@angular/core';
\r
18 import { ActivatedRoute } from '@angular/router';
\r
19 import { Subscription } from 'rxjs';
\r
20 import { TestDefinitionService } from 'app/shared/services/test-definition.service';
\r
21 import { TestDefinition } from 'app/shared/models/test-definition.model';
\r
22 import { StatsService } from 'app/layout/components/stats/stats.service';
\r
25 selector: 'app-test-definition-details',
\r
26 templateUrl: './test-definition-details.component.pug',
\r
27 styleUrls: ['./test-definition-details.component.scss']
\r
29 export class TestDefinitionDetailsComponent implements OnInit, OnDestroy {
\r
31 private toDestroy: Array<Subscription> = [];
\r
33 public testDefinition: TestDefinition;
\r
36 private route: ActivatedRoute,
\r
37 private _testDefinition: TestDefinitionService,
\r
38 public stats: StatsService
\r
42 this.toDestroy.push(this.route.params.subscribe(params => {
\r
45 this._testDefinition.get(params.id).subscribe(
\r
48 this.testDefinition = res as TestDefinition;
\r
54 this.getData(params.id);
\r
59 get numOfVersions(){
\r
60 if(this.testDefinition['bpmnInstances']){
\r
61 return this.testDefinition['bpmnInstances'].length;
\r
67 this.toDestroy.forEach(elem => elem.unsubscribe());
\r
70 getData(testDefinitionId?){
\r
71 if(!testDefinitionId){
\r
72 testDefinitionId = this.testDefinition._id
\r
75 if(!testDefinitionId){
\r
79 this.stats.getDefaultData(1, {
\r
80 'historicTestDefinition._id': testDefinitionId,
\r
84 "historicTestDefinition._id",
\r
85 "historicTestDefinition.testName",
\r
86 "historicTestInstance._id",
\r
87 "historicTestInstance.testInstanceName",
\r
88 "testHeadResults.startTime",
\r
89 "testHeadResults.endTime",
\r
90 "testHeadResults.testHeadName",
\r
91 "testHeadResults.testHeadId",
\r
92 "testHeadResults.testHeadGroupId",
\r
93 "testHeadResults.statusCode",
\r
101 $gte: this.stats.filters.startDate,
\r
102 $lte: this.stats.filters.endDate
\r