mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 14:03:06 +00:00
[CSTPER-3620] Workflow Actions refresh entire MyDSpace page instead of just WorkflowItem
Fixes and debug log
This commit is contained in:
@@ -20,6 +20,7 @@ import { followLink } from '../../shared/utils/follow-link-config.model';
|
|||||||
import { FindListOptions } from '../data/request.models';
|
import { FindListOptions } from '../data/request.models';
|
||||||
import { RequestParam } from '../cache/models/request-param.model';
|
import { RequestParam } from '../cache/models/request-param.model';
|
||||||
import { HttpOptions } from '../dspace-rest/dspace-rest.service';
|
import { HttpOptions } from '../dspace-rest/dspace-rest.service';
|
||||||
|
import { getFirstSucceededRemoteData } from '../shared/operators';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The service handling all REST requests for ClaimedTask
|
* The service handling all REST requests for ClaimedTask
|
||||||
@@ -28,7 +29,7 @@ import { HttpOptions } from '../dspace-rest/dspace-rest.service';
|
|||||||
@dataService(CLAIMED_TASK)
|
@dataService(CLAIMED_TASK)
|
||||||
export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
||||||
|
|
||||||
protected responseMsToLive = 10 * 1000;
|
protected responseMsToLive = 1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The endpoint link name
|
* The endpoint link name
|
||||||
@@ -68,6 +69,8 @@ export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
|||||||
* Emit the server response
|
* Emit the server response
|
||||||
*/
|
*/
|
||||||
public claimTask(scopeId: string, poolTaskHref: string): Observable<ProcessTaskResponse> {
|
public claimTask(scopeId: string, poolTaskHref: string): Observable<ProcessTaskResponse> {
|
||||||
|
console.log('==========================================');
|
||||||
|
console.log('User ClaimTask request for:', scopeId, poolTaskHref);
|
||||||
const options: HttpOptions = Object.create({});
|
const options: HttpOptions = Object.create({});
|
||||||
let headers = new HttpHeaders();
|
let headers = new HttpHeaders();
|
||||||
headers = headers.append('Content-Type', 'text/uri-list');
|
headers = headers.append('Content-Type', 'text/uri-list');
|
||||||
@@ -98,6 +101,8 @@ export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
|||||||
* Emit the server response
|
* Emit the server response
|
||||||
*/
|
*/
|
||||||
public returnToPoolTask(scopeId: string): Observable<ProcessTaskResponse> {
|
public returnToPoolTask(scopeId: string): Observable<ProcessTaskResponse> {
|
||||||
|
console.log('==========================================');
|
||||||
|
console.log('User ReturnToPool request for:', scopeId);
|
||||||
return this.deleteById(this.linkPath, scopeId, this.makeHttpOptions());
|
return this.deleteById(this.linkPath, scopeId, this.makeHttpOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,11 +114,13 @@ export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
|||||||
* The server response
|
* The server response
|
||||||
*/
|
*/
|
||||||
public findByItem(uuid: string): Observable<RemoteData<ClaimedTask>> {
|
public findByItem(uuid: string): Observable<RemoteData<ClaimedTask>> {
|
||||||
|
console.log('claimedTaskService findByItem', uuid);
|
||||||
const options = new FindListOptions();
|
const options = new FindListOptions();
|
||||||
options.searchParams = [
|
options.searchParams = [
|
||||||
new RequestParam('uuid', uuid)
|
new RequestParam('uuid', uuid)
|
||||||
];
|
];
|
||||||
return this.searchTask('findByItem', options, followLink('workflowitem'));
|
return this.searchTask('findByItem', options, followLink('workflowitem'))
|
||||||
|
.pipe(getFirstSucceededRemoteData());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@ import { RemoteData } from '../data/remote-data';
|
|||||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||||
import { FindListOptions } from '../data/request.models';
|
import { FindListOptions } from '../data/request.models';
|
||||||
import { RequestParam } from '../cache/models/request-param.model';
|
import { RequestParam } from '../cache/models/request-param.model';
|
||||||
|
import { getFirstSucceededRemoteData } from '../shared/operators';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The service handling all REST requests for PoolTask
|
* The service handling all REST requests for PoolTask
|
||||||
@@ -31,7 +32,7 @@ export class PoolTaskDataService extends TasksService<PoolTask> {
|
|||||||
*/
|
*/
|
||||||
protected linkPath = 'pooltasks';
|
protected linkPath = 'pooltasks';
|
||||||
|
|
||||||
protected responseMsToLive = 10 * 1000;
|
protected responseMsToLive = 1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize instance variables
|
* Initialize instance variables
|
||||||
@@ -70,7 +71,8 @@ export class PoolTaskDataService extends TasksService<PoolTask> {
|
|||||||
options.searchParams = [
|
options.searchParams = [
|
||||||
new RequestParam('uuid', uuid)
|
new RequestParam('uuid', uuid)
|
||||||
];
|
];
|
||||||
return this.searchTask('findByItem', options, followLink('workflowitem'));
|
return this.searchTask('findByItem', options, followLink('workflowitem'))
|
||||||
|
.pipe(getFirstSucceededRemoteData());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -13,7 +13,7 @@ import {
|
|||||||
} from '../data/request.models';
|
} from '../data/request.models';
|
||||||
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
||||||
import { ProcessTaskResponse } from './models/process-task-response';
|
import { ProcessTaskResponse } from './models/process-task-response';
|
||||||
import { getFirstCompletedRemoteData } from '../shared/operators';
|
import {getFirstCompletedRemoteData, getFirstSucceededRemoteData} from '../shared/operators';
|
||||||
import { CacheableObject } from '../cache/object-cache.reducer';
|
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||||
import { RemoteData } from '../data/remote-data';
|
import { RemoteData } from '../data/remote-data';
|
||||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||||
@@ -140,7 +140,11 @@ export abstract class TasksService<T extends CacheableObject> extends DataServic
|
|||||||
const hrefObs = this.getSearchByHref(searchMethod, options, ...linksToFollow);
|
const hrefObs = this.getSearchByHref(searchMethod, options, ...linksToFollow);
|
||||||
return hrefObs.pipe(
|
return hrefObs.pipe(
|
||||||
find((href: string) => hasValue(href)),
|
find((href: string) => hasValue(href)),
|
||||||
switchMap((href) => this.findByHref(href))
|
switchMap((href) => this.findByHref(href).pipe(
|
||||||
|
getFirstSucceededRemoteData(),
|
||||||
|
tap(() => {
|
||||||
|
this.requestService.setStaleByHrefSubstring(searchMethod)
|
||||||
|
}))),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Injector } from '@angular/core';
|
import {Injector, OnDestroy} from '@angular/core';
|
||||||
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
||||||
import { ClaimedTaskDataService } from '../../../../core/tasks/claimed-task-data.service';
|
import { ClaimedTaskDataService } from '../../../../core/tasks/claimed-task-data.service';
|
||||||
import { DSpaceObject} from '../../../../core/shared/dspace-object.model';
|
import { DSpaceObject} from '../../../../core/shared/dspace-object.model';
|
||||||
@@ -10,7 +10,7 @@ import { RequestService} from '../../../../core/data/request.service';
|
|||||||
import { Observable} from 'rxjs';
|
import { Observable} from 'rxjs';
|
||||||
import { RemoteData} from '../../../../core/data/remote-data';
|
import { RemoteData} from '../../../../core/data/remote-data';
|
||||||
import { WorkflowItem} from '../../../../core/submission/models/workflowitem.model';
|
import { WorkflowItem} from '../../../../core/submission/models/workflowitem.model';
|
||||||
import { switchMap } from 'rxjs/operators';
|
import {switchMap, take} from 'rxjs/operators';
|
||||||
import { CLAIMED_TASK } from '../../../../core/tasks/models/claimed-task-object.resource-type';
|
import { CLAIMED_TASK } from '../../../../core/tasks/models/claimed-task-object.resource-type';
|
||||||
import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators';
|
import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
@@ -23,7 +23,7 @@ import { MyDSpaceReloadableActionsComponent } from '../../mydspace-reloadable-ac
|
|||||||
* - Add a @rendersWorkflowTaskOption annotation to your component providing the same enum value
|
* - Add a @rendersWorkflowTaskOption annotation to your component providing the same enum value
|
||||||
* - Optionally overwrite createBody if the request body requires more than just the option
|
* - Optionally overwrite createBody if the request body requires more than just the option
|
||||||
*/
|
*/
|
||||||
export abstract class ClaimedTaskActionsAbstractComponent extends MyDSpaceReloadableActionsComponent<ClaimedTask, ClaimedTaskDataService> {
|
export abstract class ClaimedTaskActionsAbstractComponent extends MyDSpaceReloadableActionsComponent<ClaimedTask, ClaimedTaskDataService> implements OnDestroy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The workflow task option the child component represents
|
* The workflow task option the child component represents
|
||||||
@@ -37,6 +37,8 @@ export abstract class ClaimedTaskActionsAbstractComponent extends MyDSpaceReload
|
|||||||
*/
|
*/
|
||||||
itemUuid: string;
|
itemUuid: string;
|
||||||
|
|
||||||
|
subs = [];
|
||||||
|
|
||||||
protected constructor(protected injector: Injector,
|
protected constructor(protected injector: Injector,
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
@@ -50,7 +52,7 @@ export abstract class ClaimedTaskActionsAbstractComponent extends MyDSpaceReload
|
|||||||
* Submit the action on the claimed object.
|
* Submit the action on the claimed object.
|
||||||
*/
|
*/
|
||||||
submitTask() {
|
submitTask() {
|
||||||
this.startActionExecution().subscribe();
|
this.subs.push(this.startActionExecution().pipe(take(1)).subscribe());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,13 +84,17 @@ export abstract class ClaimedTaskActionsAbstractComponent extends MyDSpaceReload
|
|||||||
if (!(this.object as any).workflowitem) {
|
if (!(this.object as any).workflowitem) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.object.workflowitem.pipe(
|
this.subs.push(this.object.workflowitem.pipe(
|
||||||
getFirstSucceededRemoteDataPayload(),
|
getFirstSucceededRemoteDataPayload(),
|
||||||
switchMap((workflowItem: WorkflowItem) => workflowItem.item.pipe(getFirstSucceededRemoteDataPayload())
|
switchMap((workflowItem: WorkflowItem) => workflowItem.item.pipe(getFirstSucceededRemoteDataPayload())
|
||||||
))
|
))
|
||||||
.subscribe((item: Item) => {
|
.subscribe((item: Item) => {
|
||||||
this.itemUuid = item.uuid;
|
this.itemUuid = item.uuid;
|
||||||
})
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.subs.forEach((sub) => sub.unsubscribe());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import { Component, Injector, Input, OnInit } from '@angular/core';
|
import {Component, Injector, Input, OnDestroy, OnInit} from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { filter, map } from 'rxjs/operators';
|
import { filter, map, take } from 'rxjs/operators';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { ClaimedTaskDataService } from '../../../core/tasks/claimed-task-data.service';
|
import { ClaimedTaskDataService } from '../../../core/tasks/claimed-task-data.service';
|
||||||
@@ -26,7 +26,7 @@ import { WORKFLOW_TASK_OPTION_RETURN_TO_POOL } from './return-to-pool/claimed-ta
|
|||||||
styleUrls: ['./claimed-task-actions.component.scss'],
|
styleUrls: ['./claimed-task-actions.component.scss'],
|
||||||
templateUrl: './claimed-task-actions.component.html',
|
templateUrl: './claimed-task-actions.component.html',
|
||||||
})
|
})
|
||||||
export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent<ClaimedTask, ClaimedTaskDataService> implements OnInit {
|
export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent<ClaimedTask, ClaimedTaskDataService> implements OnInit, OnDestroy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ClaimedTask object
|
* The ClaimedTask object
|
||||||
@@ -87,7 +87,8 @@ export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent<Claime
|
|||||||
this.object = object;
|
this.object = object;
|
||||||
this.workflowitem$ = (this.object.workflowitem as Observable<RemoteData<WorkflowItem>>).pipe(
|
this.workflowitem$ = (this.object.workflowitem as Observable<RemoteData<WorkflowItem>>).pipe(
|
||||||
filter((rd: RemoteData<WorkflowItem>) => ((!rd.isRequestPending) && isNotUndefined(rd.payload))),
|
filter((rd: RemoteData<WorkflowItem>) => ((!rd.isRequestPending) && isNotUndefined(rd.payload))),
|
||||||
map((rd: RemoteData<WorkflowItem>) => rd.payload));
|
map((rd: RemoteData<WorkflowItem>) => rd.payload),
|
||||||
|
take(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,4 +100,8 @@ export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent<Claime
|
|||||||
this.actionRD$ = object.action;
|
this.actionRD$ = object.action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
console.log('Destroy of ClaimedTaskActionComponent', this.object)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,8 @@ import { RequestService } from '../../../../core/data/request.service';
|
|||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||||
import { PoolTaskDataService } from '../../../../core/tasks/pool-task-data.service';
|
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';
|
export const WORKFLOW_TASK_OPTION_RETURN_TO_POOL = 'return_to_pool';
|
||||||
|
|
||||||
@@ -39,7 +41,9 @@ export class ClaimedTaskActionsReturnToPoolComponent extends ClaimedTaskActionsA
|
|||||||
}
|
}
|
||||||
|
|
||||||
reloadObjectExecution(): Observable<RemoteData<DSpaceObject> | DSpaceObject> {
|
reloadObjectExecution(): Observable<RemoteData<DSpaceObject> | DSpaceObject> {
|
||||||
return this.poolTaskService.findByItem(this.itemUuid);
|
return this.poolTaskService.findByItem(this.itemUuid).pipe(take(1), tap((value) => {
|
||||||
|
console.log('The new PoolTask (found by item) is:', value);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
actionExecution(): Observable<any> {
|
actionExecution(): Observable<any> {
|
||||||
|
@@ -82,6 +82,8 @@ export abstract class MyDSpaceActionsComponent<T extends DSpaceObject, TService
|
|||||||
* Refresh current page
|
* Refresh current page
|
||||||
*/
|
*/
|
||||||
reload(): void {
|
reload(): void {
|
||||||
|
debugger;
|
||||||
|
|
||||||
this.router.navigated = false;
|
this.router.navigated = false;
|
||||||
const url = decodeURIComponent(this.router.url);
|
const url = decodeURIComponent(this.router.url);
|
||||||
// override the route reuse strategy
|
// override the route reuse strategy
|
||||||
@@ -100,6 +102,8 @@ export abstract class MyDSpaceActionsComponent<T extends DSpaceObject, TService
|
|||||||
* Override the target object with a refreshed one
|
* Override the target object with a refreshed one
|
||||||
*/
|
*/
|
||||||
refresh(): void {
|
refresh(): void {
|
||||||
|
debugger;
|
||||||
|
|
||||||
// find object by id
|
// find object by id
|
||||||
this.objectDataService.findById(this.object.id).pipe(
|
this.objectDataService.findById(this.object.id).pipe(
|
||||||
find((rd: RemoteData<T>) => rd.hasSucceeded)
|
find((rd: RemoteData<T>) => rd.hasSucceeded)
|
||||||
@@ -115,6 +119,8 @@ export abstract class MyDSpaceActionsComponent<T extends DSpaceObject, TService
|
|||||||
* true on success, false otherwise
|
* true on success, false otherwise
|
||||||
*/
|
*/
|
||||||
handleActionResponse(result: boolean): void {
|
handleActionResponse(result: boolean): void {
|
||||||
|
debugger;
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
this.reload();
|
this.reload();
|
||||||
this.notificationsService.success(null,
|
this.notificationsService.success(null,
|
||||||
|
@@ -18,6 +18,7 @@ import { ProcessTaskResponse } from '../../core/tasks/models/process-task-respon
|
|||||||
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
|
||||||
import { getSearchResultFor } from '../search/search-result-element-decorator';
|
import { getSearchResultFor } from '../search/search-result-element-decorator';
|
||||||
import { MyDSpaceActionsComponent } from './mydspace-actions';
|
import { MyDSpaceActionsComponent } from './mydspace-actions';
|
||||||
|
import {Subscription} from 'rxjs/internal/Subscription';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class for all different representations of mydspace actions
|
* Abstract class for all different representations of mydspace actions
|
||||||
@@ -49,6 +50,7 @@ export abstract class MyDSpaceReloadableActionsComponent<T extends DSpaceObject,
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.initReloadAnchor();
|
this.initReloadAnchor();
|
||||||
this.initObjects(this.object);
|
this.initObjects(this.object);
|
||||||
|
console.log('OnInit ReloadableAction', this.object, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import { Component, Injector, Input } from '@angular/core';
|
import {Component, Injector, Input, OnDestroy} from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { filter, map, switchMap } from 'rxjs/operators';
|
import {filter, map, switchMap, take} from 'rxjs/operators';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
|
import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
|
||||||
@@ -19,6 +19,7 @@ import { Item } from '../../../core/shared/item.model';
|
|||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
import { MyDSpaceReloadableActionsComponent } from '../mydspace-reloadable-actions';
|
import { MyDSpaceReloadableActionsComponent } from '../mydspace-reloadable-actions';
|
||||||
import { ProcessTaskResponse } from '../../../core/tasks/models/process-task-response';
|
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.
|
* This component represents mydspace actions related to PoolTask object.
|
||||||
@@ -28,7 +29,7 @@ import { ProcessTaskResponse } from '../../../core/tasks/models/process-task-res
|
|||||||
styleUrls: ['./pool-task-actions.component.scss'],
|
styleUrls: ['./pool-task-actions.component.scss'],
|
||||||
templateUrl: './pool-task-actions.component.html',
|
templateUrl: './pool-task-actions.component.html',
|
||||||
})
|
})
|
||||||
export class PoolTaskActionsComponent extends MyDSpaceReloadableActionsComponent<PoolTask, PoolTaskDataService> {
|
export class PoolTaskActionsComponent extends MyDSpaceReloadableActionsComponent<PoolTask, PoolTaskDataService> implements OnDestroy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PoolTask object
|
* The PoolTask object
|
||||||
@@ -45,6 +46,8 @@ export class PoolTaskActionsComponent extends MyDSpaceReloadableActionsComponent
|
|||||||
*/
|
*/
|
||||||
public itemUuid: string;
|
public itemUuid: string;
|
||||||
|
|
||||||
|
subs = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize instance variables
|
* Initialize instance variables
|
||||||
*
|
*
|
||||||
@@ -69,7 +72,7 @@ export class PoolTaskActionsComponent extends MyDSpaceReloadableActionsComponent
|
|||||||
* Claim the task.
|
* Claim the task.
|
||||||
*/
|
*/
|
||||||
claim() {
|
claim() {
|
||||||
this.startActionExecution().subscribe();
|
this.subs.push(this.startActionExecution().pipe(take(1)).subscribe());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,7 +84,8 @@ export class PoolTaskActionsComponent extends MyDSpaceReloadableActionsComponent
|
|||||||
this.object = object;
|
this.object = object;
|
||||||
this.workflowitem$ = (this.object.workflowitem as Observable<RemoteData<WorkflowItem>>).pipe(
|
this.workflowitem$ = (this.object.workflowitem as Observable<RemoteData<WorkflowItem>>).pipe(
|
||||||
filter((rd: RemoteData<WorkflowItem>) => ((!rd.isRequestPending) && isNotUndefined(rd.payload))),
|
filter((rd: RemoteData<WorkflowItem>) => ((!rd.isRequestPending) && isNotUndefined(rd.payload))),
|
||||||
map((rd: RemoteData<WorkflowItem>) => rd.payload));
|
map((rd: RemoteData<WorkflowItem>) => rd.payload),
|
||||||
|
take(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
actionExecution(): Observable<ProcessTaskResponse> {
|
actionExecution(): Observable<ProcessTaskResponse> {
|
||||||
@@ -92,7 +96,9 @@ export class PoolTaskActionsComponent extends MyDSpaceReloadableActionsComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
reloadObjectExecution(): Observable<RemoteData<DSpaceObject> | DSpaceObject> {
|
reloadObjectExecution(): Observable<RemoteData<DSpaceObject> | DSpaceObject> {
|
||||||
return this.claimedTaskService.findByItem(this.itemUuid);
|
return this.claimedTaskService.findByItem(this.itemUuid).pipe(take(1), tap((value) => {
|
||||||
|
console.log('The new ClaimTask (found by item) is:', value);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,4 +114,9 @@ export class PoolTaskActionsComponent extends MyDSpaceReloadableActionsComponent
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.subs.forEach((sub) => sub.unsubscribe());
|
||||||
|
console.log('Destroy of PoolTaskActionsComponent', this.object)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -135,6 +135,8 @@ export class ListableObjectComponentLoaderComponent implements OnInit, OnDestroy
|
|||||||
if ((componentRef.instance as any).reloadedObject) {
|
if ((componentRef.instance as any).reloadedObject) {
|
||||||
this.subs.push((componentRef.instance as any).reloadedObject.subscribe((reloadedObject: DSpaceObject) => {
|
this.subs.push((componentRef.instance as any).reloadedObject.subscribe((reloadedObject: DSpaceObject) => {
|
||||||
if (reloadedObject) {
|
if (reloadedObject) {
|
||||||
|
console.log('Reloaded Object from/to', this.object, reloadedObject);
|
||||||
|
this.object = reloadedObject;
|
||||||
this.instantiateComponent(reloadedObject);
|
this.instantiateComponent(reloadedObject);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
Reference in New Issue
Block a user