mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 13:03:04 +00:00
69305: Refactor workflow-actions to be resolved as HAL links
This commit is contained in:
@@ -13,6 +13,8 @@ import { HALLink } from '../../shared/hal-link.model';
|
||||
import { WorkflowItem } from '../../submission/models/workflowitem.model';
|
||||
import { TASK_OBJECT } from './task-object.resource-type';
|
||||
import { WORKFLOWITEM } from '../../eperson/models/workflowitem.resource-type';
|
||||
import { WORKFLOW_ACTION } from './workflow-action-object.resource-type';
|
||||
import { WorkflowAction } from './workflow-action-object.model';
|
||||
|
||||
/**
|
||||
* An abstract model class for a TaskObject.
|
||||
@@ -34,12 +36,6 @@ export class TaskObject extends DSpaceObject implements CacheableObject {
|
||||
@autoserialize
|
||||
step: string;
|
||||
|
||||
/**
|
||||
* The task action type
|
||||
*/
|
||||
@autoserialize
|
||||
action: string;
|
||||
|
||||
/**
|
||||
* The {@link HALLink}s for this TaskObject
|
||||
*/
|
||||
@@ -49,6 +45,7 @@ export class TaskObject extends DSpaceObject implements CacheableObject {
|
||||
owner: HALLink;
|
||||
group: HALLink;
|
||||
workflowitem: HALLink;
|
||||
action: HALLink;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -72,4 +69,11 @@ export class TaskObject extends DSpaceObject implements CacheableObject {
|
||||
@link(WORKFLOWITEM)
|
||||
workflowitem?: Observable<RemoteData<WorkflowItem>> | WorkflowItem;
|
||||
|
||||
/**
|
||||
* The task action type
|
||||
* Will be undefined unless the group {@link HALLink} has been resolved.
|
||||
*/
|
||||
@link(WORKFLOW_ACTION, false, 'action')
|
||||
action: Observable<RemoteData<WorkflowAction>>;
|
||||
|
||||
}
|
||||
|
@@ -96,7 +96,7 @@ export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent<Claime
|
||||
* @param object
|
||||
*/
|
||||
initAction(object: ClaimedTask) {
|
||||
this.actionRD$ = this.workflowActionService.findById(object.action);
|
||||
this.actionRD$ = object.action;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -84,7 +84,12 @@ describe('ClaimedTaskSearchResultDetailElementComponent', () => {
|
||||
|
||||
it('should init workflowitem properly', (done) => {
|
||||
component.workflowitemRD$.subscribe((workflowitemRD) => {
|
||||
expect(linkService.resolveLink).toHaveBeenCalled();
|
||||
// Make sure the necessary links are being resolved
|
||||
expect(linkService.resolveLinks).toHaveBeenCalledWith(
|
||||
component.dso,
|
||||
jasmine.objectContaining({ name: 'workflowitem' }),
|
||||
jasmine.objectContaining({ name: 'action' })
|
||||
);
|
||||
expect(workflowitemRD.payload).toEqual(workflowitem);
|
||||
done();
|
||||
});
|
||||
|
@@ -49,12 +49,12 @@ export class ClaimedTaskSearchResultDetailElementComponent extends SearchResultD
|
||||
*/
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.linkService.resolveLink(this.dso, followLink(
|
||||
this.linkService.resolveLinks(this.dso, followLink(
|
||||
'workflowitem',
|
||||
null,
|
||||
followLink('item', null, followLink('bundles')),
|
||||
followLink('submitter')
|
||||
));
|
||||
), followLink('action'));
|
||||
this.workflowitemRD$ = this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>;
|
||||
}
|
||||
|
||||
|
@@ -86,7 +86,11 @@ describe('PoolSearchResultDetailElementComponent', () => {
|
||||
|
||||
it('should init workflowitem properly', (done) => {
|
||||
component.workflowitemRD$.subscribe((workflowitemRD) => {
|
||||
expect(linkService.resolveLink).toHaveBeenCalled();
|
||||
expect(linkService.resolveLinks).toHaveBeenCalledWith(
|
||||
component.dso,
|
||||
jasmine.objectContaining({ name: 'workflowitem' }),
|
||||
jasmine.objectContaining({ name: 'action' })
|
||||
);
|
||||
expect(workflowitemRD.payload).toEqual(workflowitem);
|
||||
done();
|
||||
});
|
||||
|
@@ -48,12 +48,12 @@ export class PoolSearchResultDetailElementComponent extends SearchResultDetailEl
|
||||
*/
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.linkService.resolveLink(this.dso, followLink(
|
||||
this.linkService.resolveLinks(this.dso, followLink(
|
||||
'workflowitem',
|
||||
null,
|
||||
followLink('item', null, followLink('bundles')),
|
||||
followLink('submitter')
|
||||
));
|
||||
), followLink('action'));
|
||||
this.workflowitemRD$ = this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>;
|
||||
}
|
||||
|
||||
|
@@ -86,7 +86,11 @@ describe('ClaimedSearchResultListElementComponent', () => {
|
||||
|
||||
it('should init workflowitem properly', (done) => {
|
||||
component.workflowitemRD$.subscribe((workflowitemRD) => {
|
||||
expect(linkService.resolveLink).toHaveBeenCalled();
|
||||
expect(linkService.resolveLinks).toHaveBeenCalledWith(
|
||||
component.dso,
|
||||
jasmine.objectContaining({ name: 'workflowitem' }),
|
||||
jasmine.objectContaining({ name: 'action' })
|
||||
);
|
||||
expect(workflowitemRD.payload).toEqual(workflowitem);
|
||||
done();
|
||||
});
|
||||
|
@@ -55,12 +55,12 @@ export class ClaimedSearchResultListElementComponent extends SearchResultListEle
|
||||
*/
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.linkService.resolveLink(this.dso, followLink(
|
||||
this.linkService.resolveLinks(this.dso, followLink(
|
||||
'workflowitem',
|
||||
null,
|
||||
followLink('item'),
|
||||
followLink('submitter')
|
||||
));
|
||||
), followLink('action'));
|
||||
this.workflowitemRD$ = this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>;
|
||||
}
|
||||
}
|
||||
|
@@ -86,7 +86,11 @@ describe('PoolSearchResultListElementComponent', () => {
|
||||
|
||||
it('should init workflowitem properly', (done) => {
|
||||
component.workflowitemRD$.subscribe((workflowitemRD) => {
|
||||
expect(linkService.resolveLink).toHaveBeenCalled();
|
||||
expect(linkService.resolveLinks).toHaveBeenCalledWith(
|
||||
component.dso,
|
||||
jasmine.objectContaining({ name: 'workflowitem' }),
|
||||
jasmine.objectContaining({ name: 'action' })
|
||||
);
|
||||
expect(workflowitemRD.payload).toEqual(workflowitem);
|
||||
done();
|
||||
});
|
||||
|
@@ -58,12 +58,12 @@ export class PoolSearchResultListElementComponent extends SearchResultListElemen
|
||||
*/
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.linkService.resolveLink(this.dso, followLink(
|
||||
this.linkService.resolveLinks(this.dso, followLink(
|
||||
'workflowitem',
|
||||
null,
|
||||
followLink('item'),
|
||||
followLink('submitter')
|
||||
));
|
||||
), followLink('action'));
|
||||
this.workflowitemRD$ = this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user