[CST-6876] Refactoring workflow actions components in order to pass item and workflowitem objects down from paren search element component to children

This commit is contained in:
Giuseppe Digilio
2022-10-04 14:47:07 +02:00
parent ec375fb910
commit d8c8a43da4
22 changed files with 332 additions and 148 deletions

View File

@@ -15,6 +15,8 @@ import { ClaimedTaskActionsAbstractComponent } from '../abstract/claimed-task-ac
import { hasValue } from '../../../empty.util';
import { Subscription } from 'rxjs';
import { MyDSpaceActionsResult } from '../../mydspace-actions';
import { Item } from '../../../../core/shared/item.model';
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
@Component({
selector: 'ds-claimed-task-actions-loader',
@@ -25,6 +27,11 @@ import { MyDSpaceActionsResult } from '../../mydspace-actions';
* Passes on the ClaimedTask to the component and subscribes to the processCompleted output
*/
export class ClaimedTaskActionsLoaderComponent implements OnInit, OnDestroy {
/**
* The item object that belonging to the ClaimedTask object
*/
@Input() item: Item;
/**
* The ClaimedTask object
*/
@@ -36,6 +43,11 @@ export class ClaimedTaskActionsLoaderComponent implements OnInit, OnDestroy {
*/
@Input() option: string;
/**
* The workflowitem object that belonging to the ClaimedTask object
*/
@Input() workflowitem: WorkflowItem;
/**
* Emits the success or failure of a processed action
*/
@@ -69,7 +81,9 @@ export class ClaimedTaskActionsLoaderComponent implements OnInit, OnDestroy {
const componentRef = viewContainerRef.createComponent(componentFactory);
const componentInstance = (componentRef.instance as ClaimedTaskActionsAbstractComponent);
componentInstance.item = this.item;
componentInstance.object = this.object;
componentInstance.workflowitem = this.workflowitem;
if (hasValue(componentInstance.processCompleted)) {
this.subs.push(componentInstance.processCompleted.subscribe((result) => this.processCompleted.emit(result)));
}