diff options
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/components/menu')
2 files changed, 14 insertions, 8 deletions
diff --git a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.ts b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.ts index 90b582c9..3e472175 100644 --- a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.ts @@ -15,6 +15,7 @@ import { ModalDirective } from 'ngx-bootstrap/modal'; import { Microservice } from '../../../../model/workflow/microservice'; import { WorkflowConfigService } from '../../../../services/workflow-config.service'; +import { Swagger } from "../../../../model/swagger"; /** * toolbar component contains some basic operations(save) and all of the supported workflow nodes. @@ -35,7 +36,7 @@ export class MicroserviceDetailComponent implements OnChanges { public ngOnChanges() { if(this.microservice == null) { - this.microservice = new Microservice('', '', {}, ''); + this.microservice = new Microservice('', '', null, ''); } this.dynamic = this.microservice.definition !== ''; this.parseSwagger2String(); @@ -51,10 +52,15 @@ export class MicroserviceDetailComponent implements OnChanges { public onDetailChanged(detail: string) { try { - const swagger = JSON.parse(detail); - this.detail = detail; - console.log(swagger); - this.microservice.swagger = swagger; + if(detail) { + const swagger = new Swagger(JSON.parse(detail)); + this.detail = detail; + console.log(swagger); + this.microservice.swagger = swagger; + } else { + this.detail = ''; + this.microservice.swagger = null; + } } catch (e) { // if detail is not a json object, then not change the swagger } @@ -62,7 +68,7 @@ export class MicroserviceDetailComponent implements OnChanges { public toggleDynamic(dynamic: boolean) { this.dynamic = dynamic; - this.onDetailChanged('{}'); + this.onDetailChanged(null); if(!dynamic) { this.microservice.definition = null; @@ -73,7 +79,7 @@ export class MicroserviceDetailComponent implements OnChanges { this.configService.loadDynamicInfo(this.microservice.definition) .subscribe(response => { try { - this.microservice.swagger = response; + this.microservice.swagger = new Swagger(response); this.parseSwagger2String(); } catch (e) { console.log('detail transfer error'); diff --git a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-list/microservice-list.component.ts b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-list/microservice-list.component.ts index 6dcfe8c6..6e31b2e4 100644 --- a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-list/microservice-list.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-list/microservice-list.component.ts @@ -32,7 +32,7 @@ export class MicroserviceListComponent { } public addMicroservice() { - const microservice = new Microservice('new microservice', '', {}, ''); + const microservice = new Microservice('new microservice', '', null, ''); this.microservices.push(microservice); this.onMicroserviceSelected(microservice); |