Skip to content

Commit

Permalink
10475-posibilidad de cambiar de coleccion
Browse files Browse the repository at this point in the history
  • Loading branch information
GarrafaGalactica committed May 6, 2024
1 parent 5728b8e commit 0d142a5
Show file tree
Hide file tree
Showing 17 changed files with 516 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<button (click)="openAdvancedClaimedTaskTab()" class="selectCollectionAction btn btn-primary"
ngbTooltip="{{ 'submission.workflow.generic.' + option + '-help' | translate }}">
<i class="fa fa-user"></i> {{ 'submission.workflow.generic.' + option | translate }}
</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { ADVANCED_WORKFLOW_ACTION_APPROVE_AND_SELECT, ADVANCED_WORKFLOW_TASK_OPTION_APPROVE_AND_SELECT } from './../../../../workflowitems-edit-page/advanced-workflow-action/sedici-advanced-approve-and-select/advanced-approve-and-select.component';

Check failure on line 1 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

Imports must be broken into multiple lines if there are more than 1 elements

Check failure on line 1 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

Run autofix to sort these imports!

Check failure on line 1 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

Imports must be broken into multiple lines if there are more than 1 elements

Check failure on line 1 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

Run autofix to sort these imports!
import {
Component,
Injector,
Input,

Check failure on line 5 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

'Input' is defined but never used

Check failure on line 5 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

'Input' is defined but never used
} from '@angular/core';
import { Router, ActivatedRoute, NavigationExtras, } from '@angular/router';

Check failure on line 7 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

Imports must be broken into multiple lines if there are more than 1 elements

Check failure on line 7 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

'NavigationExtras' is defined but never used

Check failure on line 7 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

Unexpected trailing comma

Check failure on line 7 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

Imports must be broken into multiple lines if there are more than 1 elements

Check failure on line 7 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

'NavigationExtras' is defined but never used

Check failure on line 7 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

Unexpected trailing comma
import { TranslateService } from '@ngx-translate/core';
import {
Observable,

Check failure on line 10 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

'Observable' is defined but never used

Check failure on line 10 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

'Observable' is defined but never used
of,

Check failure on line 11 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

'of' is defined but never used

Check failure on line 11 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

'of' is defined but never used
} from 'rxjs';


import { RemoteData } from '../../../../core/data/remote-data';

Check failure on line 15 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

'RemoteData' is defined but never used

Check failure on line 15 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

'RemoteData' is defined but never used
import { RequestService } from '../../../../core/data/request.service';
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';

Check failure on line 17 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (16.x)

'DSpaceObject' is defined but never used

Check failure on line 17 in src/app/shared/mydspace-actions/claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

'DSpaceObject' is defined but never used
import { SearchService } from '../../../../core/shared/search/search.service';
import { NotificationsService } from '../../../notifications/notifications.service';
import { ClaimedApprovedTaskSearchResult } from '../../../object-collection/shared/claimed-approved-task-search-result.model';
import { AdvancedClaimedTaskActionsAbstractComponent } from '../abstract/advanced-claimed-task-actions-abstract.component';
import { rendersWorkflowTaskOption } from '../switcher/claimed-task-actions-decorator';
import { getAdvancedWorkflowRoute } from 'src/app/workflowitems-edit-page/workflowitems-edit-page-routing-paths';
import { WorkflowItem } from 'src/app/core/submission/models/workflowitem.model';
import { Item } from 'src/app/core/shared/item.model';

@rendersWorkflowTaskOption(ADVANCED_WORKFLOW_TASK_OPTION_APPROVE_AND_SELECT)
@Component({
selector: 'ds-claimed-task-actions-approve-and-select',
styleUrls: ['./claimed-task-actions-approve-and-select.component.scss'],
templateUrl: './claimed-task-actions-approve-and-select.component.html',
})
/**
* Component for displaying and processing the approve action on a workflow task item
*/
export class ClaimedTaskActionsApproveAndSelectComponent extends AdvancedClaimedTaskActionsAbstractComponent {
/**
* This component represents the approve option
*/

option = ADVANCED_WORKFLOW_TASK_OPTION_APPROVE_AND_SELECT;

workflowType = ADVANCED_WORKFLOW_ACTION_APPROVE_AND_SELECT;

constructor(protected injector: Injector,
protected router: Router,
protected notificationsService: NotificationsService,
protected translate: TranslateService,
protected searchService: SearchService,
protected requestService: RequestService,
protected route: ActivatedRoute,) {
super(injector, router, notificationsService, translate, searchService, requestService, route);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<button (click)="openAdvancedClaimedTaskTab()" class="selectCollectionAction btn btn-primary"
ngbTooltip="{{ 'submission.workflow.generic.' + option + '-help' | translate }}">
<i class="fa fa-user"></i> {{ 'submission.workflow.generic.' + option | translate}}
</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import {
Observable,
of,
} from 'rxjs';
import {
Component,
Injector,
} from '@angular/core';
import {
Router,
ActivatedRoute,
} from '@angular/router';
import { TranslateService } from '@ngx-translate/core';


import {
ADVANCED_WORKFLOW_ACTION_SELECT_COLLECTION,
ADVANCED_WORKFLOW_TASK_OPTION_SELECT_COLLECTION
} from 'src/app/workflowitems-edit-page/advanced-workflow-action/sedici-advanced-workflow-select-collection/workflow-select-collection.component';
import { RequestService } from '../../../../core/data/request.service';
import { SearchService } from '../../../../core/shared/search/search.service';
import { NotificationsService } from '../../../notifications/notifications.service';
import { AdvancedClaimedTaskActionsAbstractComponent } from '../abstract/advanced-claimed-task-actions-abstract.component';
import { rendersWorkflowTaskOption } from '../switcher/claimed-task-actions-decorator';


@rendersWorkflowTaskOption(ADVANCED_WORKFLOW_TASK_OPTION_SELECT_COLLECTION)
@Component({
selector: 'ds-claimed-task-actions-select-collection',
styleUrls: ['./claimed-task-actions-select-collection.component.scss'],
templateUrl: './claimed-task-actions-select-collection.component.html',
})
/**
* Component for displaying the edit metadata action on a workflow task item
*/
export class ClaimedTaskActionsSelectCollectionComponent extends AdvancedClaimedTaskActionsAbstractComponent {

workflowType = ADVANCED_WORKFLOW_ACTION_SELECT_COLLECTION;
/**
* This component represents the edit metadata option
*/
option = ADVANCED_WORKFLOW_TASK_OPTION_SELECT_COLLECTION;

constructor(protected injector: Injector,
protected router: Router,
protected notificationsService: NotificationsService,
protected translate: TranslateService,
protected searchService: SearchService,
protected requestService: RequestService,
protected route: ActivatedRoute,
) {
super(injector, router, notificationsService, translate, searchService, requestService, route);
}

// ngOnInit(): void {
// this.collectionDataService.findByHref(`${environment.rest.baseUrl}/api/core/collections/${this.workflowitem.sections.collection}`).subscribe(collection => {
// this.originalCollection = collection?.payload;
// this.selectedCollection = this.originalCollection;
// this.selectedCollectionName = this.selectedCollection.name;
// });
// }

}
4 changes: 4 additions & 0 deletions src/app/shared/mydspace-actions/mydspace-actions.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { ClaimedTaskActionsEditMetadataComponent } from './claimed-task/edit-met
import { ClaimedTaskActionsRejectComponent } from './claimed-task/reject/claimed-task-actions-reject.component';
import { ClaimedTaskActionsReturnToPoolComponent } from './claimed-task/return-to-pool/claimed-task-actions-return-to-pool.component';
import { ClaimedTaskActionsLoaderComponent } from './claimed-task/switcher/claimed-task-actions-loader.component';
import { ClaimedTaskActionsSelectCollectionComponent } from './claimed-task/sedici-select-collection/claimed-task-actions-select-collection.component';
import { ClaimedTaskActionsApproveAndSelectComponent } from './claimed-task/sedici-approve-and-select/claimed-task-actions-approve-and-select.component';
import { ItemActionsComponent } from './item/item-actions.component';
import { PoolTaskActionsComponent } from './pool-task/pool-task-actions.component';
import { WorkflowitemActionsComponent } from './workflowitem/workflowitem-actions.component';
Expand All @@ -25,6 +27,8 @@ const ENTRY_COMPONENTS = [
ClaimedTaskActionsRejectComponent,
ClaimedTaskActionsReturnToPoolComponent,
ClaimedTaskActionsEditMetadataComponent,
ClaimedTaskActionsSelectCollectionComponent,
ClaimedTaskActionsApproveAndSelectComponent,
];

const DECLARATIONS = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
(click)="deposit($event)">
<span><i class="fas fa-plus"></i> {{'submission.general.deposit' | translate}}</span>
</button>
<button *ngIf="(showDepositAndDiscard | async) !== true"
ngbTooltip="{{ 'accept-and-select-collection-help' | translate }}"
class="selectCollectionAction btn btn-primary"
(click)="redirect()">
{{'accept-and-select-collection' | translate}}
</button>
</div>
</div>
</div>
Expand Down
62 changes: 60 additions & 2 deletions src/app/submission/form/footer/submission-form-footer.component.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
import { WorkflowItemDataService } from './../../../core/submission/workflowitem-data.service';
import {
Component,
Input,
Output,
OnChanges,
SimpleChanges,
EventEmitter,
} from '@angular/core';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import {
Observable,
of as observableOf,
EMPTY,
BehaviorSubject,
} from 'rxjs';
import { map } from 'rxjs/operators';
import {
Router,
NavigationExtras,
} from '@angular/router';
import {
map,
mergeMap,
tap,
} from 'rxjs/operators';

import { SubmissionRestService } from '../../../core/submission/submission-rest.service';
import { SubmissionScopeType } from '../../../core/submission/submission-scope-type';
import { isNotEmpty } from '../../../shared/empty.util';
import { SubmissionService } from '../../submission.service';
import { WorkflowItem } from 'src/app/core/submission/models/workflowitem.model';
import { ClaimedTask } from 'src/app/core/tasks/models/claimed-task-object.model';
import { ClaimedTaskDataService } from 'src/app/core/tasks/claimed-task-data.service';
import { getFirstCompletedRemoteData, getFirstSucceededRemoteData } from 'src/app/core/shared/operators';
import { Item } from 'src/app/core/shared/item.model';
import { MyDSpaceActionsResult } from 'src/app/shared/mydspace-actions/mydspace-actions';
import { RemoteData } from 'src/app/core/data/remote-data';
import { LinkService } from 'src/app/core/cache/builders/link.service';
import { followLink } from 'src/app/shared/utils/follow-link-config.model';
import { getAdvancedWorkflowRoute } from 'src/app/workflowitems-edit-page/workflowitems-edit-page-routing-paths';

/**
* This component represents submission form footer bar.
Expand All @@ -32,6 +55,8 @@ export class SubmissionFormFooterComponent implements OnChanges {
*/
@Input() submissionId: string;

@Input() item: Item;

/**
* A boolean representing if a submission deposit operation is pending
* @type {Observable<boolean>}
Expand Down Expand Up @@ -61,6 +86,12 @@ export class SubmissionFormFooterComponent implements OnChanges {
*/
public hasUnsavedModification: Observable<boolean>;

public wfi: WorkflowItem;

public ctobject: ClaimedTask;

@Output() processCompleted = new EventEmitter<MyDSpaceActionsResult>();

/**
* Initialize instance variables
*
Expand All @@ -70,9 +101,16 @@ export class SubmissionFormFooterComponent implements OnChanges {
*/
constructor(private modalService: NgbModal,
private restService: SubmissionRestService,
private submissionService: SubmissionService) {
private submissionService: SubmissionService,
private wfService: WorkflowItemDataService,
private ctService: ClaimedTaskDataService,
protected linkService: LinkService,
private router: Router ) {
}

ngInit(){
}

/**
* Initialize all instance variables
*/
Expand All @@ -82,6 +120,16 @@ export class SubmissionFormFooterComponent implements OnChanges {
map((isValid: boolean) => isValid === false),
);

if (!this.showDepositAndDiscard){
this.wfService.findById(this.submissionId).subscribe(workflowItem =>{
this.wfi = workflowItem.payload; // Esto asume que payload es de tipo WorkflowIte
})
this.ctService.findByItem(this.item.uuid).subscribe(claimedTask =>{
this.ctobject = claimedTask.payload;
});
}


this.processingSaveStatus = this.submissionService.getSubmissionSaveProcessingStatus(this.submissionId);
this.processingDepositStatus = this.submissionService.getSubmissionDepositProcessingStatus(this.submissionId);
this.showDepositAndDiscard = observableOf(this.submissionService.getSubmissionScope() === SubmissionScopeType.WorkspaceItem);
Expand All @@ -96,6 +144,16 @@ export class SubmissionFormFooterComponent implements OnChanges {
this.submissionService.dispatchSave(this.submissionId, true);
}

redirect(){
const navigationExtras: NavigationExtras = {
queryParams:{
workflow: 'editaction',
claimedTask: this.ctobject.id,
}
};
this.router.navigate([getAdvancedWorkflowRoute(this.wfi.id)], navigationExtras);
}

/**
* Dispatch a submission save for later action
*/
Expand Down
2 changes: 1 addition & 1 deletion src/app/submission/form/submission-form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</ng-container>
</div>
<div *ngIf="(isLoading() | async) !== true" class="submission-form-footer mt-3 mb-3 position-sticky">
<ds-submission-form-footer [submissionId]="submissionId"></ds-submission-form-footer>
<ds-submission-form-footer [submissionId]="submissionId" [item]="item"></ds-submission-form-footer>
</div>
</div>

2 changes: 2 additions & 0 deletions src/app/submission/submission.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import {
} from './submission.reducers';
import { SubmissionSubmitComponent } from './submit/submission-submit.component';
import { ThemedSubmissionSubmitComponent } from './submit/themed-submission-submit.component';
import { MyDSpaceActionsModule } from '../shared/mydspace-actions/mydspace-actions.module';

const ENTRY_COMPONENTS = [
// put only entry components that use custom decorator
Expand Down Expand Up @@ -129,6 +130,7 @@ const DECLARATIONS = [
NgbAccordionModule,
UploadModule,
NgOptimizedImage,
MyDSpaceActionsModule,
],
declarations: DECLARATIONS,
exports: [
Expand Down
Loading

0 comments on commit 0d142a5

Please sign in to comment.