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

rfellows 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 016d6355c4 NIFI-14638: Allowing Stop Version Control even when there 
are no Registry Clients. (#10023)
016d6355c4 is described below

commit 016d6355c4f37a70c0325e7bd0b71172c96164ef
Author: Matt Gilman <[email protected]>
AuthorDate: Tue Jun 17 09:51:43 2025 -0400

    NIFI-14638: Allowing Stop Version Control even when there are no Registry 
Clients. (#10023)
    
    This closes #10023
---
 .../service/canvas-context-menu.service.ts         |  3 --
 .../service/canvas-utils.service.spec.ts           | 53 ++++++++++++++++++++++
 .../flow-designer/service/canvas-utils.service.ts  | 24 ++++++++--
 3 files changed, 73 insertions(+), 7 deletions(-)

diff --git 
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts
 
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts
index 5397a990a0..353433539a 100644
--- 
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts
+++ 
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts
@@ -702,9 +702,6 @@ export class CanvasContextMenu implements 
ContextMenuDefinitionProvider {
                 isSeparator: true
             },
             {
-                condition: (selection: d3.Selection<any, any, any, any>) => {
-                    return this.canvasUtils.supportsFlowVersioning(selection);
-                },
                 text: 'Version',
                 subMenuId: this.VERSION_MENU.id
             },
diff --git 
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-utils.service.spec.ts
 
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-utils.service.spec.ts
index 3c82d29c98..ca855cab74 100644
--- 
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-utils.service.spec.ts
+++ 
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-utils.service.spec.ts
@@ -37,6 +37,8 @@ import { queueFeatureKey } from '../../queue/state';
 import * as fromQueue from '../state/queue/queue.reducer';
 import { flowAnalysisFeatureKey } from '../state/flow-analysis';
 import * as fromFlowAnalysis from 
'../state/flow-analysis/flow-analysis.reducer';
+import { ComponentType } from '@nifi/shared';
+import * as d3 from 'd3';
 
 describe('CanvasUtils', () => {
     let service: CanvasUtils;
@@ -78,4 +80,55 @@ describe('CanvasUtils', () => {
     it('should be created', () => {
         expect(service).toBeTruthy();
     });
+
+    describe('supportsStopFlowVersioning', () => {
+        it('should return null if selection is non empty and version control 
information is missing', () => {
+            const pgDatum = {
+                id: '1',
+                type: ComponentType.ProcessGroup,
+                permissions: {
+                    canRead: true,
+                    canWrite: true
+                },
+                component: {
+                    id: '1',
+                    name: 'Test Process Group',
+                    versionControlInformation: null
+                }
+            };
+            const selection = 
d3.select(document.createElement('div')).classed('process-group', 
true).datum(pgDatum);
+            
expect(service.getFlowVersionControlInformation(selection)).toBe(null);
+        });
+
+        it('should return vci if selection is non empty and version control 
information is present', () => {
+            const versionControlInformation = {
+                groupId: '1',
+                registryId: '324e0ab1-0197-1000-ffff-ffffb3123c5c',
+                registryName: 'ConnectorFlowRegistryClient',
+                branch: 'main',
+                bucketId: 'connectors',
+                bucketName: 'connectors',
+                flowId: 'kafka-json-sasl-topic2table-schemaev',
+                flowName: 'kafka-json-sasl-topic2table-schemaev',
+                version: '0.1.0-f47ff72',
+                state: 'UP_TO_DATE',
+                stateExplanation: 'Flow version is current'
+            };
+            const pgDatum = {
+                id: '1',
+                type: ComponentType.ProcessGroup,
+                permissions: {
+                    canRead: true,
+                    canWrite: true
+                },
+                component: {
+                    id: '1',
+                    name: 'Test Process Group',
+                    versionControlInformation
+                }
+            };
+            const selection = 
d3.select(document.createElement('div')).classed('process-group', 
true).datum(pgDatum);
+            
expect(service.getFlowVersionControlInformation(selection)).toBe(versionControlInformation);
+        });
+    });
 });
diff --git 
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-utils.service.ts
 
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-utils.service.ts
index 6b4ddfae7d..fcd3cba00d 100644
--- 
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-utils.service.ts
+++ 
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/canvas-utils.service.ts
@@ -2090,6 +2090,10 @@ export class CanvasUtils {
      * @return {boolean}                       Whether the selection supports 
starting flow versioning
      */
     public supportsStartFlowVersioning(selection: d3.Selection<any, any, any, 
any>): boolean {
+        if (!this.canVersionFlows()) {
+            return false;
+        }
+
         if (!this.supportsFlowVersioning(selection)) {
             return false;
         }
@@ -2116,10 +2120,6 @@ export class CanvasUtils {
      * @return {boolean}                       Whether the selection supports 
flow versioning
      */
     public supportsFlowVersioning(selection: d3.Selection<any, any, any, 
any>): boolean {
-        if (!this.canVersionFlows()) {
-            return false;
-        }
-
         if (selection.empty()) {
             // prevent versioning of the root group
             if (!this.getParentProcessGroupId()) {
@@ -2144,6 +2144,10 @@ export class CanvasUtils {
      * @return {boolean}                       Whether the selection supports 
commit.
      */
     public supportsCommitFlowVersion(selection: d3.Selection<any, any, any, 
any>): boolean {
+        if (!this.canVersionFlows()) {
+            return false;
+        }
+
         const versionControlInformation = 
this.getFlowVersionControlInformation(selection);
 
         // check the selection for version control information
@@ -2157,6 +2161,10 @@ export class CanvasUtils {
      * @return {boolean}                       Whether the selection supports 
force commit.
      */
     public supportsForceCommitFlowVersion(selection: d3.Selection<any, any, 
any, any>): boolean {
+        if (!this.canVersionFlows()) {
+            return false;
+        }
+
         const versionControlInformation = 
this.getFlowVersionControlInformation(selection);
 
         // check the selection for version control information
@@ -2170,6 +2178,10 @@ export class CanvasUtils {
      * @return {boolean}                       Whether the selection has local 
changes.
      */
     public hasLocalChanges(selection: d3.Selection<any, any, any, any>): 
boolean {
+        if (!this.canVersionFlows()) {
+            return false;
+        }
+
         const versionControlInformation = 
this.getFlowVersionControlInformation(selection);
 
         // check the selection for version control information
@@ -2187,6 +2199,10 @@ export class CanvasUtils {
      * @return {boolean}                       Whether the selection supports 
change flow version.
      */
     public supportsChangeFlowVersion(selection: d3.Selection<any, any, any, 
any>): boolean {
+        if (!this.canVersionFlows()) {
+            return false;
+        }
+
         const versionControlInformation = 
this.getFlowVersionControlInformation(selection);
 
         return (

Reply via email to