support swagger for microservice definition
[sdc/sdc-workflow-designer.git] / sdc-workflow-designer-ui / src / app / services / workflow-config.service.ts
1 /**\r
2  * Copyright (c) 2017 ZTE Corporation.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the terms of the Eclipse Public License v1.0\r
5  * and the Apache License 2.0 which both accompany this distribution,\r
6  * and are available at http://www.eclipse.org/legal/epl-v10.html\r
7  * and http://www.apache.org/licenses/LICENSE-2.0\r
8  *\r
9  * Contributors:\r
10  *     ZTE - initial API and implementation and/or initial documentation\r
11  */\r
12 \r
13 import { Injectable } from '@angular/core';\r
14 import { WorkflowService } from "./workflow.service";\r
15 import { Microservice } from "../model/workflow/microservice";\r
16 import { Observable } from "rxjs/Rx";\r
17 import { HttpService } from "../util/http.service";\r
18 \r
19 /**\r
20  * WorkflowConfigService\r
21  * provides all of the operations about workflow configs.\r
22  */\r
23 @Injectable()\r
24 export class WorkflowConfigService {\r
25     constructor(private httpService: HttpService, private workflowService: WorkflowService) {}\r
26 \r
27     public getMicroservices(): Microservice[] {\r
28         return this.workflowService.workflow.configs.microservices;\r
29     }\r
30 \r
31     public loadDynamicInfo(url: string): Observable<any> {\r
32         const options: any = {\r
33             headers: {\r
34                 Accept: 'application/json',\r
35             },\r
36         };\r
37         return this.httpService.get(url).map(response => response.data);\r
38     }\r
39 }\r