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, Input, OnChanges, ViewChild } from '@angular/core';
14 import { ModalDirective } from 'ngx-bootstrap/modal';
16 import { Microservice } from '../../../../model/workflow/microservice';
17 import { WorkflowConfigService } from '../../../../services/workflow-config.service';
20 * toolbar component contains some basic operations(save) and all of the supported workflow nodes.
21 * The supported nodes can be dragged to container component. which will add a new node to the workflow.
24 selector: 'b4t-microservice-detail',
25 templateUrl: 'microservice-detail.component.html',
27 export class MicroserviceDetailComponent implements OnChanges {
28 @Input() microservice: Microservice;
30 public detail: string;
35 public ngOnChanges() {
36 if(this.microservice == null) {
37 this.microservice = new Microservice('', '', {});
39 this.parseSwagger2String();
42 private parseSwagger2String() {
43 if (this.microservice.swagger) {
44 this.detail = JSON.stringify(this.microservice.swagger);
50 public onDetailChanged(detail: string) {
52 const swagger = JSON.parse(detail);
55 this.microservice.swagger = swagger;
57 // if detail is not a json object, then not change the swagger