support setting microservice info 73/9873/1
authorLvbo163 <lv.bo163@zte.com.cn>
Fri, 1 Sep 2017 06:31:04 +0000 (14:31 +0800)
committerLvbo163 <lv.bo163@zte.com.cn>
Fri, 1 Sep 2017 06:31:04 +0000 (14:31 +0800)
support setting microservice info for workflow

Issue-ID: SDC-266

Change-Id: I8c6ad2a95f63a86db0789f9c400be38131404b66
Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
24 files changed:
sdc-workflow-designer-ui/.angular-cli.json
sdc-workflow-designer-ui/package-lock.json
sdc-workflow-designer-ui/package.json
sdc-workflow-designer-ui/src/app/app.module.ts
sdc-workflow-designer-ui/src/app/components/menu/menu.component.css [moved from sdc-workflow-designer-ui/src/app/components/menus/menu.component.css with 100% similarity]
sdc-workflow-designer-ui/src/app/components/menu/menu.component.html [new file with mode: 0644]
sdc-workflow-designer-ui/src/app/components/menu/menu.component.spec.ts [moved from sdc-workflow-designer-ui/src/app/components/menus/menu.component.spec.ts with 55% similarity]
sdc-workflow-designer-ui/src/app/components/menu/menu.component.ts [moved from sdc-workflow-designer-ui/src/app/components/menus/menu.component.ts with 55% similarity]
sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.html [new file with mode: 0644]
sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-detail/microservice-detail.component.ts [new file with mode: 0644]
sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-list/microservice-list.component.css [moved from sdc-workflow-designer-ui/src/app/components/menus/menu.component.html with 65% similarity]
sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-list/microservice-list.component.html [new file with mode: 0644]
sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-list/microservice-list.component.ts [new file with mode: 0644]
sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice.component.html [new file with mode: 0644]
sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice.component.ts [new file with mode: 0644]
sdc-workflow-designer-ui/src/app/model/workflow/configs.ts [new file with mode: 0644]
sdc-workflow-designer-ui/src/app/model/workflow/microservice.ts [new file with mode: 0644]
sdc-workflow-designer-ui/src/app/model/workflow/workflow.ts
sdc-workflow-designer-ui/src/app/services/data-access/in-memory-data.service.ts
sdc-workflow-designer-ui/src/app/services/data-access/sdc.service.ts
sdc-workflow-designer-ui/src/app/services/jsplumb.service.ts
sdc-workflow-designer-ui/src/app/services/workflow-config.service.ts [new file with mode: 0644]
sdc-workflow-designer-ui/src/app/shared/shared.module.ts
sdc-workflow-designer-ui/src/index.html

index 7154dc1..fb634b7 100644 (file)
             "testTsconfig": "tsconfig.spec.json",
             "prefix": "app",
             "styles": [
-                "./../node_modules/bootstrap/dist/css/bootstrap.min.css",
-                "./../node_modules/font-awesome/css/font-awesome.min.css",
+                "../node_modules/bootstrap/dist/css/bootstrap.min.css",
+                "../node_modules/font-awesome/css/font-awesome.min.css",
+                "../node_modules/primeng/resources/primeng.min.css",
+                "../node_modules/primeng/resources/themes/bootstrap/theme.css",
                 "styles.css"
             ],
             "scripts": [],
index e667b96..56922e3 100644 (file)
       "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=",
       "dev": true
     },
+    "ngx-bootstrap": {
+      "version": "1.9.1",
+      "resolved": "http://10.75.8.148/repository/npm-pub/ngx-bootstrap/-/ngx-bootstrap-1.9.1.tgz",
+      "integrity": "sha1-Ce0G2Qj187sj+CGg+0UumhfXZls="
+    },
     "no-case": {
       "version": "2.3.1",
       "resolved": "http://registry.npm.taobao.org/no-case/download/no-case-2.3.1.tgz",
         "utila": "0.4.0"
       }
     },
+    "primeng": {
+      "version": "4.2.0-rc.1",
+      "resolved": "http://10.75.8.148/repository/npm-pub/primeng/-/primeng-4.2.0-rc.1.tgz",
+      "integrity": "sha1-Vzo8fvKbx6v3ywconsOa6xpTE28="
+    },
     "process": {
       "version": "0.11.10",
       "resolved": "http://registry.npm.taobao.org/process/download/process-0.11.10.tgz",
index c9760fc..2b8cf2b 100644 (file)
@@ -26,6 +26,8 @@
     "core-js": "^2.4.1",
     "font-awesome": "^4.7.0",
     "jsplumb": "2.5.0",
+    "ngx-bootstrap": "^1.9.1",
+    "primeng": "^4.2.0-rc.1",
     "rxjs": "^5.4.2",
     "zone.js": "^0.8.14"
   },
index 297cbce..19b7b05 100644 (file)
@@ -30,13 +30,21 @@ import { PropertiesComponent } from "./components/property/properties.component"
 import { CanvasComponent } from "./components/canvas/canvas.component";
 import { StartEventParametersComponent } from "./components/property/start-event-parameters/start-event-parameters.component";
 import { ParameterComponent } from "./components/parameter/parameter.component";
-import { MenuComponent } from "./components/menus/menu.component";
+import { MenuComponent } from "./components/menu/menu.component";
+import { MicroserviceDetailComponent } from "./components/menu/microservice/microservice-detail/microservice-detail.component";
+import { MicroserviceComponent } from "./components/menu/microservice/microservice.component";
+import { MicroserviceListComponent } from "./components/menu/microservice/microservice-list/microservice-list.component";
+import { ModalModule } from "ngx-bootstrap/modal";
+import { WorkflowConfigService } from "./services/workflow-config.service";
 
 @NgModule({
     declarations: [
         AppComponent,
         CanvasComponent,
         MenuComponent,
+        MicroserviceComponent,
+        MicroserviceDetailComponent,
+        MicroserviceListComponent,
         NodeComponent,
         ParameterComponent,
         PropertiesComponent,
@@ -47,6 +55,7 @@ import { MenuComponent } from "./components/menus/menu.component";
         BrowserModule,
         HttpModule,
         InMemoryWebApiModule.forRoot(InMemoryDataService),
+        ModalModule.forRoot(),
         RouterModule.forRoot([]),
         SharedModule,
     ],
@@ -55,6 +64,7 @@ import { MenuComponent } from "./components/menus/menu.component";
         DataAccessService,
         HttpService,
         JsPlumbService,
+        WorkflowConfigService,
         WorkflowService
     ],
     bootstrap: [AppComponent]
diff --git a/sdc-workflow-designer-ui/src/app/components/menu/menu.component.html b/sdc-workflow-designer-ui/src/app/components/menu/menu.component.html
new file mode 100644 (file)
index 0000000..1623489
--- /dev/null
@@ -0,0 +1,24 @@
+<!--
+/**
+ * Copyright (c) 2017 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ *     ZTE - initial API and implementation and/or initial documentation
+ */
+-->
+
+<div class="btn-right">
+    <button type="button" class="btn white" (click)="save()">
+        <i class="fa fa-save"></i>Save
+    </button>
+    <button type="button" class="btn white" (click)="showMicroserviceModal()">
+        <i class="fa fa-cog"></i>Setting
+    </button>
+    <!-- <button type="button" class="btn white" (click)="test()">test</button> -->
+</div>
+<b4t-microservice></b4t-microservice>
@@ -14,23 +14,23 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { MenuComponent } from './menu.component';
 
 describe('MenuComponent', () => {
-  let component: MenuComponent;
-  let fixture: ComponentFixture<MenuComponent>;
+    let component: MenuComponent;
+    let fixture: ComponentFixture<MenuComponent>;
 
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [ MenuComponent ]
-    })
-    .compileComponents();
-  }));
+    beforeEach(async(() => {
+        TestBed.configureTestingModule({
+            declarations: [MenuComponent]
+        })
+            .compileComponents();
+    }));
 
-  beforeEach(() => {
-    fixture = TestBed.createComponent(MenuComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
+    beforeEach(() => {
+        fixture = TestBed.createComponent(MenuComponent);
+        component = fixture.componentInstance;
+        fixture.detectChanges();
+    });
 
-  it('should be created', () => {
-    expect(component).toBeTruthy();
-  });
+    it('should be created', () => {
+        expect(component).toBeTruthy();
+    });
 });
 import { Component, OnInit, ViewChild } from '@angular/core';
 
 import { WorkflowService } from '../../services/workflow.service';
+import { MicroserviceComponent } from "./microservice/microservice.component";
 
 @Component({
-  selector: 'b4t-menu',
-  templateUrl: './menu.component.html',
-  styleUrls: ['./menu.component.css']
+    selector: 'b4t-menu',
+    templateUrl: './menu.component.html',
+    styleUrls: ['./menu.component.css']
 })
 export class MenuComponent {
+    @ViewChild(MicroserviceComponent) public microserviceComponent: MicroserviceComponent;
 
-  public canSave = true;
+    constructor(private workflowService: WorkflowService) { }
 
-  constructor(private workflowService: WorkflowService) { }
+    public save(): void {
+        this.workflowService.save();
+    }
 
-  public save(): void {
-    this.workflowService.save();
-  }
+    public showMicroserviceModal(): void {
+        this.microserviceComponent.show();
+    }
 
-  public test() {
-  }
+    public test() {
+    }
 }
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
new file mode 100644 (file)
index 0000000..12228f2
--- /dev/null
@@ -0,0 +1,33 @@
+<!--
+/**
+ * Copyright (c) 2017 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ *     ZTE - initial API and implementation and/or initial documentation
+ */
+-->
+<div class="form-group row">
+    <label class="col-md-2 form-control-label text-md-right">Name</label>
+    <div class="col-md-10">
+        <input class="form-control" [(ngModel)]="microservice.name">
+    </div>
+</div>
+<div class="form-group row">
+    <label class="col-md-2 form-control-label text-md-right">version</label>
+    <div class="col-md-10">
+        <input class="form-control" [(ngModel)]="microservice.version">
+    </div>
+</div>
+
+<div class="form-group row">
+    <label class="col-md-2 form-control-label text-md-right">Detail</label>
+    <div class="col-md-10">
+        <textarea class="form-control" rows="8" [ngModel]="detail"
+                  (ngModelChange)="onDetailChanged($event)"></textarea>
+    </div>
+</div>
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
new file mode 100644 (file)
index 0000000..924b40f
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2017 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ *     ZTE - initial API and implementation and/or initial documentation
+ */
+
+import { Component, Input, OnChanges, ViewChild } from '@angular/core';
+import { ModalDirective } from 'ngx-bootstrap/modal';
+
+import { Microservice } from '../../../../model/workflow/microservice';
+import { WorkflowConfigService } from '../../../../services/workflow-config.service';
+
+/**
+ * toolbar component contains some basic operations(save) and all of the supported workflow nodes.
+ * The supported nodes can be dragged to container component. which will add a new node to the workflow.
+ */
+@Component({
+    selector: 'b4t-microservice-detail',
+    templateUrl: 'microservice-detail.component.html',
+})
+export class MicroserviceDetailComponent implements OnChanges {
+    @Input() microservice: Microservice;
+
+    public detail: string;
+
+    constructor() {
+    }
+
+    public ngOnChanges() {
+        if(this.microservice == null) {
+            this.microservice = new Microservice('', '', {});
+        }
+        this.parseSwagger2String();
+    }
+
+    private parseSwagger2String() {
+        if (this.microservice.swagger) {
+            this.detail = JSON.stringify(this.microservice.swagger);
+        } else {
+            this.detail = '';
+        }
+    }
+
+    public onDetailChanged(detail: string) {
+        try {
+            const swagger = JSON.parse(detail);
+            this.detail = detail;
+            console.log(swagger);
+            this.microservice.swagger = swagger;
+        } catch (e) {
+            // if detail is not a json object, then not change the swagger
+        }
+    }
+}
@@ -1,4 +1,3 @@
-<!--
 /**
  * Copyright (c) 2017 ZTE Corporation.
  * All rights reserved. This program and the accompanying materials
@@ -10,11 +9,7 @@
  * Contributors:
  *     ZTE - initial API and implementation and/or initial documentation
  */
--->
 
-<div class="btn-right">
-  <button type="button" class="btn white" (click)="save()" [disabled]="!canSave">
-    <i class="fa fa-save"></i>Save
-  </button>
-  <!-- <button type="button" class="btn white" (click)="test()">test</button> -->
-</div>
+ .swagger-list{
+     overflow: auto;
+ }
\ No newline at end of file
diff --git a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-list/microservice-list.component.html b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice-list/microservice-list.component.html
new file mode 100644 (file)
index 0000000..ce4730f
--- /dev/null
@@ -0,0 +1,32 @@
+<!--
+/**
+ * Copyright (c) 2017 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ *     ZTE - initial API and implementation and/or initial documentation
+ */
+-->
+<div class="scroll" style="overflow:hidden; max-height: 300px; height: 300px;">
+    <div class="card">
+        <div class="card-header d-flex justify-content-between align-items-center">
+            <span>Config List</span>
+            <span class="badge badge-success badge-pill" (click)="addMicroservice()"><i class="fa fa-plus"></i></span>
+        </div>
+
+        <ul class="list-group">
+            <li class="list-group-item d-flex justify-content-between align-items-center"
+                *ngFor="let microservice of microservices; index as i">
+                <div (click)="onMicroserviceSelected(microservice)">{{microservice.name}}</div>
+                <div class="badge badge-danger badge-pill" (click)="deleteMicroservice(i, microservice)">
+                    <i class="fa fa-minus"></i>
+                </div>
+            </li>
+        </ul>
+    </div>
+</div>
+
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
new file mode 100644 (file)
index 0000000..2e22699
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2017 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ *     ZTE - initial API and implementation and/or initial documentation
+ */
+
+import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
+import { ModalDirective } from 'ngx-bootstrap/modal';
+
+import { Microservice } from '../../../../model/workflow/microservice';
+
+/**
+ * toolbar component contains some basic operations(save) and all of the supported workflow nodes.
+ * The supported nodes can be dragged to container component. which will add a new node to the workflow.
+ */
+@Component({
+    selector: 'b4t-microservice-list',
+    templateUrl: 'microservice-list.component.html',
+})
+export class MicroserviceListComponent {
+    @Input() microservices: Microservice[];
+    @Output() microserviceSelected = new EventEmitter<Microservice>();
+
+    public onMicroserviceSelected(microservice: Microservice) {
+        this.microserviceSelected.emit(microservice);
+    }
+
+    public addMicroservice() {
+        const microservice = new Microservice('new microservice', '', {});
+        this.microservices.push(microservice);
+
+        this.onMicroserviceSelected(microservice);
+    }
+
+    public deleteMicroservice(index: number, microservice: Microservice) {
+        this.deleteMicroService(microservice.name, microservice.version);
+
+        // set the next microservice selected
+        let selectedMicroservice;
+        if (this.microservices.length > 0) {
+            if (this.microservices[index]) {
+                selectedMicroservice = this.microservices[index];
+            } else {
+                selectedMicroservice = this.microservices[index - 1];
+            }
+        }
+        this.onMicroserviceSelected(selectedMicroservice);
+    }
+
+    private deleteMicroService(name: string, version: string) {
+        const index = this.microservices.findIndex(service => (service.name === name && service.version === version));
+        if(index !== -1) {
+            return this.microservices.splice(index, 1)[0];
+        }
+
+        return undefined;
+    }
+}
diff --git a/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice.component.html b/sdc-workflow-designer-ui/src/app/components/menu/microservice/microservice.component.html
new file mode 100644 (file)
index 0000000..e8483c2
--- /dev/null
@@ -0,0 +1,39 @@
+<!--
+/**
+ * Copyright (c) 2017 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ *     ZTE - initial API and implementation and/or initial documentation
+ */
+-->
+<div class="modal fade" bsModal #microserviceModal="bs-modal" [config]="{backdrop: 'static'}"
+     tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h4 class="modal-title pull-left">microservice Setting</h4>
+                <button type="button" class="close pull-right" aria-label="Close" (click)="microserviceModal.hide()">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="row">
+                    <div class="col-sm-4">
+                        <b4t-microservice-list [microservices]="microservices" (microserviceSelected)="microserviceSelected($event)"></b4t-microservice-list>
+                    </div>
+                    <div class="col-sm-8">
+                        <b4t-microservice-detail [microservice]="currentMicroservice"></b4t-microservice-detail>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn over-grey" (click)="microserviceModal.hide()">close</button>
+            </div>
+        </div>
+    </div>
+</div>
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
new file mode 100644 (file)
index 0000000..4591eef
--- /dev/null
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2017 ZTE Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ *     ZTE - initial API and implementation and/or initial documentation
+ */
+
+import { AfterViewInit, Component, ViewChild } from '@angular/core';
+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";
+
+/**
+ * microservice component
+ * open a model to set microservice info
+ */
+@Component({
+    selector: 'b4t-microservice',
+    templateUrl: 'microservice.component.html',
+})
+export class MicroserviceComponent {
+    @ViewChild('microserviceModal') public microserviceModal: ModalDirective;
+
+    public microservices: Microservice[];
+    public currentMicroservice: Microservice;
+
+    constructor(private workflowConfigService: WorkflowConfigService) {
+    }
+
+    public microserviceSelected(microservice: any) {
+        this.currentMicroservice = microservice;
+    }
+
+    public show() {
+        this.microservices = this.workflowConfigService.getMicroservices();
+        this.microserviceModal.show();
+    }
+
+}
diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/configs.ts b/sdc-workflow-designer-ui/src/app/model/workflow/configs.ts
new file mode 100644 (file)
index 0000000..9a5a08f
--- /dev/null
@@ -0,0 +1,21 @@
+/**\r
+ * Copyright (c) 2017 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * and the Apache License 2.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ *     ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+\r
+import { Injectable } from '@angular/core';\r
+import { Microservice } from "./microservice";\r
+\r
+/**\r
+ * Configs\r
+ */\r
+export class Configs {\r
+    constructor(public microservices:Microservice[]) {}\r
+}\r
diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/microservice.ts b/sdc-workflow-designer-ui/src/app/model/workflow/microservice.ts
new file mode 100644 (file)
index 0000000..c4d4b39
--- /dev/null
@@ -0,0 +1,20 @@
+/**\r
+ * Copyright (c) 2017 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * and the Apache License 2.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ *     ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+\r
+import { Injectable } from '@angular/core';\r
+\r
+/**\r
+ * Microservice\r
+ */\r
+export class Microservice {\r
+    constructor(public name: string, public version: string, public swagger: any) {}\r
+}\r
index 672396c..4ab1544 100644 (file)
 \r
 import { Injectable } from '@angular/core';\r
 import { WorkflowNode } from "./workflow-node";\r
+import { Configs } from "./configs";\r
 \r
 /**\r
  * Workflow\r
  */\r
 export class Workflow {\r
-    constructor(public id: string, public name: string, public nodes: WorkflowNode[]) {}\r
+    constructor(public id: string, public name: string, public nodes: WorkflowNode[], public configs: Configs) {}\r
 }\r
index 1609c94..c9b803b 100644 (file)
@@ -21,11 +21,17 @@ export class InMemoryDataService implements InMemoryDbService {
         const workflows = [{\r
             id: 'workflow1',\r
             name:'workflow1',\r
-            nodes: []\r
+            nodes: [],\r
+            configs:{\r
+                microservices:[]\r
+            }\r
         },{\r
             id:'workflow2',\r
             name: 'workflow2',\r
-            nodes: []\r
+            nodes: [],\r
+            configs:{\r
+                microservices:[]\r
+            }\r
         }\r
     ];\r
         return {workflows};\r
index 74fc8c3..02ade95 100644 (file)
@@ -37,7 +37,7 @@ export class SdcService extends CatalogService {
     public loadWorkflow(workflowId: string): Observable<Workflow> {\r
         // TODO load data from sdc\r
         const url = `api/workflows/${workflowId}`;\r
-        return this.httpService.get(url).map(response => response.data);\r
+        return this.httpService.get(url).map(response => response.data as Workflow);\r
     }\r
 \r
     public saveWorkflow(workflow: Workflow): Observable<boolean> {\r
index 0863fb5..ffd00c6 100644 (file)
@@ -107,7 +107,6 @@ export class JsPlumbService {
     }\r
 \r
     public buttonDroppable() {\r
-        console.log('buttonDroppable');\r
         const selector = this.jsplumbInstance.getSelector('.canvas');\r
         this.jsplumbInstance.droppable(selector, {\r
             scope: 'btn',\r
diff --git a/sdc-workflow-designer-ui/src/app/services/workflow-config.service.ts b/sdc-workflow-designer-ui/src/app/services/workflow-config.service.ts
new file mode 100644 (file)
index 0000000..d645ebc
--- /dev/null
@@ -0,0 +1,28 @@
+/**\r
+ * Copyright (c) 2017 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * and the Apache License 2.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ *     ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+\r
+import { Injectable } from '@angular/core';\r
+import { WorkflowService } from "./workflow.service";\r
+import { Microservice } from "../model/workflow/microservice";\r
+\r
+/**\r
+ * WorkflowConfigService\r
+ * provides all of the operations about workflow configs.\r
+ */\r
+@Injectable()\r
+export class WorkflowConfigService {\r
+    constructor(private workflowService: WorkflowService) {}\r
+\r
+    public getMicroservices(): Microservice[] {\r
+        return this.workflowService.workflow.configs.microservices;\r
+    }\r
+}\r
index baf1dba..1591a13 100644 (file)
@@ -13,11 +13,13 @@ import { CommonModule } from '@angular/common';
 import { NgModule } from '@angular/core';
 import { FormsModule } from '@angular/forms';
 import { HttpModule } from '@angular/http';
+import { RadioButtonModule } from 'primeng/primeng';
 import { RouterModule } from '@angular/router';
 
 const module = [
     CommonModule,
     FormsModule,
+    RadioButtonModule,
     RouterModule,
 ];
 
index e876fc8..2c5ee42 100644 (file)
 -->
 <!doctype html>
 <html lang="en">
+
 <head>
-  <meta charset="utf-8">
-  <title>Workflow Designer</title>
-  <base href="/">
+    <meta charset="utf-8">
+    <title>Workflow Designer</title>
+    <base href="/">
 
-  <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
 </head>
+
 <body>
-  <app-root></app-root>
+    <script>
+        window.__theme = 'bs4';
+    </script>
+    <app-root></app-root>
 </body>
+
 </html>