summaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-ui/src/app/components/menu
diff options
context:
space:
mode:
authorLvbo163 <lv.bo163@zte.com.cn>2018-01-09 16:15:28 +0800
committerLvbo163 <lv.bo163@zte.com.cn>2018-01-09 17:05:14 +0800
commit2356116cdf19843ba11bc0e781577b5a539ba712 (patch)
treea786eb61b2b456dd1ef3e0ebdd4a50166ca04a44 /sdc-workflow-designer-ui/src/app/components/menu
parentc4e228b35d31f095f82eef54e8391762d59a3d3d (diff)
remove plan name from plan definition
change workflow structure Issue-ID: SDC-889 Change-Id: I8ddb053361960d741920c7fe6fff628eb29fbf0c Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/components/menu')
-rw-r--r--sdc-workflow-designer-ui/src/app/components/menu/menu.component.ts22
-rw-r--r--sdc-workflow-designer-ui/src/app/components/menu/workflows/workflows.component.html6
-rw-r--r--sdc-workflow-designer-ui/src/app/components/menu/workflows/workflows.component.ts15
3 files changed, 26 insertions, 17 deletions
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
<div class="modal-body">
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-center"
- *ngFor="let workflow of workflows">
- <div style="width:380px"><input class="form-control" [(ngModel)]="workflow.name"></div>
- <div class="badge badge-danger badge-pill" (click)="deleteWorkflow(workflow)">
+ *ngFor="let key of workflows.keys()">
+ <div style="width:380px"><input class="form-control" [(ngModel)]="workflows.get(key).planName"></div>
+ <div class="badge badge-danger badge-pill" (click)="deleteWorkflow(key)">
<i class="fa fa-minus"></i>
</div>
</li>
diff --git a/sdc-workflow-designer-ui/src/app/components/menu/workflows/workflows.component.ts b/sdc-workflow-designer-ui/src/app/components/menu/workflows/workflows.component.ts
index dff73008..bf884983 100644
--- a/sdc-workflow-designer-ui/src/app/components/menu/workflows/workflows.component.ts
+++ b/sdc-workflow-designer-ui/src/app/components/menu/workflows/workflows.component.ts
@@ -14,7 +14,7 @@ import { AfterViewInit, Component, ViewChild } from '@angular/core';
import { ModalDirective } from 'ngx-bootstrap/modal';
import { WorkflowService } from "../../../services/workflow.service";
-import { Workflow } from "../../../model/workflow/workflow";
+import { PlanModel } from "../../../model/workflow/plan-model";
/**
* workflows component
@@ -27,18 +27,25 @@ import { Workflow } from "../../../model/workflow/workflow";
export class WorkflowsComponent {
@ViewChild('workflowsModal') public workflowsModal: ModalDirective;
- public workflows: Workflow[];
+ public workflows :Map<number, any>;
constructor(private workflowService: WorkflowService) {
}
public show() {
this.workflows = this.workflowService.getWorkflows();
+ // this.workflowService.getWorkflows().forEach((value, key, map) => {
+ // this.workflows.push({
+ // "planName": value.planName,
+ // "planId": key
+ // });
+ // });;
+
this.workflowsModal.show();
}
- public deleteWorkflow(workflow: Workflow) {
- this.workflowService.deleteWorkflow(workflow.name);
+ public deleteWorkflow(planId: number) {
+ this.workflowService.deleteWorkflow(planId);
}
public addWorkflow() {