From bc9c477be9da4809449ed7a2152b00d288d9daa6 Mon Sep 17 00:00:00 2001 From: Rafael Bertoli Date: Thu, 22 Aug 2024 10:44:06 -0300 Subject: [PATCH] 10970-Agrego opciones para default workflow --- ...-actions-approve_not_select.component.html | 8 ++ ...-actions-approve_not_select.component.scss | 0 ...sk-actions-approve_not_select.component.ts | 75 +++++++++++++++++++ .../claimed-task-actions-decorator.ts | 9 ++- .../advanced-approve-and-select.component.ts | 4 +- src/assets/i18n/es.json5 | 8 +- 6 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 src/app/shared/mydspace-actions/claimed-task/sedici-approve-not-select/claimed-task-actions-approve_not_select.component.html create mode 100644 src/app/shared/mydspace-actions/claimed-task/sedici-approve-not-select/claimed-task-actions-approve_not_select.component.scss create mode 100644 src/app/shared/mydspace-actions/claimed-task/sedici-approve-not-select/claimed-task-actions-approve_not_select.component.ts diff --git a/src/app/shared/mydspace-actions/claimed-task/sedici-approve-not-select/claimed-task-actions-approve_not_select.component.html b/src/app/shared/mydspace-actions/claimed-task/sedici-approve-not-select/claimed-task-actions-approve_not_select.component.html new file mode 100644 index 00000000000..e530682a417 --- /dev/null +++ b/src/app/shared/mydspace-actions/claimed-task/sedici-approve-not-select/claimed-task-actions-approve_not_select.component.html @@ -0,0 +1,8 @@ + diff --git a/src/app/shared/mydspace-actions/claimed-task/sedici-approve-not-select/claimed-task-actions-approve_not_select.component.scss b/src/app/shared/mydspace-actions/claimed-task/sedici-approve-not-select/claimed-task-actions-approve_not_select.component.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/app/shared/mydspace-actions/claimed-task/sedici-approve-not-select/claimed-task-actions-approve_not_select.component.ts b/src/app/shared/mydspace-actions/claimed-task/sedici-approve-not-select/claimed-task-actions-approve_not_select.component.ts new file mode 100644 index 00000000000..1433282be73 --- /dev/null +++ b/src/app/shared/mydspace-actions/claimed-task/sedici-approve-not-select/claimed-task-actions-approve_not_select.component.ts @@ -0,0 +1,75 @@ +import { + AsyncPipe, + NgIf, +} from '@angular/common'; +import { + Component, + Injector, +} from '@angular/core'; +import { Router } from '@angular/router'; +import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; +import { + TranslateModule, + TranslateService, +} from '@ngx-translate/core'; +import { + Observable, + of, +} from 'rxjs'; + +import { RemoteData } from '../../../../core/data/remote-data'; +import { RequestService } from '../../../../core/data/request.service'; +import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; +import { SearchService } from '../../../../core/shared/search/search.service'; +import { WorkflowItemDataService } from '../../../../core/submission/workflowitem-data.service'; +import { NotificationsService } from '../../../notifications/notifications.service'; +import { ClaimedApprovedTaskSearchResult } from '../../../object-collection/shared/claimed-approved-task-search-result.model'; +import { ClaimedTaskActionsAbstractComponent } from '../abstract/claimed-task-actions-abstract.component'; + +export const WORKFLOW_TASK_OPTION_APPROVE_NOT_SELECT = 'submit_approve_not_select'; + +@Component({ + selector: 'ds-claimed-task-actions-approve_not_select', + styleUrls: ['./claimed-task-actions-approve_not_select.component.scss'], + templateUrl: './claimed-task-actions-approve_not_select.component.html', + standalone: true, + imports: [NgbTooltipModule, NgIf, AsyncPipe, TranslateModule], +}) +/** + * Component for displaying and processing the approve action on a workflow task item + */ +export class ClaimedTaskActionsApproveNotSelectComponent extends ClaimedTaskActionsAbstractComponent { + + constructor( + protected injector: Injector, + protected router: Router, + protected notificationsService: NotificationsService, + protected translate: TranslateService, + protected searchService: SearchService, + protected requestService: RequestService, + protected workflowItemDataService: WorkflowItemDataService, + ) { + super(injector, router, notificationsService, translate, searchService, requestService); + } + + reloadObjectExecution(): Observable | DSpaceObject> { + return of(this.object); + } + + convertReloadedObject(dso: DSpaceObject): DSpaceObject { + const reloadedObject = Object.assign(new ClaimedApprovedTaskSearchResult(), dso, { + indexableObject: dso, + }); + return reloadedObject; + } + + public handleReloadableActionResponse(result: boolean, dso: DSpaceObject): void { + super.handleReloadableActionResponse(result, dso); + + // Item page version table includes labels for workflow Items, determined + // based on the result of /workflowitems/search/item?uuid=... + // In order for this label to be in sync with the workflow state, we should + // invalidate WFIs as they are approved. + this.workflowItemDataService.invalidateByHref(this.object?._links.workflowitem?.href); + } +} 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 25ddf5e4509..229aeb11b5d 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,3 +1,4 @@ +import { SelectableListActionTypes } from './../../../object-list/selectable-list/selectable-list.actions'; import { ADVANCED_WORKFLOW_TASK_OPTION_SELECT_COLLECTION, ADVANCED_WORKFLOW_ACTION_SELECT_COLLECTION, @@ -43,6 +44,10 @@ import { WORKFLOW_TASK_OPTION_RETURN_TO_POOL, } from '../return-to-pool/claimed-task-actions-return-to-pool.component'; import { AdvancedClaimedTaskActionSelectReviewerComponent } from '../select-reviewer/advanced-claimed-task-action-select-reviewer.component'; +import { + ClaimedTaskActionsApproveNotSelectComponent, + WORKFLOW_TASK_OPTION_APPROVE_NOT_SELECT, +} from '../sedici-approve-not-select/claimed-task-actions-approve_not_select.component'; export type WorkflowTaskOptionComponent = typeof ClaimedTaskActionsApproveComponent | @@ -53,7 +58,8 @@ export type WorkflowTaskOptionComponent = typeof ClaimedTaskActionsReturnToPoolComponent | typeof AdvancedClaimedTaskActionSelectReviewerComponent| typeof ClaimedTaskActionsSelectCollectionComponent | - typeof ClaimedTaskActionsApproveAndSelectComponent; + typeof ClaimedTaskActionsApproveAndSelectComponent | + typeof ClaimedTaskActionsApproveNotSelectComponent; export type AdvancedWorkflowTaskOptionComponent = typeof AdvancedWorkflowActionRatingComponent | @@ -68,6 +74,7 @@ export const WORKFLOW_TASK_OPTION_DECORATOR_MAP = new Map