mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 21:43:04 +00:00
[CSTPER-3620] Workflow Actions refresh entire MyDSpace page instead of just WorkflowItem
Merge cache part 2
This commit is contained in:
@@ -119,7 +119,11 @@ export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
||||
options.searchParams = [
|
||||
new RequestParam('uuid', uuid)
|
||||
];
|
||||
return this.searchTask('findByItem', options, followLink('workflowitem'))
|
||||
return this.searchTask('findByItem', options, followLink('workflowitem',
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
true))
|
||||
.pipe(getFirstSucceededRemoteData());
|
||||
}
|
||||
|
||||
|
@@ -71,7 +71,11 @@ export class PoolTaskDataService extends TasksService<PoolTask> {
|
||||
options.searchParams = [
|
||||
new RequestParam('uuid', uuid)
|
||||
];
|
||||
return this.searchTask('findByItem', options, followLink('workflowitem'))
|
||||
return this.searchTask('findByItem', options, followLink('workflowitem',
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
true))
|
||||
.pipe(getFirstSucceededRemoteData());
|
||||
}
|
||||
|
||||
|
@@ -131,14 +131,19 @@ export abstract class TasksService<T extends CacheableObject> extends DataServic
|
||||
* links to follow
|
||||
*/
|
||||
public searchTask(searchMethod: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<T>> {
|
||||
const correlationId = Math.floor(Math.random() * 1000);
|
||||
const hrefObs = this.getSearchByHref(searchMethod, options, ...linksToFollow);
|
||||
return hrefObs.pipe(
|
||||
tap(href => console.log('CorrelationId: ' + correlationId, 'SearchTaskHref', href)),
|
||||
find((href: string) => hasValue(href)),
|
||||
switchMap((href) => this.findByHref(href).pipe(
|
||||
switchMap((href) => this.findByHref(href, false, true).pipe(
|
||||
getFirstSucceededRemoteData(),
|
||||
tap(() => {
|
||||
this.requestService.setStaleByHrefSubstring(searchMethod);
|
||||
}))),
|
||||
tap((response) => {
|
||||
console.log('CorrelationId: ' + correlationId, 'SearchTaskResponse', response.payload);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import {Component, Injector, Input, OnDestroy, OnInit} from '@angular/core';
|
||||
import { Component, Injector, Input, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -26,7 +26,7 @@ import { WORKFLOW_TASK_OPTION_RETURN_TO_POOL } from './return-to-pool/claimed-ta
|
||||
styleUrls: ['./claimed-task-actions.component.scss'],
|
||||
templateUrl: './claimed-task-actions.component.html',
|
||||
})
|
||||
export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent<ClaimedTask, ClaimedTaskDataService> implements OnInit, OnDestroy {
|
||||
export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent<ClaimedTask, ClaimedTaskDataService> implements OnInit {
|
||||
|
||||
/**
|
||||
* The ClaimedTask object
|
||||
@@ -100,8 +100,4 @@ export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent<Claime
|
||||
this.actionRD$ = object.action;
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
console.log('Destroy of ClaimedTaskActionComponent', this.object);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ 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 { tap } from 'rxjs/internal/operators/tap';
|
||||
|
||||
export const WORKFLOW_TASK_OPTION_RETURN_TO_POOL = 'return_to_pool';
|
||||
|
||||
@@ -41,9 +40,7 @@ export class ClaimedTaskActionsReturnToPoolComponent extends ClaimedTaskActionsA
|
||||
}
|
||||
|
||||
reloadObjectExecution(): Observable<RemoteData<DSpaceObject> | DSpaceObject> {
|
||||
return this.poolTaskService.findByItem(this.itemUuid).pipe(take(1), tap((value) => {
|
||||
console.log('The new PoolTask (found by item) is:', value);
|
||||
}));
|
||||
return this.poolTaskService.findByItem(this.itemUuid).pipe(take(1));
|
||||
}
|
||||
|
||||
actionExecution(): Observable<any> {
|
||||
|
@@ -53,7 +53,6 @@ export abstract class MyDSpaceReloadableActionsComponent<T extends DSpaceObject,
|
||||
ngOnInit() {
|
||||
this.initReloadAnchor();
|
||||
this.initObjects(this.object);
|
||||
console.log('OnInit ReloadableAction', this.object, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +71,6 @@ export abstract class MyDSpaceReloadableActionsComponent<T extends DSpaceObject,
|
||||
(reloadedObject) => {
|
||||
this.processing$.next(false);
|
||||
this.handleReloadableActionResponse(res.hasSucceeded, reloadedObject);
|
||||
return reloadedObject;
|
||||
})
|
||||
);
|
||||
} else {
|
||||
|
@@ -19,7 +19,6 @@ import { Item } from '../../../core/shared/item.model';
|
||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import { MyDSpaceReloadableActionsComponent } from '../mydspace-reloadable-actions';
|
||||
import { ProcessTaskResponse } from '../../../core/tasks/models/process-task-response';
|
||||
import { tap } from 'rxjs/internal/operators/tap';
|
||||
|
||||
/**
|
||||
* This component represents mydspace actions related to PoolTask object.
|
||||
@@ -96,9 +95,7 @@ export class PoolTaskActionsComponent extends MyDSpaceReloadableActionsComponent
|
||||
}
|
||||
|
||||
reloadObjectExecution(): Observable<RemoteData<DSpaceObject> | DSpaceObject> {
|
||||
return this.claimedTaskService.findByItem(this.itemUuid).pipe(take(1), tap((value) => {
|
||||
console.log('The new ClaimTask (found by item) is:', value);
|
||||
}));
|
||||
return this.claimedTaskService.findByItem(this.itemUuid).pipe(take(1));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +113,6 @@ export class PoolTaskActionsComponent extends MyDSpaceReloadableActionsComponent
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subs.forEach((sub) => sub.unsubscribe());
|
||||
console.log('Destroy of PoolTaskActionsComponent', this.object);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -51,9 +51,17 @@ export class ClaimedApprovedSearchResultListElementComponent extends SearchResul
|
||||
*/
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.linkService.resolveLinks(this.dso, followLink('workflowitem', null, true,
|
||||
followLink('item'), followLink('submitter')
|
||||
), followLink('action'));
|
||||
this.linkService.resolveLinks(this.dso,
|
||||
followLink('workflowitem',
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
followLink('item'),
|
||||
followLink('submitter')
|
||||
),
|
||||
followLink('action')
|
||||
);
|
||||
this.workflowitemRD$ = this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>;
|
||||
}
|
||||
|
||||
|
@@ -52,9 +52,16 @@ export class ClaimedDeclinedSearchResultListElementComponent extends SearchResul
|
||||
*/
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.linkService.resolveLinks(this.dso, followLink('workflowitem', null, true,
|
||||
followLink('item'), followLink('submitter')
|
||||
), followLink('action'));
|
||||
this.linkService.resolveLinks(this.dso,
|
||||
followLink('workflowitem',
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
followLink('item'),
|
||||
followLink('submitter')
|
||||
),
|
||||
followLink('action'));
|
||||
this.workflowitemRD$ = this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user