aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-ui/src/app/components/menu
diff options
context:
space:
mode:
authorLvbo163 <lv.bo163@zte.com.cn>2017-09-04 09:32:08 +0800
committerLvbo163 <lv.bo163@zte.com.cn>2017-09-04 15:16:37 +0800
commit76f9fa54825d98013182524d16290f04e3c9398a (patch)
tree99d46a4107b0c037a398ec34aac7561690be0ba0 /sdc-workflow-designer-ui/src/app/components/menu
parentc0d3e994ef109b4b0e089187f1db397ff3306613 (diff)
support swagger for microservice definition
microservice definition follow swagger specification. Issue-ID: SDC-271 Change-Id: I300732cbdc56791981b1aa626522c0f6b0b2a4c7 Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/components/menu')
-rw-r--r--sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.ts20
-rw-r--r--sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-list/microservice-list.component.ts2
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);