Commits
Alexandre Vryghem authored f0ceb645c75
1 1 | import { Component, OnInit } from '@angular/core'; |
2 2 | import { ClaimedTaskActionsAbstractComponent } from './claimed-task-actions-abstract.component'; |
3 3 | import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators'; |
4 4 | import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model'; |
5 5 | import { getAdvancedWorkflowRoute } from '../../../../workflowitems-edit-page/workflowitems-edit-page-routing-paths'; |
6 + | import { Params } from '@angular/router'; |
6 7 | |
7 8 | /** |
8 9 | * Abstract component for rendering an advanced claimed task's action |
9 10 | * To create a child-component for a new option: |
10 11 | * - Set the "{@link option}" and "{@link workflowType}" of the component |
11 12 | * - Add a @{@link rendersWorkflowTaskOption} annotation to your component providing the same enum value |
12 13 | */ |
13 14 | @Component({ |
14 15 | selector: 'ds-advanced-claimed-task-action-abstract', |
15 16 | template: '' |
40 41 | ).subscribe((workflowItem: WorkflowItem) => { |
41 42 | this.workflowTaskPageRoute = getAdvancedWorkflowRoute(workflowItem.id); |
42 43 | })); |
43 44 | } |
44 45 | |
45 46 | /** |
46 47 | * Navigates to the advanced workflow page based on the {@link workflow}. |
47 48 | */ |
48 49 | openAdvancedClaimedTaskTab(): void { |
49 50 | void this.router.navigate([this.workflowTaskPageRoute], { |
50 - | queryParams: { |
51 - | workflow: this.workflowType, |
52 - | claimedTask: this.object.id, |
53 - | }, |
51 + | queryParams: this.getQueryParams(), |
54 52 | }); |
55 53 | } |
56 54 | |
55 + | /** |
56 + | * The {@link Params} that need to be given to the workflow page. |
57 + | */ |
58 + | getQueryParams(): Params { |
59 + | return { |
60 + | workflow: this.workflowType, |
61 + | claimedTask: this.object.id, |
62 + | }; |
63 + | } |
64 + | |
57 65 | } |