mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-645] added claim and unclaim event for task details action (#3038)
* [ADF-645] added claim and unclaim event for task details action * [ADF-645] added new events to documentation
This commit is contained in:
@@ -46,6 +46,8 @@ Shows the details of the task id passed in input
|
||||
| error | `EventEmitter<any>` | Emitted when an error occurs. |
|
||||
| executeOutcome | `EventEmitter<any>` | Emitted when any outcome is executed. Default behaviour can be prevented via `event.preventDefault()`. |
|
||||
| assignTask | `EventEmitter<void>` | Emitted when a task is assigned. |
|
||||
| claimedTask | `EventEmitter<string>` | Emitted when a task is claimed. |
|
||||
| unClaimedTask | `EventEmitter<string>` | Emitted when a task is unclaimed. |
|
||||
|
||||
## Details
|
||||
|
||||
|
@@ -69,7 +69,7 @@
|
||||
[taskDetails]="taskDetails"
|
||||
[formName]="taskFormName"
|
||||
(claim)="onClaimAction($event)"
|
||||
(unclaim)="onClaimAction($event)">
|
||||
(unclaim)="onUnclaimAction($event)">
|
||||
</adf-task-header>
|
||||
<adf-people *ngIf="showInvolvePeople" #people
|
||||
[people]="taskPeople"
|
||||
|
@@ -108,6 +108,20 @@ describe('TaskDetailsComponent', () => {
|
||||
expect(getTaskDetailsSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should send a claim task event when a task is claimed', async(() => {
|
||||
component.claimedTask.subscribe((taskId) => {
|
||||
expect(taskId).toBe('FAKE-TASK-CLAIM');
|
||||
});
|
||||
component.onClaimAction('FAKE-TASK-CLAIM');
|
||||
}));
|
||||
|
||||
it('should send a unclaim task event when a task is unclaimed', async(() => {
|
||||
component.claimedTask.subscribe((taskId) => {
|
||||
expect(taskId).toBe('FAKE-TASK-UNCLAIM');
|
||||
});
|
||||
component.onUnclaimAction('FAKE-TASK-UNCLAIM');
|
||||
}));
|
||||
|
||||
it('should set a placeholder message when taskId not initialised', () => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.MESSAGES.NONE');
|
||||
|
@@ -160,6 +160,14 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
|
||||
@Output()
|
||||
assignTask: EventEmitter<void> = new EventEmitter<void>();
|
||||
|
||||
/** Emitted when a task is claimed. */
|
||||
@Output()
|
||||
claimedTask: EventEmitter<string> = new EventEmitter<string>();
|
||||
|
||||
/** Emitted when a task is unclaimed. */
|
||||
@Output()
|
||||
unClaimedTask: EventEmitter<string> = new EventEmitter<string>();
|
||||
|
||||
taskDetails: TaskDetailsModel;
|
||||
taskFormName: string = null;
|
||||
|
||||
@@ -375,6 +383,12 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
onClaimAction(taskId: string): void {
|
||||
this.claimedTask.emit(taskId);
|
||||
this.loadDetails(taskId);
|
||||
}
|
||||
|
||||
onUnclaimAction(taskId: string): void {
|
||||
this.unClaimedTask.emit(taskId);
|
||||
this.loadDetails(taskId);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user