get parameter from url
load workflow definition by parameters of url
Issue-ID: SDC-258
Change-Id: If3a4e90a5524876a610979a0867aa445cf94d1db
Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
diff --git a/sdc-workflow-designer-ui/src/app/app.component.ts b/sdc-workflow-designer-ui/src/app/app.component.ts
index 59b457f..29c4d06 100644
--- a/sdc-workflow-designer-ui/src/app/app.component.ts
+++ b/sdc-workflow-designer-ui/src/app/app.component.ts
@@ -16,6 +16,7 @@
import { WorkflowNode } from "./model/workflow-node";
import { Workflow } from "./model/workflow";
import { DataAccessService } from "./services/data-access/data-access.service";
+import { ActivatedRoute } from "@angular/router";
@Component({
selector: 'app-root',
@@ -25,11 +26,16 @@
export class AppComponent implements AfterViewInit, OnInit {
constructor(private jsplumbService: JsPlumbService,
private dataAccessService: DataAccessService,
+ private route: ActivatedRoute,
private workflowService: WorkflowService) {}
ngOnInit(): void {
- this.dataAccessService.catalogService.loadWorkflow('workflow1').subscribe(workflow => {
- this.workflowService.workflow = workflow;
+ this.route.queryParams.subscribe(params => {
+ if(params.id) {
+ this.dataAccessService.catalogService.loadWorkflow(params.id).subscribe(workflow => {
+ this.workflowService.workflow = workflow;
+ });
+ }
});
}
diff --git a/sdc-workflow-designer-ui/src/app/app.module.ts b/sdc-workflow-designer-ui/src/app/app.module.ts
index 616db2d..8d92d0a 100644
--- a/sdc-workflow-designer-ui/src/app/app.module.ts
+++ b/sdc-workflow-designer-ui/src/app/app.module.ts
@@ -24,6 +24,7 @@
import { InMemoryWebApiModule } from "angular-in-memory-web-api";
import { InMemoryDataService } from "./services/data-access/in-memory-data.service";
import { HttpModule } from "@angular/http";
+import { RouterModule } from "@angular/router";
@NgModule({
declarations: [
@@ -35,6 +36,7 @@
BrowserModule,
HttpModule,
InMemoryWebApiModule.forRoot(InMemoryDataService),
+ RouterModule.forRoot([]),
SharedModule,
],
providers: [