added svcapi ui and camunda code
[it/otf.git] / otf-frontend / client / src / app / layout / onboarding / create-test / create-test.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, Output } from '@angular/core';\r
18 import { routerLeftTransition } from '../../../router.animations';\r
19 import { ListService } from '../../../shared/services/list.service';\r
20 import { HttpClient } from '@angular/common/http';\r
21 import { AppGlobals } from '../../../app.global';\r
22 import { Router,  NavigationExtras } from '@angular/router';\r
23 import { TestDefinitionService } from '../../../shared/services/test-definition.service';\r
24 \r
25 \r
26 @Component({\r
27   selector: 'app-create-test',\r
28   templateUrl: './create-test.component.pug',\r
29   styleUrls: ['./create-test.component.scss', '../onboarding.component.scss'],\r
30   providers: [AppGlobals],\r
31   animations: [routerLeftTransition()]\r
32 })\r
33 export class CreateTestComponent implements OnInit {\r
34 \r
35   public test_list = [];\r
36   public search;\r
37 \r
38   @Output() public listKey;\r
39 \r
40   constructor(private router: Router, private testDefinition: TestDefinitionService, private list: ListService, private http: HttpClient, private _global: AppGlobals) {\r
41 \r
42   }\r
43 \r
44   back() {\r
45     this.router.navigateByUrl('/onboarding/test-head');\r
46   }\r
47 \r
48   next() {\r
49     let navigationExtras: NavigationExtras = {\r
50       queryParams: {\r
51           "testDefinition": JSON.stringify(this.test_list[this.test_list.length - 1])\r
52       }\r
53     };\r
54     this.router.navigate(['/onboarding/test-instances'], navigationExtras);\r
55   }\r
56 \r
57   ngOnInit() {\r
58 \r
59     this.search = {};\r
60     this.search.testName = "";\r
61 \r
62     this.listKey = 'td';\r
63 \r
64     //Create List with list service\r
65     this.list.createList(this.listKey);\r
66 \r
67     //Subscribe to list service\r
68     this.list.listMap[this.listKey].currentList.subscribe((list) =>{\r
69       this.test_list = list;\r
70     });\r
71   }\r
72 \r
73 }\r