mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[AAE-33096] added rootProcessInstanceId to dynamic component (#10762)
This commit is contained in:
parent
500d4be4a3
commit
2d21340947
@ -37,6 +37,7 @@ export class YourService extends ScreenRenderingService {
|
||||
[canClaimTask]="canClaimTask()"
|
||||
[canUnclaimTask]="canUnclaimTask()"
|
||||
[processInstanceId]="taskDetails.processInstanceId"
|
||||
[rootProcessInstanceId]="taskDetails.rootProcessInstanceId"
|
||||
[screenId]="screenId"
|
||||
[showCancelButton]="showCancelButton"
|
||||
[taskName]="taskDetails.name"
|
||||
@ -60,6 +61,7 @@ export class YourService extends ScreenRenderingService {
|
||||
| canClaimTask | `boolean` | | Boolean informing if a task can be claimed. |
|
||||
| canUnclaimTask | `boolean` | | Boolean informing if a task can be unclaimed. |
|
||||
| processInstanceId | `string` | | Process Instance Id to fetch corresponding data. |
|
||||
| rootProcessInstanceId | `string` | | Root Process Instance Id to fetch corresponding data. |
|
||||
| readOnly | `boolean` | false | Toggle readonly state of the task. |
|
||||
| showCancelButton | `boolean` | true | Toggle rendering of the `Cancel` button. |
|
||||
| screenId | `string` | | Screen id to create dynamic component |
|
||||
@ -94,6 +96,7 @@ Dynamic component must implement logic for method switchToDisplayMode.
|
||||
[canClaimTask]="canClaimTask()"
|
||||
[canUnclaimTask]="canUnclaimTask()"
|
||||
[processInstanceId]="taskDetails.processInstanceId"
|
||||
[rootProcessInstanceId]="taskDetails.rootProcessInstanceId"
|
||||
[screenId]="screenId"
|
||||
[showCancelButton]="showCancelButton"
|
||||
[taskName]="taskDetails.name"
|
||||
|
@ -28,6 +28,7 @@ import { TaskScreenCloudComponent } from './screen-cloud.component';
|
||||
<div class="adf-cloud-test-container">
|
||||
test component
|
||||
<div class="adf-cloud-test-container-taskId">{{ taskId }}</div>
|
||||
<div class="adf-cloud-test-container-rootProcessInstanceId">{{ rootProcessInstanceId }}</div>
|
||||
<button class="adf-cloud-test-container-complete-btn" (click)="onComplete()">complete</button>
|
||||
</div>
|
||||
`,
|
||||
@ -37,6 +38,7 @@ import { TaskScreenCloudComponent } from './screen-cloud.component';
|
||||
class TestComponent {
|
||||
@Input() taskId = '';
|
||||
@Input() screenId = '';
|
||||
@Input() rootProcessInstanceId = '';
|
||||
@Output() taskCompleted = new EventEmitter();
|
||||
displayMode: string;
|
||||
onComplete() {
|
||||
@ -49,7 +51,15 @@ class TestComponent {
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-test-actions-component',
|
||||
template: ` <adf-cloud-task-screen [taskId]="'1'" [appName]="'app-name-test'" [screenId]="'test'" (taskCompleted)="onTaskCompleted()" /> `,
|
||||
template: `
|
||||
<adf-cloud-task-screen
|
||||
[taskId]="'1'"
|
||||
[appName]="'app-name-test'"
|
||||
[screenId]="'test'"
|
||||
[rootProcessInstanceId]="'abcd-1234'"
|
||||
(taskCompleted)="onTaskCompleted()"
|
||||
/>
|
||||
`,
|
||||
imports: [CommonModule, TaskScreenCloudComponent],
|
||||
standalone: true
|
||||
})
|
||||
@ -91,6 +101,11 @@ describe('TaskScreenCloudComponent', () => {
|
||||
expect((inputValueFromDynamicComponent.nativeElement as HTMLElement).textContent).toBe('1');
|
||||
});
|
||||
|
||||
it('should set input property rootProcessInstanceId for dynamic component', () => {
|
||||
const inputValueFromDynamicComponent = fixture.debugElement.query(By.css('.adf-cloud-test-container-rootProcessInstanceId'));
|
||||
expect((inputValueFromDynamicComponent.nativeElement as HTMLElement).textContent).toBe('abcd-1234');
|
||||
});
|
||||
|
||||
it('should subscribe to the output of dynamic component', () => {
|
||||
const onTaskCompletedSpy = spyOn(fixture.componentInstance, 'onTaskCompleted');
|
||||
const btnComplete = fixture.debugElement.query(By.css('.adf-cloud-test-container-complete-btn'));
|
||||
|
@ -64,6 +64,10 @@ export class TaskScreenCloudComponent implements OnInit {
|
||||
@Input()
|
||||
readOnly = false;
|
||||
|
||||
/** Toggle readonly state of the task. */
|
||||
@Input()
|
||||
rootProcessInstanceId: string = '';
|
||||
|
||||
/** Emitted when the task is saved. */
|
||||
@Output()
|
||||
taskSaved = new EventEmitter();
|
||||
@ -133,6 +137,9 @@ export class TaskScreenCloudComponent implements OnInit {
|
||||
if (this.showCancelButton && Object.prototype.hasOwnProperty.call(this.componentRef.instance, 'showCancelButton')) {
|
||||
this.componentRef.setInput('showCancelButton', this.showCancelButton);
|
||||
}
|
||||
if (this.rootProcessInstanceId && Object.prototype.hasOwnProperty.call(this.componentRef.instance, 'rootProcessInstanceId')) {
|
||||
this.componentRef.setInput('rootProcessInstanceId', this.rootProcessInstanceId);
|
||||
}
|
||||
}
|
||||
|
||||
subscribeToOutputs() {
|
||||
|
@ -22,10 +22,11 @@ export interface UserTaskCustomUi {
|
||||
canClaimTask: boolean;
|
||||
canUnclaimTask: boolean;
|
||||
processInstanceId: string;
|
||||
taskName: string;
|
||||
taskId: string;
|
||||
rootProcessInstanceId: string;
|
||||
screenId: string;
|
||||
showCancelButton: boolean;
|
||||
taskName: string;
|
||||
taskId: string;
|
||||
cancelTask: EventEmitter<any>;
|
||||
claimTask: EventEmitter<any>;
|
||||
error: EventEmitter<any>;
|
||||
|
@ -37,6 +37,7 @@ export interface TaskDetailsCloudModel {
|
||||
priority?: number;
|
||||
processDefinitionId?: string;
|
||||
processInstanceId?: string;
|
||||
rootProcessInstanceId?: string;
|
||||
status?: TaskStatus;
|
||||
standalone?: boolean;
|
||||
candidateUsers?: string[];
|
||||
|
@ -30,6 +30,7 @@
|
||||
[canClaimTask]="canClaimTask()"
|
||||
[canUnclaimTask]="canUnclaimTask()"
|
||||
[processInstanceId]="taskDetails.processInstanceId"
|
||||
[rootProcessInstanceId]="taskDetails.rootProcessInstanceId"
|
||||
[screenId]="screenId"
|
||||
[showCancelButton]="showCancelButton"
|
||||
[taskName]="taskDetails.name"
|
||||
|
Loading…
x
Reference in New Issue
Block a user