summaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-ui
diff options
context:
space:
mode:
Diffstat (limited to 'sdc-workflow-designer-ui')
-rw-r--r--sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.html2
-rw-r--r--sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.ts29
-rw-r--r--sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-list/microservice-list.component.ts25
-rw-r--r--sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice.component.ts8
4 files changed, 46 insertions, 18 deletions
diff --git a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.html b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.html
index 3a0942e1..d13895dd 100644
--- a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.html
+++ b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.html
@@ -33,7 +33,7 @@
<div *ngIf="dynamic" class="form-group row">
<label class="col-md-2 form-control-label text-md-right">Definition</label>
<div class="col-md-8" style="padding-right:0px">
- <input class="form-control" [(ngModel)]="microservice.definition">
+ <input class="form-control" [(ngModel)]="microservice.url">
</div>
<div class="col-md-2" style="padding-left:0px">
<button class="btn" (click)="loadDynamicInfo()">load</button>
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 ec727293..bffaef42 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
@@ -16,6 +16,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";
+import { RestConfig } from '../../../../model/rest-config';
/**
* toolbar component contains some basic operations(save) and all of the supported workflow nodes.
@@ -26,7 +27,7 @@ import { Swagger } from "../../../../model/swagger";
templateUrl: 'microservice-detail.component.html',
})
export class MicroserviceDetailComponent implements OnChanges {
- @Input() microservice: Microservice;
+ @Input() microservice: RestConfig;
public detail: string;
public dynamic = false;
@@ -36,15 +37,23 @@ export class MicroserviceDetailComponent implements OnChanges {
public ngOnChanges() {
if(this.microservice == null) {
- this.microservice = new Microservice('', '', null, '');
+ this.microservice = new RestConfig('', '', null, '');
}
- this.dynamic = this.microservice.definition !== '';
+ this.checkDynamic();
this.parseSwagger2String();
}
+ private checkDynamic() {
+ if(this.microservice.url) {
+ this.dynamic = true;
+ } else {
+ this.dynamic = false;
+ }
+ }
+
private parseSwagger2String() {
- if (this.microservice.swaggerJson) {
- this.detail = JSON.stringify(this.microservice.swaggerJson);
+ if (this.microservice.swagger) {
+ this.detail = JSON.stringify(this.microservice.swagger);
} else {
this.detail = '';
}
@@ -56,10 +65,10 @@ export class MicroserviceDetailComponent implements OnChanges {
const swagger = new Swagger(JSON.parse(detail));
this.detail = detail;
console.log(swagger);
- this.microservice.swaggerJson = detail;
+ this.microservice.swagger = swagger;
} else {
this.detail = '';
- this.microservice.swaggerJson = null;
+ this.microservice.swagger = null;
}
} catch (e) {
// if detail is not a json object, then not change the swagger
@@ -71,16 +80,16 @@ export class MicroserviceDetailComponent implements OnChanges {
this.onDetailChanged(null);
if(!dynamic) {
- this.microservice.definition = null;
+ this.microservice.url = null;
}
}
private loadDynamicInfo() {
- this.configService.loadDynamicInfo(this.microservice.definition)
+ this.configService.loadDynamicInfo(this.microservice.url)
.subscribe(response => {
try {
- this.microservice.swaggerJson = response;
+ this.microservice.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 6e31b2e4..b44d423f 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
@@ -14,6 +14,7 @@ import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core
import { ModalDirective } from 'ngx-bootstrap/modal';
import { Microservice } from '../../../../model/workflow/microservice';
+import { RestConfig } from '../../../../model/rest-config';
/**
* toolbar component contains some basic operations(save) and all of the supported workflow nodes.
@@ -24,15 +25,15 @@ import { Microservice } from '../../../../model/workflow/microservice';
templateUrl: 'microservice-list.component.html',
})
export class MicroserviceListComponent {
- @Input() microservices: Microservice[];
- @Output() microserviceSelected = new EventEmitter<Microservice>();
+ @Input() microservices: RestConfig[];
+ @Output() microserviceSelected = new EventEmitter<RestConfig>();
- public onMicroserviceSelected(microservice: Microservice) {
+ public onMicroserviceSelected(microservice: RestConfig) {
this.microserviceSelected.emit(microservice);
}
public addMicroservice() {
- const microservice = new Microservice('new microservice', '', null, '');
+ const microservice = new RestConfig(this.getConfigId(), 'new microservice', '', null);
this.microservices.push(microservice);
this.onMicroserviceSelected(microservice);
@@ -61,4 +62,20 @@ export class MicroserviceListComponent {
return undefined;
}
+
+ private getConfigId(): string {
+ const idSet = new Set<string>();
+ this.microservices.forEach(config => {
+ idSet.add(config.id);
+ });
+
+ for(let index = 0; index < idSet.size; index++) {
+ const id = `config${index}`;
+ if(!idSet.has(id)) {
+ return id;
+ }
+ }
+
+ return `config0`;
+ }
}
diff --git a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice.component.ts b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice.component.ts
index 4591eef4..eeedac47 100644
--- a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice.component.ts
+++ b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice.component.ts
@@ -16,6 +16,8 @@ import { ModalDirective } from 'ngx-bootstrap/modal';
import { MicroserviceListComponent } from './microservice-list/microservice-list.component';
import { Microservice } from "../../../model/workflow/microservice";
import { WorkflowConfigService } from "../../../services/workflow-config.service";
+import { RestService } from '../../../services/rest.service';
+import { RestConfig } from '../../../model/rest-config';
/**
* microservice component
@@ -28,10 +30,10 @@ import { WorkflowConfigService } from "../../../services/workflow-config.service
export class MicroserviceComponent {
@ViewChild('microserviceModal') public microserviceModal: ModalDirective;
- public microservices: Microservice[];
+ public microservices: RestConfig[];
public currentMicroservice: Microservice;
- constructor(private workflowConfigService: WorkflowConfigService) {
+ constructor(private restService: RestService) {
}
public microserviceSelected(microservice: any) {
@@ -39,7 +41,7 @@ export class MicroserviceComponent {
}
public show() {
- this.microservices = this.workflowConfigService.getMicroservices();
+ this.microservices = this.restService.getRestConfigs();
this.microserviceModal.show();
}