59c9c9af41b381fa13b00cbcd928e887fe274f35
[sdc/sdc-workflow-designer.git] /
1 /**
2  * Copyright (c) 2017 ZTE Corporation.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * and the Apache License 2.0 which both accompany this distribution,
6  * and are available at http://www.eclipse.org/legal/epl-v10.html
7  * and http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Contributors:
10  *     ZTE - initial API and implementation and/or initial documentation
11  */
12
13 import { Component, EventEmitter, Input, Output } from '@angular/core';
14 import { ModalDirective } from 'ngx-bootstrap/modal';
15
16 import { Swagger } from '../../../../model/swagger';
17 import { RestConfig } from '../../../../model/rest-config';
18 import { RestService } from '../../../../services/rest.service';
19
20 /**
21  * toolbar component contains some basic operations(save) and all of the supported workflow nodes.
22  * The supported nodes can be dragged to container component. which will add a new node to the workflow.
23  */
24 @Component({
25     selector: 'b4t-rest-config-list',
26     templateUrl: 'rest-config-list.component.html',
27 })
28 export class RestConfigListComponent {
29     @Output() configSelected = new EventEmitter<RestConfig>();
30
31     constructor(public restService: RestService) {
32     }
33
34     public onConfigSelected(restConfig: RestConfig) {
35         this.configSelected.emit(restConfig);
36     }
37
38     public addRestConfig() {
39         const restConfig = this.restService.addRestConfig();
40
41         this.onConfigSelected(restConfig);
42     }
43
44     public deleteRestConfig(index: number) {
45         // this.restService.getRestConfigs().splice(index, 1);
46
47         // let restConfig;
48         // if (this.restService.getRestConfigs().length > 0) {
49         //     if (this.restService.getRestConfigs()[index]) {
50         //         restConfig = this.restService.getRestConfigs()[index];
51         //     } else {
52         //         restConfig = this.restService.getRestConfigs()[index - 1];
53         //     }
54         // }
55         // this.onConfigSelected(restConfig);
56     }
57 }