aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-ui/src/app/services/rest.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/services/rest.service.ts')
-rw-r--r--sdc-workflow-designer-ui/src/app/services/rest.service.ts46
1 files changed, 31 insertions, 15 deletions
diff --git a/sdc-workflow-designer-ui/src/app/services/rest.service.ts b/sdc-workflow-designer-ui/src/app/services/rest.service.ts
index 52bddfe3..1db51471 100644
--- a/sdc-workflow-designer-ui/src/app/services/rest.service.ts
+++ b/sdc-workflow-designer-ui/src/app/services/rest.service.ts
@@ -27,32 +27,48 @@ import { NoticeService } from './notice.service';
export class RestService {
private restConfigs: RestConfig[] = [];
- private runtimeURL = '/openoapi/catalog/v1/sys/config';
- private msbPublishServiceURL = '/api/msdiscover/v1/publishservicelist';
+ // private runtimeURL = '/openoapi/catalog/v1/sys/config';
+ private runtimeURL = '/api/tenant';
+ // private msbPublishServiceURL = '/api/msdiscover/v1/publishservicelist';
+ private msbPublishServiceURL = '/api/mockarray';
constructor(private broadcastService: BroadcastService, private http: Http, private noticeService: NoticeService) {
this.broadcastService.planModel$.subscribe(planModel => {
planModel.configs.restConfigs.forEach(element => {
- this.restConfigs.push(element);
+ this.addRestConfig(element);
});
});
- // this.initSwaggerInfoByMSB();
+ this.initSwaggerInfoByMSB();
}
- public addRestConfig(): RestConfig {
- let index = 0;
- this.restConfigs.forEach(config => {
- const currentId = parseInt(config.id);
- if (currentId > index) {
- index = currentId;
- }
+ public addRestConfig(config: RestConfig) {
+ const idSet = new Set<string>();
+ this.restConfigs.forEach(rc => {
+ idSet.add(rc.id);
});
- index += 1;
+ if(idSet.has(config.id)) {
+ return false;
+ } else {
+ this.restConfigs.push(config);
+ return true;
+ }
+ }
- const restConfig = new RestConfig(index.toString(), 'new Config', '', '', '');
- this.restConfigs.push(restConfig);
+ public newRestConfig(): RestConfig {
+ const idSet = new Set<string>();
+ this.restConfigs.forEach(rc => {
+ idSet.add(rc.id);
+ });
+ let index = 0;
+ for(; index <= idSet.size; index++) {
+ if(!idSet.has(index + '')) {
+ break;
+ }
+ }
+
+ const restConfig = new RestConfig(index.toString(), 'new Config', '', '', '');
return restConfig;
}
@@ -125,7 +141,7 @@ export class RestService {
// this service don't have sawgger file.
if ('/activiti-rest' !== serviceInfo.publish_url) {
const id = serviceInfo.serviceName + '.' + serviceInfo.version;
- restConfigs.push(new RestConfig(id, serviceInfo.serviceName, serviceInfo.version, serviceInfo.publish_url, ''));
+ this.addRestConfig(new RestConfig(id, serviceInfo.serviceName, serviceInfo.version, serviceInfo.publish_url, ''));
let swaggerUrl = '';
if (undefined !== serviceInfo.swagger_url && '' !== serviceInfo.swagger_url) {
swaggerUrl = serviceInfo.publish_url + '/' + serviceInfo.swagger_url;