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 b08c63a69c5 NIFI-15596 Corrected regex for FlowFile Expiration and
parsed as float to allow the "FlowFile Expiration Indicator" icon to be
displayed when value is a decimal without a leading integer or when leading
integer is 0. (#10893)
b08c63a69c5 is described below
commit b08c63a69c539aeb000cf2d786de754e277e09ab
Author: dan-s1 <[email protected]>
AuthorDate: Sat Feb 28 11:28:54 2026 -0500
NIFI-15596 Corrected regex for FlowFile Expiration and parsed as float to
allow the "FlowFile Expiration Indicator" icon to be displayed when value is a
decimal without a leading integer or when leading integer is 0. (#10893)
* NIFI-15596 Corrected regex for FlowFile Expiration and parsed as float to
allow the "FlowFile Expiration Indicator" icon to be displayed when value is a
decimal without a leading integer or when leading integer is 0.
* NIFI-15596 Added unit tests and changed match in isExpirationConfigured
to match on the first capture group.
* NIFI-15596 Ran prettier.
---
.../manager/connection-manager.service.spec.ts | 82 ++++++++++++++++++++++
.../service/manager/connection-manager.service.ts | 4 +-
2 files changed, 84 insertions(+), 2 deletions(-)
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/manager/connection-manager.service.spec.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/manager/connection-manager.service.spec.ts
index fea4e539fe5..ae50f338bbd 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/manager/connection-manager.service.spec.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/manager/connection-manager.service.spec.ts
@@ -143,4 +143,86 @@ describe('ConnectionManager', () => {
expect(result).toBe(true);
});
});
+
+ describe('isExpirationConfigured', () => {
+ it('should return true when expiration is a positive integer
duration', () => {
+ const connection = { flowFileExpiration: '30 sec' };
+
+ const result = (service as any).isExpirationConfigured(connection);
+
+ expect(result).toBe(true);
+ });
+
+ it('should return false when expiration is zero', () => {
+ const connection = { flowFileExpiration: '0 sec' };
+
+ const result = (service as any).isExpirationConfigured(connection);
+
+ expect(result).toBe(false);
+ });
+
+ it('should return true when expiration is a decimal with leading
number greater than zero', () => {
+ const connection = { flowFileExpiration: '1.5 sec' };
+
+ const result = (service as any).isExpirationConfigured(connection);
+
+ expect(result).toBe(true);
+ });
+
+ it('should return true when expiration is a decimal with leading
zero', () => {
+ const connection = { flowFileExpiration: '0.5 sec' };
+
+ const result = (service as any).isExpirationConfigured(connection);
+
+ expect(result).toBe(true);
+ });
+
+ it('should return true when expiration is a decimal without leading
integer', () => {
+ const connection = { flowFileExpiration: '.5 sec' };
+
+ const result = (service as any).isExpirationConfigured(connection);
+
+ expect(result).toBe(true);
+ });
+
+ it('should return false when flowFileExpiration is null', () => {
+ const connection = { flowFileExpiration: null };
+
+ const result = (service as any).isExpirationConfigured(connection);
+
+ expect(result).toBe(false);
+ });
+
+ it('should return false when flowFileExpiration is undefined', () => {
+ const connection = { flowFileExpiration: undefined };
+
+ const result = (service as any).isExpirationConfigured(connection);
+
+ expect(result).toBe(false);
+ });
+
+ it('should return false when expiration has no numeric value', () => {
+ const connection = { flowFileExpiration: 'sec' };
+
+ const result = (service as any).isExpirationConfigured(connection);
+
+ expect(result).toBe(false);
+ });
+
+ it('should return true when expiration is a large integer duration',
() => {
+ const connection = { flowFileExpiration: '3600 sec' };
+
+ const result = (service as any).isExpirationConfigured(connection);
+
+ expect(result).toBe(true);
+ });
+
+ it('should return false when expiration is zero decimal', () => {
+ const connection = { flowFileExpiration: '0.0 sec' };
+
+ const result = (service as any).isExpirationConfigured(connection);
+
+ expect(result).toBe(false);
+ });
+ });
});
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/manager/connection-manager.service.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/manager/connection-manager.service.ts
index e32ea344400..82dfc63ea6f 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/manager/connection-manager.service.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/manager/connection-manager.service.ts
@@ -595,9 +595,9 @@ export class ConnectionManager implements OnDestroy {
*/
private isExpirationConfigured(connection: any): boolean {
if (connection.flowFileExpiration != null) {
- const match: string[] =
connection.flowFileExpiration.match(/^(\d+).*/);
+ const match: string[] =
connection.flowFileExpiration.match(/^(\d*\.?\d+).*/);
if (match !== null && match.length > 0) {
- if (parseInt(match[0], 10) > 0) {
+ if (parseFloat(match[1]) > 0) {
return true;
}
}