From 09c070e164739520904285c11a5a27df1914b9c7 Mon Sep 17 00:00:00 2001 From: Andrea Barbasso <´andrea.barbasso@4science.com´> Date: Tue, 16 Jan 2024 10:03:09 +0100 Subject: [PATCH] [DURACOM-191] set map for workflow actions --- .../my-dspace-configuration.service.ts | 2 +- .../claimed-task-actions-approve.component.ts | 10 ++--- ...med-task-actions-decline-task.component.ts | 6 +-- ...ed-task-actions-edit-metadata.component.ts | 6 +-- ...ed-claimed-task-action-rating.component.ts | 6 +-- .../claimed-task-actions-reject.component.ts | 12 +++--- ...d-task-actions-return-to-pool.component.ts | 6 +-- ...d-task-action-select-reviewer.component.ts | 6 +-- .../claimed-task-actions-decorator.ts | 43 +++++++++++++++++++ ...vanced-workflow-action-rating.component.ts | 6 +-- ...rkflow-action-select-reviewer.component.ts | 4 -- 11 files changed, 66 insertions(+), 41 deletions(-) diff --git a/src/app/my-dspace-page/my-dspace-configuration.service.ts b/src/app/my-dspace-page/my-dspace-configuration.service.ts index bc18e0cc18..ce09c8427a 100644 --- a/src/app/my-dspace-page/my-dspace-configuration.service.ts +++ b/src/app/my-dspace-page/my-dspace-configuration.service.ts @@ -28,7 +28,7 @@ export const MyDSpaceConfigurationToContextMap = new Map([ /** * Service that performs all actions that have to do with the current mydspace configuration */ -@Injectable() +@Injectable({providedIn: 'root' }) export class MyDSpaceConfigurationService extends SearchConfigurationService { /** * Default pagination settings diff --git a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.ts b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.ts index 0ac7d08528..af1ee906d1 100644 --- a/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.ts +++ b/src/app/shared/mydspace-actions/claimed-task/approve/claimed-task-actions-approve.component.ts @@ -1,21 +1,21 @@ import { Component, Injector } from '@angular/core'; import { ClaimedTaskActionsAbstractComponent } from '../abstract/claimed-task-actions-abstract.component'; -import { rendersWorkflowTaskOption } from '../switcher/claimed-task-actions-decorator'; import { Observable, of } from 'rxjs'; import { RemoteData } from '../../../../core/data/remote-data'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { Router } from '@angular/router'; import { NotificationsService } from '../../../notifications/notifications.service'; -import { TranslateService, TranslateModule } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { SearchService } from '../../../../core/shared/search/search.service'; import { RequestService } from '../../../../core/data/request.service'; -import { ClaimedApprovedTaskSearchResult } from '../../../object-collection/shared/claimed-approved-task-search-result.model'; -import { NgIf, AsyncPipe } from '@angular/common'; +import { + ClaimedApprovedTaskSearchResult +} from '../../../object-collection/shared/claimed-approved-task-search-result.model'; +import { AsyncPipe, NgIf } from '@angular/common'; import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; export const WORKFLOW_TASK_OPTION_APPROVE = 'submit_approve'; -@rendersWorkflowTaskOption(WORKFLOW_TASK_OPTION_APPROVE) @Component({ selector: 'ds-claimed-task-actions-approve', styleUrls: ['./claimed-task-actions-approve.component.scss'], diff --git a/src/app/shared/mydspace-actions/claimed-task/decline-task/claimed-task-actions-decline-task.component.ts b/src/app/shared/mydspace-actions/claimed-task/decline-task/claimed-task-actions-decline-task.component.ts index 40e28f800f..0a8277a6cf 100644 --- a/src/app/shared/mydspace-actions/claimed-task/decline-task/claimed-task-actions-decline-task.component.ts +++ b/src/app/shared/mydspace-actions/claimed-task/decline-task/claimed-task-actions-decline-task.component.ts @@ -1,9 +1,8 @@ import { Component, Injector } from '@angular/core'; import { ClaimedTaskActionsAbstractComponent } from '../abstract/claimed-task-actions-abstract.component'; -import { rendersWorkflowTaskOption } from '../switcher/claimed-task-actions-decorator'; import { Router } from '@angular/router'; import { NotificationsService } from '../../../notifications/notifications.service'; -import { TranslateService, TranslateModule } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { SearchService } from '../../../../core/shared/search/search.service'; import { RequestService } from '../../../../core/data/request.service'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; @@ -12,12 +11,11 @@ import { } from '../../../object-collection/shared/claimed-declined-task-task-search-result.model'; import { Observable, of as observableOf } from 'rxjs'; import { RemoteData } from 'src/app/core/data/remote-data'; -import { NgIf, AsyncPipe } from '@angular/common'; +import { AsyncPipe, NgIf } from '@angular/common'; import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; export const WORKFLOW_TASK_OPTION_DECLINE_TASK = 'submit_decline_task'; -@rendersWorkflowTaskOption(WORKFLOW_TASK_OPTION_DECLINE_TASK) @Component({ selector: 'ds-claimed-task-actions-decline-task', templateUrl: './claimed-task-actions-decline-task.component.html', diff --git a/src/app/shared/mydspace-actions/claimed-task/edit-metadata/claimed-task-actions-edit-metadata.component.ts b/src/app/shared/mydspace-actions/claimed-task/edit-metadata/claimed-task-actions-edit-metadata.component.ts index cb755dccb0..d9c01bb36f 100644 --- a/src/app/shared/mydspace-actions/claimed-task/edit-metadata/claimed-task-actions-edit-metadata.component.ts +++ b/src/app/shared/mydspace-actions/claimed-task/edit-metadata/claimed-task-actions-edit-metadata.component.ts @@ -1,17 +1,15 @@ import { Component, Injector } from '@angular/core'; import { ClaimedTaskActionsAbstractComponent } from '../abstract/claimed-task-actions-abstract.component'; -import { rendersWorkflowTaskOption } from '../switcher/claimed-task-actions-decorator'; import { Router, RouterLink } from '@angular/router'; import { NotificationsService } from '../../../notifications/notifications.service'; -import { TranslateService, TranslateModule } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { SearchService } from '../../../../core/shared/search/search.service'; import { RequestService } from '../../../../core/data/request.service'; import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; -import { NgIf, AsyncPipe } from '@angular/common'; +import { AsyncPipe, NgIf } from '@angular/common'; export const WORKFLOW_TASK_OPTION_EDIT_METADATA = 'submit_edit_metadata'; -@rendersWorkflowTaskOption(WORKFLOW_TASK_OPTION_EDIT_METADATA) @Component({ selector: 'ds-claimed-task-actions-edit-metadata', styleUrls: ['./claimed-task-actions-edit-metadata.component.scss'], diff --git a/src/app/shared/mydspace-actions/claimed-task/rating/advanced-claimed-task-action-rating.component.ts b/src/app/shared/mydspace-actions/claimed-task/rating/advanced-claimed-task-action-rating.component.ts index a2d39cfca3..9604e2c32d 100644 --- a/src/app/shared/mydspace-actions/claimed-task/rating/advanced-claimed-task-action-rating.component.ts +++ b/src/app/shared/mydspace-actions/claimed-task/rating/advanced-claimed-task-action-rating.component.ts @@ -1,7 +1,7 @@ import { Component, Injector } from '@angular/core'; -import { Router, ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { NotificationsService } from '../../../notifications/notifications.service'; -import { TranslateService, TranslateModule } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { SearchService } from '../../../../core/shared/search/search.service'; import { RequestService } from '../../../../core/data/request.service'; import { @@ -11,13 +11,11 @@ import { ADVANCED_WORKFLOW_ACTION_RATING, ADVANCED_WORKFLOW_TASK_OPTION_RATING, } from '../../../../workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-rating/advanced-workflow-action-rating.component'; -import { rendersWorkflowTaskOption } from '../switcher/claimed-task-actions-decorator'; import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; /** * Advanced Workflow button that redirect to the {@link AdvancedWorkflowActionRatingComponent} */ -@rendersWorkflowTaskOption(ADVANCED_WORKFLOW_TASK_OPTION_RATING) @Component({ selector: 'ds-advanced-claimed-task-action-rating-reviewer', templateUrl: './advanced-claimed-task-action-rating.component.html', diff --git a/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.ts b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.ts index 1190327c15..16be3d5f8c 100644 --- a/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.ts +++ b/src/app/shared/mydspace-actions/claimed-task/reject/claimed-task-actions-reject.component.ts @@ -1,23 +1,23 @@ import { Component, Injector, OnInit } from '@angular/core'; -import { UntypedFormBuilder, UntypedFormGroup, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { FormsModule, ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; import { NgbModal, NgbModalRef, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; import { ClaimedTaskActionsAbstractComponent } from '../abstract/claimed-task-actions-abstract.component'; -import { rendersWorkflowTaskOption } from '../switcher/claimed-task-actions-decorator'; import { Router } from '@angular/router'; import { NotificationsService } from '../../../notifications/notifications.service'; -import { TranslateService, TranslateModule } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { SearchService } from '../../../../core/shared/search/search.service'; import { RequestService } from '../../../../core/data/request.service'; import { Observable, of } from 'rxjs'; import { RemoteData } from '../../../../core/data/remote-data'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; -import { ClaimedDeclinedTaskSearchResult } from '../../../object-collection/shared/claimed-declined-task-search-result.model'; -import { NgIf, AsyncPipe } from '@angular/common'; +import { + ClaimedDeclinedTaskSearchResult +} from '../../../object-collection/shared/claimed-declined-task-search-result.model'; +import { AsyncPipe, NgIf } from '@angular/common'; export const WORKFLOW_TASK_OPTION_REJECT = 'submit_reject'; -@rendersWorkflowTaskOption(WORKFLOW_TASK_OPTION_REJECT) @Component({ selector: 'ds-claimed-task-actions-reject', styleUrls: ['./claimed-task-actions-reject.component.scss'], diff --git a/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.ts b/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.ts index ee5744c3af..559c849406 100644 --- a/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.ts +++ b/src/app/shared/mydspace-actions/claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component.ts @@ -1,22 +1,20 @@ import { Component, Injector } from '@angular/core'; import { ClaimedTaskActionsAbstractComponent } from '../abstract/claimed-task-actions-abstract.component'; -import { rendersWorkflowTaskOption } from '../switcher/claimed-task-actions-decorator'; import { Observable } from 'rxjs'; import { Router } from '@angular/router'; import { NotificationsService } from '../../../notifications/notifications.service'; -import { TranslateService, TranslateModule } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { SearchService } from '../../../../core/shared/search/search.service'; import { RequestService } from '../../../../core/data/request.service'; import { RemoteData } from '../../../../core/data/remote-data'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { PoolTaskDataService } from '../../../../core/tasks/pool-task-data.service'; import { take } from 'rxjs/operators'; -import { NgIf, AsyncPipe } from '@angular/common'; +import { AsyncPipe, NgIf } from '@angular/common'; import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; export const WORKFLOW_TASK_OPTION_RETURN_TO_POOL = 'return_to_pool'; -@rendersWorkflowTaskOption(WORKFLOW_TASK_OPTION_RETURN_TO_POOL) @Component({ selector: 'ds-claimed-task-actions-return-to-pool', styleUrls: ['./claimed-task-actions-return-to-pool.component.scss'], diff --git a/src/app/shared/mydspace-actions/claimed-task/select-reviewer/advanced-claimed-task-action-select-reviewer.component.ts b/src/app/shared/mydspace-actions/claimed-task/select-reviewer/advanced-claimed-task-action-select-reviewer.component.ts index e3ac607037..e8ac7c5b88 100644 --- a/src/app/shared/mydspace-actions/claimed-task/select-reviewer/advanced-claimed-task-action-select-reviewer.component.ts +++ b/src/app/shared/mydspace-actions/claimed-task/select-reviewer/advanced-claimed-task-action-select-reviewer.component.ts @@ -1,11 +1,10 @@ import { Component, Injector } from '@angular/core'; -import { rendersWorkflowTaskOption } from '../switcher/claimed-task-actions-decorator'; import { AdvancedClaimedTaskActionsAbstractComponent } from '../abstract/advanced-claimed-task-actions-abstract.component'; -import { Router, ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { NotificationsService } from '../../../notifications/notifications.service'; -import { TranslateService, TranslateModule } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { SearchService } from '../../../../core/shared/search/search.service'; import { RequestService } from '../../../../core/data/request.service'; import { @@ -17,7 +16,6 @@ import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; /** * Advanced Workflow button that redirect to the {@link AdvancedWorkflowActionSelectReviewerComponent} */ -@rendersWorkflowTaskOption(ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER) @Component({ selector: 'ds-advanced-claimed-task-action-select-reviewer', templateUrl: './advanced-claimed-task-action-select-reviewer.component.html', diff --git a/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator.ts b/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator.ts index 8e4dede9bb..ceec963200 100644 --- a/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator.ts +++ b/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator.ts @@ -1,8 +1,51 @@ import { hasNoValue } from '../../../empty.util'; +import { + ClaimedTaskActionsApproveComponent, + WORKFLOW_TASK_OPTION_APPROVE +} from '../approve/claimed-task-actions-approve.component'; +import { + ClaimedTaskActionsDeclineTaskComponent, + WORKFLOW_TASK_OPTION_DECLINE_TASK +} from '../decline-task/claimed-task-actions-decline-task.component'; +import { + ClaimedTaskActionsEditMetadataComponent, + WORKFLOW_TASK_OPTION_EDIT_METADATA +} from '../edit-metadata/claimed-task-actions-edit-metadata.component'; +import { + ADVANCED_WORKFLOW_TASK_OPTION_RATING, + AdvancedWorkflowActionRatingComponent +} from '../../../../workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-rating/advanced-workflow-action-rating.component'; +import { AdvancedClaimedTaskActionRatingComponent } from '../rating/advanced-claimed-task-action-rating.component'; +import { + ClaimedTaskActionsRejectComponent, + WORKFLOW_TASK_OPTION_REJECT +} from '../reject/claimed-task-actions-reject.component'; +import { + ClaimedTaskActionsReturnToPoolComponent, + WORKFLOW_TASK_OPTION_RETURN_TO_POOL +} from '../return-to-pool/claimed-task-actions-return-to-pool.component'; +import { + ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER, + AdvancedWorkflowActionSelectReviewerComponent +} from '../../../../workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/advanced-workflow-action-select-reviewer.component'; +import { + AdvancedClaimedTaskActionSelectReviewerComponent +} from '../select-reviewer/advanced-claimed-task-action-select-reviewer.component'; const workflowOptions = new Map(); const advancedWorkflowOptions = new Map(); +workflowOptions.set(WORKFLOW_TASK_OPTION_APPROVE, ClaimedTaskActionsApproveComponent); +workflowOptions.set(WORKFLOW_TASK_OPTION_DECLINE_TASK, ClaimedTaskActionsDeclineTaskComponent); +workflowOptions.set(WORKFLOW_TASK_OPTION_EDIT_METADATA, ClaimedTaskActionsEditMetadataComponent); +workflowOptions.set(ADVANCED_WORKFLOW_TASK_OPTION_RATING, AdvancedClaimedTaskActionRatingComponent); +workflowOptions.set(WORKFLOW_TASK_OPTION_REJECT, ClaimedTaskActionsRejectComponent); +workflowOptions.set(WORKFLOW_TASK_OPTION_RETURN_TO_POOL, ClaimedTaskActionsReturnToPoolComponent); +workflowOptions.set(ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER, AdvancedClaimedTaskActionSelectReviewerComponent); + +advancedWorkflowOptions.set(ADVANCED_WORKFLOW_TASK_OPTION_RATING, AdvancedWorkflowActionRatingComponent); +advancedWorkflowOptions.set(ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER, AdvancedWorkflowActionSelectReviewerComponent); + /** * Decorator used for rendering ClaimedTaskActions pages by option type */ diff --git a/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-rating/advanced-workflow-action-rating.component.ts b/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-rating/advanced-workflow-action-rating.component.ts index eb735c37eb..d9724b4918 100644 --- a/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-rating/advanced-workflow-action-rating.component.ts +++ b/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-rating/advanced-workflow-action-rating.component.ts @@ -1,9 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { - rendersAdvancedWorkflowTaskOption -} from '../../../shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator'; import { AdvancedWorkflowActionComponent } from '../advanced-workflow-action/advanced-workflow-action.component'; -import { UntypedFormGroup, UntypedFormControl, Validators, ReactiveFormsModule } from '@angular/forms'; +import { ReactiveFormsModule, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms'; import { WorkflowAction } from '../../../core/tasks/models/workflow-action-object.model'; import { RatingAdvancedWorkflowInfo } from '../../../core/tasks/models/rating-advanced-workflow-info.model'; import { @@ -20,7 +17,6 @@ export const ADVANCED_WORKFLOW_ACTION_RATING = 'scorereviewaction'; /** * The page on which reviewers can rate submitted items. */ -@rendersAdvancedWorkflowTaskOption(ADVANCED_WORKFLOW_ACTION_RATING) @Component({ selector: 'ds-advanced-workflow-action-rating-reviewer', templateUrl: './advanced-workflow-action-rating.component.html', diff --git a/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/advanced-workflow-action-select-reviewer.component.ts b/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/advanced-workflow-action-select-reviewer.component.ts index 4de03bc4ae..59f65e044c 100644 --- a/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/advanced-workflow-action-select-reviewer.component.ts +++ b/src/app/workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/advanced-workflow-action-select-reviewer.component.ts @@ -1,8 +1,5 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { CommonModule, Location } from '@angular/common'; -import { - rendersAdvancedWorkflowTaskOption -} from '../../../shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator'; import { AdvancedWorkflowActionComponent } from '../advanced-workflow-action/advanced-workflow-action.component'; import { WorkflowAction } from '../../../core/tasks/models/workflow-action-object.model'; import { @@ -33,7 +30,6 @@ export const ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER = 'selectrevieweraction'; /** * The page on which Review Managers can assign Reviewers to review an item. */ -@rendersAdvancedWorkflowTaskOption(ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER) @Component({ selector: 'ds-advanced-workflow-action-select-reviewer', templateUrl: './advanced-workflow-action-select-reviewer.component.html',