Skip to content

Commit

Permalink
Merge pull request #3 from sedici/ticket#10970
Browse files Browse the repository at this point in the history
10970-Agrego opciones para default workflow
  • Loading branch information
178Pelado authored Dec 27, 2024
2 parents 678898b + bc9c477 commit b2bbf71
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<button type="button"
[className]="'btn btn-success'"
ngbTooltip="{{'submission.workflow.tasks.claimed.approve_help' | translate}}"
[disabled]="processing$ | async"
(click)="submitTask()">
<span *ngIf="processing$ | async"><i class='fas fa-circle-notch fa-spin'></i> {{'submission.workflow.tasks.generic.processing' | translate}}</span>
<span *ngIf="(processing$ | async) !== true"><i class="fa fa-thumbs-up"></i> {{'submission.workflow.tasks.claimed.approve_not_select' | translate}}</span>
</button>
Original file line number Diff line number Diff line change
@@ -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<RemoteData<DSpaceObject> | 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);
}
}
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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 |
Expand All @@ -53,7 +58,8 @@ export type WorkflowTaskOptionComponent =
typeof ClaimedTaskActionsReturnToPoolComponent |
typeof AdvancedClaimedTaskActionSelectReviewerComponent|
typeof ClaimedTaskActionsSelectCollectionComponent |
typeof ClaimedTaskActionsApproveAndSelectComponent;
typeof ClaimedTaskActionsApproveAndSelectComponent |
typeof ClaimedTaskActionsApproveNotSelectComponent;

export type AdvancedWorkflowTaskOptionComponent =
typeof AdvancedWorkflowActionRatingComponent |
Expand All @@ -68,6 +74,7 @@ export const WORKFLOW_TASK_OPTION_DECORATOR_MAP = new Map<string, WorkflowTaskOp
[ADVANCED_WORKFLOW_TASK_OPTION_RATING, AdvancedClaimedTaskActionRatingComponent],
[WORKFLOW_TASK_OPTION_REJECT, ClaimedTaskActionsRejectComponent],
[WORKFLOW_TASK_OPTION_RETURN_TO_POOL, ClaimedTaskActionsReturnToPoolComponent],
[WORKFLOW_TASK_OPTION_APPROVE_NOT_SELECT, ClaimedTaskActionsApproveNotSelectComponent],
[ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER, AdvancedClaimedTaskActionSelectReviewerComponent],
[ADVANCED_WORKFLOW_TASK_OPTION_APPROVE_AND_SELECT, ClaimedTaskActionsApproveAndSelectComponent],
[ADVANCED_WORKFLOW_TASK_OPTION_SELECT_COLLECTION, ClaimedTaskActionsSelectCollectionComponent],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { ClaimedTaskDataService } from 'src/app/core/tasks/claimed-task-data.ser
import { ModifyItemOverviewComponent } from '../../../item-page/edit-item-page/modify-item-overview/modify-item-overview.component';


export const ADVANCED_WORKFLOW_TASK_OPTION_APPROVE_AND_SELECT = "approve-and-select";
export const ADVANCED_WORKFLOW_TASK_OPTION_APPROVE_AND_SELECT = "submit_approve_and_select";
export const ADVANCED_WORKFLOW_ACTION_APPROVE_AND_SELECT = 'editaction';

@Component({
Expand Down Expand Up @@ -100,7 +100,7 @@ export class WorkflowApproveAndSelectComponent extends AdvancedWorkflowActionCom

createBody() {
return {
['submit_approve']: 'true',
['submit_approve_and_select']: 'true',
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/assets/i18n/es.json5
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@

// "collection.browse.logo": "Browse for a collection logo",
"collection.browse.logo": "Buscar un logotipo de colección",

// "collection.create.head": "Create a Collection",
"collection.create.head": "Crear una colección",

Expand Down Expand Up @@ -5116,7 +5116,7 @@

// "quality-assurance.noEvents": "No suggestions found.",
"quality-assurance.noEvents": "No se encontraron sugerencias.",

// "quality-assurance.event.table.trust": "Trust"
"quality-assurance.event.table.trust": "Confianza",

Expand Down Expand Up @@ -8614,7 +8614,7 @@

"submission.workflow.generic.approve-and-select-help": "Aprueba la publicacion y pasa a la seleccion de coleccion",

"submission.workflow.generic.approve-and-select": "Aprobar y elegir coleccion",
"submission.workflow.generic.submit_approve_and_select": "Aprobar y elegir coleccion",

"accept-and-select-collection-help": "Aprueba la publicacion y pasa a la seleccion de coleccion",

Expand All @@ -8626,6 +8626,8 @@

"workflow-item.selectCollection.header": "Elegir Coleccion",

"submission.workflow.tasks.claimed.approve_not_select": "Aprobar y publicar",


//"browse.search-form.placeholder": "Search the repository",
"browse.search-form.placeholder": "Buscar en el repositorio",
Expand Down

0 comments on commit b2bbf71

Please sign in to comment.