98211: Added ModifyItemOverviewComponent & confirm action button to AdvancedWorkflowActionSelectReviewerComponent

This commit is contained in:
Alexandre Vryghem
2023-01-06 14:16:30 +01:00
parent 947658dd08
commit 1a8320c4f7
8 changed files with 82 additions and 14 deletions

View File

@@ -1 +1,16 @@
advancedInfo: {{ (workflowAction | async)?.advancedInfo | json }}
<div>
advancedInfo: {{ (workflowAction$ | async)?.advancedInfo | json }}
<ds-modify-item-overview *ngIf="item$ | async"
[item]="item$ | async">
</ds-modify-item-overview>
<div class="d-flex flex-wrap justify-content-end">
<button class="btn btn-default" (click)="previousPage()">
{{'workflow-item.' + getType() + '.button.cancel' | translate}}
</button>
<button class="btn btn-primary" (click)="performAction()">
{{'workflow-item.' + getType() + '.button.confirm' | translate}}
</button>
</div>
</div>

View File

@@ -4,6 +4,7 @@ import {
} from '../../../shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator';
import { AdvancedWorkflowActionComponent } from '../advanced-workflow-action/advanced-workflow-action.component';
export const WORKFLOW_ADVANCED_TASK_OPTION_SELECT_REVIEWER = 'submit_select_reviewer';
export const ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER = 'selectrevieweraction';
@rendersAdvancedWorkflowTaskOption(ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER)
@@ -13,4 +14,15 @@ export const ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER = 'selectrevieweraction';
styleUrls: ['./advanced-workflow-action-select-reviewer.component.scss'],
})
export class AdvancedWorkflowActionSelectReviewerComponent extends AdvancedWorkflowActionComponent {
getType(): string {
return ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER;
}
createBody(): any {
return {
[WORKFLOW_ADVANCED_TASK_OPTION_SELECT_REVIEWER]: true,
};
}
}

View File

@@ -1,29 +1,60 @@
import { Component, OnInit } from '@angular/core';
import { WorkflowAction } from '../../../core/tasks/models/workflow-action-object.model';
import { WorkflowActionDataService } from '../../../core/data/workflow-action-data.service';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import { Observable } from 'rxjs';
import { WorkflowItemActionPageComponent } from '../../workflow-item-action-page.component';
import { WorkflowItemDataService } from '../../../core/submission/workflowitem-data.service';
import { RouteService } from '../../../core/services/route.service';
import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { TranslateService } from '@ngx-translate/core';
import { getFirstSucceededRemoteDataPayload } from '../../../core/shared/operators';
import { ClaimedTaskDataService } from '../../../core/tasks/claimed-task-data.service';
import { map } from 'rxjs/operators';
import { ProcessTaskResponse } from '../../../core/tasks/models/process-task-response';
@Component({
selector: 'ds-advanced-workflow-action',
templateUrl: './advanced-workflow-action.component.html',
styleUrls: ['./advanced-workflow-action.component.scss']
template: '',
})
export class AdvancedWorkflowActionComponent implements OnInit {
export abstract class AdvancedWorkflowActionComponent extends WorkflowItemActionPageComponent implements OnInit {
workflowAction: Observable<WorkflowAction>;
workflowAction$: Observable<WorkflowAction>;
constructor(
protected route: ActivatedRoute,
protected workflowItemService: WorkflowItemDataService,
protected router: Router,
protected routeService: RouteService,
protected notificationsService: NotificationsService,
protected translationService: TranslateService,
protected workflowActionService: WorkflowActionDataService,
protected claimedTaskDataService: ClaimedTaskDataService,
) {
super(route, workflowItemService, router, routeService, notificationsService, translationService);
}
ngOnInit(): void {
this.workflowAction = this.workflowActionService.findById(this.route.snapshot.queryParams.workflow).pipe(
super.ngOnInit();
this.workflowAction$ = this.workflowActionService.findById(this.route.snapshot.queryParams.workflow).pipe(
getFirstSucceededRemoteDataPayload(),
);
}
/**
* Submits the task with the given {@link createBody}.
*
* @param id
*/
sendRequest(id: string): Observable<boolean> {
return this.claimedTaskDataService.submitTask(id, this.createBody()).pipe(
map((processTaskResponse: ProcessTaskResponse) => processTaskResponse.hasSucceeded),
);
}
/**
* The body that needs to be passed to the {@link ClaimedTaskDataService}.submitTask().
*/
abstract createBody(): any;
}

View File

@@ -18,7 +18,6 @@ import { AdvancedWorkflowActionPageComponent } from './advanced-workflow-action/
import {
AdvancedClaimedTaskActionsDirective
} from './advanced-workflow-action/advanced-workflow-actions-loader/advanced-claimed-task-actions.directive';
import { AdvancedWorkflowActionComponent } from './advanced-workflow-action/advanced-workflow-action/advanced-workflow-action.component';
@NgModule({
imports: [
@@ -39,7 +38,6 @@ import { AdvancedWorkflowActionComponent } from './advanced-workflow-action/adva
AdvancedWorkflowActionSelectReviewerComponent,
AdvancedWorkflowActionPageComponent,
AdvancedClaimedTaskActionsDirective,
AdvancedWorkflowActionComponent,
]
})
/**