added svcapi ui and camunda code
[it/otf.git] / otf-frontend / client / src / app / layout / onboarding / test-head / test-head.component.ts
1 /*  Copyright (c) 2019 AT&T Intellectual Property.                             #\r
2 #                                                                              #\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
6 #                                                                              #\r
7 #       http://www.apache.org/licenses/LICENSE-2.0                             #\r
8 #                                                                              #\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
15 \r
16 \r
17 import { Component, OnInit, ViewContainerRef, Output, Input } from '@angular/core';\r
18 import { HttpClient } from '@angular/common/http';\r
19 import { routerLeftTransition } from '../../../router.animations';\r
20 import { Router } from '@angular/router';\r
21 import { ListService } from '../../../shared/services/list.service';\r
22 import { TestHeadModalComponent } from '../../../shared/modules/test-head-modal/test-head-modal.component';\r
23 import { MatDialog } from '@angular/material';\r
24 import { TestHeadService } from '../../../shared/services/test-head.service';\r
25 \r
26 @Component({\r
27   selector: 'app-test-head',\r
28   templateUrl: './test-head.component.pug',\r
29   styleUrls: ['./test-head.component.scss', '../onboarding.component.scss'],\r
30   animations: [routerLeftTransition()]\r
31 })\r
32 export class TestHeadComponent implements OnInit {\r
33 \r
34   public vth_list;\r
35   public search;\r
36 \r
37   @Output() public createFormOptions = {\r
38     goal: 'create'  \r
39   }\r
40 \r
41   constructor(\r
42     private router: Router, \r
43     private list: ListService,\r
44     public dialog: MatDialog,\r
45     private testHead: TestHeadService\r
46   ) {\r
47     \r
48    }\r
49 \r
50   next() {\r
51     this.router.navigateByUrl('/onboarding/test-definition');\r
52   }\r
53 \r
54   back() {\r
55     this.router.navigateByUrl('/onboarding');\r
56   }\r
57 \r
58   openTestHead(testHead): void {\r
59     const dialogRef = this.dialog.open(TestHeadModalComponent, {\r
60       width: '450px',\r
61       data: {\r
62         goal: 'edit',\r
63         testHead: testHead\r
64       }\r
65     });\r
66 \r
67     dialogRef.afterClosed().subscribe(result => {\r
68       \r
69     });\r
70   }\r
71 \r
72   ngOnInit() {\r
73 \r
74     this.search = {};\r
75     this.search._id = "";\r
76     this.search.testHeadName = "";\r
77 \r
78     this.list.createList('vth');\r
79     \r
80     this.testHead.find({$limit: -1})\r
81       .subscribe((vth_list) => {\r
82         this.list.changeMessage('vth', vth_list);\r
83       });\r
84 \r
85     this.list.listMap['vth'].currentList.subscribe((list) =>{\r
86       this.vth_list = list;\r
87     });\r
88 \r
89   }\r
90 \r
91 }\r