diff options
Diffstat (limited to 'sdc-workflow-designer-ui/src/app/components/menu')
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() {
|