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
 
  10  *     ZTE - initial API and implementation and/or initial documentation
 
  13 import { Component, EventEmitter, Input, Output } from '@angular/core';
 
  14 import { ModalDirective } from 'ngx-bootstrap/modal';
 
  16 import { Swagger } from '../../../../model/swagger';
 
  17 import { RestConfig } from '../../../../model/rest-config';
 
  18 import { RestService } from '../../../../services/rest.service';
 
  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.
 
  25     selector: 'b4t-rest-config-list',
 
  26     templateUrl: 'rest-config-list.component.html',
 
  28 export class RestConfigListComponent {
 
  29     @Output() configSelected = new EventEmitter<RestConfig>();
 
  31     constructor(public restService: RestService) {
 
  34     public onConfigSelected(restConfig: RestConfig) {
 
  35         this.configSelected.emit(restConfig);
 
  38     public addRestConfig() {
 
  40         const restConfig = this.restService.newRestConfig();
 
  41         this.restService.addRestConfig(restConfig);
 
  43         this.onConfigSelected(restConfig);
 
  46     public deleteRestConfig(index: number) {
 
  47         // this.restService.getRestConfigs().splice(index, 1);
 
  50         // if (this.restService.getRestConfigs().length > 0) {
 
  51         //     if (this.restService.getRestConfigs()[index]) {
 
  52         //         restConfig = this.restService.getRestConfigs()[index];
 
  54         //         restConfig = this.restService.getRestConfigs()[index - 1];
 
  57         // this.onConfigSelected(restConfig);