This is an automated email from the ASF dual-hosted git repository.

mcgilman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new cd391ce69d [NIFI-13821] add Max Concurrent Tasks and Stateless Flow 
Timeout form… (#9328)
cd391ce69d is described below

commit cd391ce69de9a1fd23805cc322ec0c280725ad84
Author: Scott Aslan <[email protected]>
AuthorDate: Wed Oct 2 16:09:01 2024 -0600

    [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
---
 .../edit-process-group.component.html              | 27 ++++++++++++++++++-
 .../edit-process-group.component.ts                | 31 +++++++++++++++++++++-
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git 
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/items/process-group/edit-process-group/edit-process-group.component.html
 
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/items/process-group/edit-process-group/edit-process-group.component.html
index 0a424efabd..03620cc921 100644
--- 
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/items/process-group/edit-process-group/edit-process-group.component.html
+++ 
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/items/process-group/edit-process-group/edit-process-group.component.html
@@ -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>
diff --git 
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/items/process-group/edit-process-group/edit-process-group.component.ts
 
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/items/process-group/edit-process-group/edit-process-group.component.ts
index b81104fef8..f3a32ccd9f 100644
--- 
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/items/process-group/edit-process-group/edit-process-group.component.ts
+++ 
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/items/process-group/edit-process-group/edit-process-group.component.ts
@@ -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);
     }
 

Reply via email to