diff --git a/docs/process-services-cloud/components/screen-cloud.component.md b/docs/process-services-cloud/components/screen-cloud.component.md index 845cf71a47..d6ea2ca683 100644 --- a/docs/process-services-cloud/components/screen-cloud.component.md +++ b/docs/process-services-cloud/components/screen-cloud.component.md @@ -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" diff --git a/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.spec.ts index b00f9336b4..5fe013e924 100644 --- a/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.spec.ts @@ -28,6 +28,7 @@ import { TaskScreenCloudComponent } from './screen-cloud.component';
test component
{{ taskId }}
+
{{ rootProcessInstanceId }}
`, @@ -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: ` `, + template: ` + + `, 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')); diff --git a/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.ts b/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.ts index 359f5a431a..849d9cf810 100644 --- a/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.ts @@ -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() { diff --git a/lib/process-services-cloud/src/lib/screen/models/screen-cloud.model.ts b/lib/process-services-cloud/src/lib/screen/models/screen-cloud.model.ts index 23fc2838af..e4e924541c 100644 --- a/lib/process-services-cloud/src/lib/screen/models/screen-cloud.model.ts +++ b/lib/process-services-cloud/src/lib/screen/models/screen-cloud.model.ts @@ -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; claimTask: EventEmitter; error: EventEmitter; diff --git a/lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts b/lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts index 47fe40d1f4..e86190b9e9 100644 --- a/lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts +++ b/lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts @@ -37,6 +37,7 @@ export interface TaskDetailsCloudModel { priority?: number; processDefinitionId?: string; processInstanceId?: string; + rootProcessInstanceId?: string; status?: TaskStatus; standalone?: boolean; candidateUsers?: string[]; diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.html b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.html index a76982f871..99a1049039 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.html +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.html @@ -30,6 +30,7 @@ [canClaimTask]="canClaimTask()" [canUnclaimTask]="canUnclaimTask()" [processInstanceId]="taskDetails.processInstanceId" + [rootProcessInstanceId]="taskDetails.rootProcessInstanceId" [screenId]="screenId" [showCancelButton]="showCancelButton" [taskName]="taskDetails.name"