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
Task Service implementation. ReloadableAction abstraction.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Store } from '@ngrx/store';
|
||||
@@ -15,6 +15,11 @@ import { ClaimedTask } from './models/claimed-task-object.model';
|
||||
import { CLAIMED_TASK } from './models/claimed-task-object.resource-type';
|
||||
import { ProcessTaskResponse } from './models/process-task-response';
|
||||
import { TasksService } from './tasks.service';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||
import { FindListOptions } from '../data/request.models';
|
||||
import { RequestParam } from '../cache/models/request-param.model';
|
||||
import { HttpOptions } from '../dspace-rest/dspace-rest.service';
|
||||
|
||||
/**
|
||||
* The service handling all REST requests for ClaimedTask
|
||||
@@ -54,6 +59,22 @@ export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a request to claim the given task
|
||||
*
|
||||
* @param scopeId
|
||||
* The task id
|
||||
* @return {Observable<ProcessTaskResponse>}
|
||||
* Emit the server response
|
||||
*/
|
||||
public claimTask(scopeId: string, poolTaskHref: string): Observable<ProcessTaskResponse> {
|
||||
const options: HttpOptions = Object.create({});
|
||||
let headers = new HttpHeaders();
|
||||
headers = headers.append('Content-Type', 'text/uri-list');
|
||||
options.headers = headers;
|
||||
return this.postToEndpoint(this.linkPath, poolTaskHref, null, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a request for the given task
|
||||
*
|
||||
@@ -80,4 +101,19 @@ export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
||||
return this.deleteById(this.linkPath, scopeId, this.makeHttpOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Search a claimed task by item uuid.
|
||||
* @param uuid
|
||||
* The item uuid
|
||||
* @return {Observable<RemoteData<ClaimedTask>>}
|
||||
* The server response
|
||||
*/
|
||||
public findByItem(uuid: string): Observable<RemoteData<ClaimedTask>> {
|
||||
const options = new FindListOptions();
|
||||
options.searchParams = [
|
||||
new RequestParam('uuid', uuid)
|
||||
];
|
||||
return this.searchTask('findByItem', options, followLink('workflowitem'));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user