From 32222a4010ebdc739ee1586b09da6758136d9813 Mon Sep 17 00:00:00 2001 From: Lvbo163 Date: Wed, 10 Jan 2018 17:29:26 +0800 Subject: support edit rest task properties modify rest taks config info, and enable edit rest task properties.component.css Issue-ID: SDC-897 Change-Id: Icad8c1ee60d7572f311d5cba97cda6b2144a7469 Signed-off-by: Lvbo163 --- .../src/app/components/menu/menus.component.ts | 30 ++++++++-------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'sdc-workflow-designer-ui/src/app/components/menu/menus.component.ts') diff --git a/sdc-workflow-designer-ui/src/app/components/menu/menus.component.ts b/sdc-workflow-designer-ui/src/app/components/menu/menus.component.ts index 6932e764..e5f68ad1 100644 --- a/sdc-workflow-designer-ui/src/app/components/menu/menus.component.ts +++ b/sdc-workflow-designer-ui/src/app/components/menu/menus.component.ts @@ -25,7 +25,7 @@ import { PlanModel } from "../../model/workflow/plan-model"; export class MenusComponent { @ViewChild(MicroserviceComponent) public microserviceComponent: MicroserviceComponent; @ViewChild(WorkflowsComponent) public workflowsComponent: WorkflowsComponent; - public currentWorkflow = 'Workflows'; + public currentWorkflowId : number; public workflows = []; constructor(private broadcastService: BroadcastService, private workflowService: WorkflowService) { @@ -34,7 +34,7 @@ export class MenusComponent { if(wfs) { wfs.forEach((value, key, map) => { this.workflows.push({label: value.planName, command: () => { - this.workflowSelected(value.planName, value.plan); + this.workflowSelected(key, value.plan); }}); }); } @@ -56,29 +56,19 @@ export class MenusComponent { this.workflowsComponent.show(); } - public getWorkflows() { - const workflows = this.workflowService.getWorkflows(); - if(workflows) { - const options = []; - workflows.forEach((value, key, map) => { - options.push({label: value.planName, command: () => { - console.log(`${value.planName} selected`); - this.workflowSelected(value.planName, value.plan); - }}); - }); - return options; - } else { - return []; - } + public workflowSelected(planId: number, planModel: PlanModel) { + + this.broadcastService.broadcast(this.broadcastService.planModel, planModel); + this.broadcastService.broadcast(this.broadcastService.planId, planId); } - public workflowSelected(planName: string, workflow: PlanModel) { - this.currentWorkflow = planName; - this.broadcastService.broadcast(this.broadcastService.planModel, workflow); + public getCurrentPlanName() { + let planName = this.workflowService.getPlanName(this.currentWorkflowId); + return planName ? planName : 'Workflows' } public download() { - const filename = this.currentWorkflow + '.json'; + const filename = this.getCurrentPlanName() + '.json'; const content = JSON.stringify(this.workflowService.planModel); var eleLink = document.createElement('a'); eleLink.download = filename; -- cgit 1.2.3-korg