diff options
author | Lvbo163 <lv.bo163@zte.com.cn> | 2017-08-30 15:48:01 +0800 |
---|---|---|
committer | Lvbo163 <lv.bo163@zte.com.cn> | 2017-08-30 15:48:01 +0800 |
commit | aa77d17e3f68d8236b4fa07904fec054b07aa23b (patch) | |
tree | 003764793ef8cfc28a5ee2adb3ab0aea4c9b53fa /sdc-workflow-designer-ui/src | |
parent | a53dbd4f12ddd206c2ce9dc0a8ff14a08aadc1fe (diff) |
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>
Diffstat (limited to 'sdc-workflow-designer-ui/src')
-rw-r--r-- | sdc-workflow-designer-ui/src/app/app.component.ts | 10 | ||||
-rw-r--r-- | sdc-workflow-designer-ui/src/app/app.module.ts | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/sdc-workflow-designer-ui/src/app/app.component.ts b/sdc-workflow-designer-ui/src/app/app.component.ts index 59b457f9..29c4d06f 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 { WorkflowService } from "./services/workflow.service"; 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 @@ import { DataAccessService } from "./services/data-access/data-access.service"; 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 616db2dd..8d92d0ae 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 { SharedModule } from "./shared/shared.module"; 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 @@ import { HttpModule } from "@angular/http"; BrowserModule, HttpModule, InMemoryWebApiModule.forRoot(InMemoryDataService), + RouterModule.forRoot([]), SharedModule, ], providers: [ |