From 2356116cdf19843ba11bc0e781577b5a539ba712 Mon Sep 17 00:00:00 2001 From: Lvbo163 Date: Tue, 9 Jan 2018 16:15:28 +0800 Subject: remove plan name from plan definition change workflow structure Issue-ID: SDC-889 Change-Id: I8ddb053361960d741920c7fe6fff628eb29fbf0c Signed-off-by: Lvbo163 --- .../src/app/components/menu/menu.component.ts | 22 ++++++++++++---------- .../menu/workflows/workflows.component.html | 6 +++--- .../menu/workflows/workflows.component.ts | 15 +++++++++++---- 3 files changed, 26 insertions(+), 17 deletions(-) (limited to 'sdc-workflow-designer-ui/src/app/components/menu') diff --git a/sdc-workflow-designer-ui/src/app/components/menu/menu.component.ts b/sdc-workflow-designer-ui/src/app/components/menu/menu.component.ts index 4cd88480..b3954911 100644 --- a/sdc-workflow-designer-ui/src/app/components/menu/menu.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/menu/menu.component.ts @@ -15,7 +15,7 @@ import { WorkflowService } from '../../services/workflow.service'; import { MicroserviceComponent } from "./microservice/microservice.component"; import { WorkflowsComponent } from "./workflows/workflows.component"; import { BroadcastService } from "../../services/broadcast.service"; -import { Workflow } from "../../model/workflow/workflow"; +import { PlanModel } from "../../model/workflow/plan-model"; @Component({ selector: 'b4t-menu', @@ -45,27 +45,29 @@ export class MenuComponent { this.workflowsComponent.show(); } - public getWorkflows(workflow: Workflow) { + public getWorkflows(planId: number) { const workflows = this.workflowService.getWorkflows(); if(workflows) { - return workflows.map(workflow => { - return {label: workflow.name, command: () => { - this.workflowSelected(workflow); - }}; + const options = []; + workflows.forEach((value, key, map) => { + options.push({label: value.planName, command: () => { + this.workflowSelected(value.planName, value.plan); + }}); }); + return options; } else { return []; } } - public workflowSelected(workflow: Workflow) { - this.currentWorkflow = workflow.name; + public workflowSelected(planName: string, workflow: PlanModel) { + this.currentWorkflow = planName; this.broadcastService.broadcast(this.broadcastService.workflow, workflow); } public download() { - const filename = this.workflowService.workflow.name + '.json'; - const content = JSON.stringify(this.workflowService.workflow); + const filename = this.currentWorkflow + '.json'; + const content = JSON.stringify(this.workflowService.planModel); var eleLink = document.createElement('a'); eleLink.download = filename; eleLink.style.display = 'none'; diff --git a/sdc-workflow-designer-ui/src/app/components/menu/workflows/workflows.component.html b/sdc-workflow-designer-ui/src/app/components/menu/workflows/workflows.component.html index 0a3b51bf..5568ba60 100644 --- a/sdc-workflow-designer-ui/src/app/components/menu/workflows/workflows.component.html +++ b/sdc-workflow-designer-ui/src/app/components/menu/workflows/workflows.component.html @@ -24,9 +24,9 @@ tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="tru