[NIFI-13821] add Max Concurrent Tasks and Stateless Flow Timeout form… (#9328)

* [NIFI-13821] add Max Concurrent Tasks and Stateless Flow Timeout form fields when PG Execute Engine is STATELESS

* make fields conditionally required

This closes #9328
This commit is contained in:
Scott Aslan 2024-10-02 16:09:01 -06:00 committed by GitHub
parent d93c2f9f0c
commit cd391ce69d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 56 additions and 2 deletions

View File

@ -68,7 +68,8 @@
<div>
<mat-form-field>
<mat-label>Execution Engine</mat-label>
<mat-select formControlName="executionEngine">
<mat-select formControlName="executionEngine"
(selectionChange)="executionEngineChanged($event.value)">
@for (option of executionEngineOptions; track option) {
<mat-option
[value]="option.value"
@ -83,6 +84,30 @@
</mat-select>
</mat-form-field>
</div>
@if (editProcessGroupForm.get('executionEngine')?.value === STATELESS) {
<div>
<mat-form-field>
<mat-label>Max Concurrent Tasks</mat-label>
<input
matInput
formControlName="maxConcurrentTasks"
name="maxConcurrentTasks"
type="number"
min="1"
[readonly]="readonly" />
</mat-form-field>
</div>
<div>
<mat-form-field>
<mat-label>Stateless Flow Timeout</mat-label>
<input
matInput
formControlName="statelessFlowTimeout"
type="text"
[readonly]="readonly" />
</mat-form-field>
</div>
}
<div>
<mat-form-field>
<mat-label>Process Group FlowFile Concurrency</mat-label>

View File

@ -84,6 +84,9 @@ export class EditProcessGroup extends TabbedDialog {
@Output() editProcessGroup: EventEmitter<any> = new EventEmitter<any>();
protected readonly TextTip = TextTip;
protected readonly STATELESS: string = 'STATELESS';
private initialMaxConcurrentTasks: number;
private initialStatelessFlowTimeout: string;
editProcessGroupForm: FormGroup;
readonly: boolean;
@ -102,7 +105,7 @@ export class EditProcessGroup extends TabbedDialog {
},
{
text: 'Stateless',
value: 'STATELESS',
value: this.STATELESS,
description:
'Run the dataflow using the Stateless Execution Engine. See the User Guide for additional details.'
}
@ -189,6 +192,27 @@ export class EditProcessGroup extends TabbedDialog {
logFileSuffix: new FormControl(request.entity.component.logFileSuffix),
comments: new FormControl(request.entity.component.comments)
});
this.initialMaxConcurrentTasks = request.entity.component.maxConcurrentTasks;
this.initialStatelessFlowTimeout = request.entity.component.statelessFlowTimeout;
this.executionEngineChanged(request.entity.component.executionEngine);
}
executionEngineChanged(value: string): void {
if (value == this.STATELESS) {
this.editProcessGroupForm.addControl(
'maxConcurrentTasks',
new FormControl(this.initialMaxConcurrentTasks, Validators.required)
);
this.editProcessGroupForm.addControl(
'statelessFlowTimeout',
new FormControl(this.initialStatelessFlowTimeout, Validators.required)
);
} else {
this.editProcessGroupForm.removeControl('maxConcurrentTasks');
this.editProcessGroupForm.removeControl('statelessFlowTimeout');
}
}
submitForm() {
@ -221,6 +245,11 @@ export class EditProcessGroup extends TabbedDialog {
}
};
if (this.editProcessGroupForm.get('executionEngine')?.value === this.STATELESS) {
payload.component.maxConcurrentTasks = this.editProcessGroupForm.get('maxConcurrentTasks')?.value;
payload.component.statelessFlowTimeout = this.editProcessGroupForm.get('statelessFlowTimeout')?.value;
}
this.editProcessGroup.next(payload);
}