From b319bb078bd24f98784f38dd148d2dde15d0bb88 Mon Sep 17 00:00:00 2001 From: HunterG6700 Date: Wed, 9 Oct 2024 12:39:28 +0000 Subject: [PATCH 1/2] NIFI-13853: Added the ability to filter by all to the Advanced Rules pag --- .../src/main/webapp/js/application.js | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/webapp/js/application.js b/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/webapp/js/application.js index e65268966a3b..1db0dac379f5 100644 --- a/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/webapp/js/application.js +++ b/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/webapp/js/application.js @@ -201,6 +201,9 @@ var ua = { }, { text: 'by action', value: 'action' + }, { + text: 'filter everything', + value: 'all' }], select: function (option) { ua.applyRuleFilter(); @@ -1484,14 +1487,33 @@ var ua = { conditions.push(condition.expression); }); return conditions; - } else { - var actions = []; - $.each(rule.actions, function (_, action) { - actions.push(action.attribute); - actions.push(action.value); - }); - return actions; - } + } else if (filterType.value === 'action') { + var actions = []; + $.each(rule.actions, function (_, action) { + actions.push(action.attribute); + actions.push(action.value); + }); + return actions; + } else if (filterType.value === 'all') { + // Return all relevant details for the rule + var allDetails = []; + allDetails.push('Name: ' + rule.name); + allDetails.push('Comments: ' + rule.comments); + + // Add conditions + $.each(rule.conditions, function (_, condition) { + allDetails.push('Condition: ' + condition.expression); + }); + + // Add actions + $.each(rule.actions, function (_, action) { + allDetails.push('Action: ' + action.attribute + ' -> ' + action.value); + }); + + return allDetails; + } + + return []; }, /** From 51c12d9afe6971bdd1244f814b20da4dea401dee Mon Sep 17 00:00:00 2001 From: HunterG6700 Date: Thu, 17 Oct 2024 10:36:09 +0000 Subject: [PATCH 2/2] NIFI-13853: Fixed formatting --- .../src/main/webapp/js/application.js | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/webapp/js/application.js b/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/webapp/js/application.js index 1db0dac379f5..f5fd8d8a24ea 100644 --- a/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/webapp/js/application.js +++ b/nifi-extension-bundles/nifi-update-attribute-bundle/nifi-update-attribute-ui/src/main/webapp/js/application.js @@ -202,8 +202,8 @@ var ua = { text: 'by action', value: 'action' }, { - text: 'filter everything', - value: 'all' + text: 'by any field', + value: 'any' }], select: function (option) { ua.applyRuleFilter(); @@ -1488,32 +1488,30 @@ var ua = { }); return conditions; } else if (filterType.value === 'action') { - var actions = []; - $.each(rule.actions, function (_, action) { - actions.push(action.attribute); - actions.push(action.value); - }); - return actions; - } else if (filterType.value === 'all') { - // Return all relevant details for the rule - var allDetails = []; - allDetails.push('Name: ' + rule.name); - allDetails.push('Comments: ' + rule.comments); - - // Add conditions - $.each(rule.conditions, function (_, condition) { - allDetails.push('Condition: ' + condition.expression); - }); - - // Add actions - $.each(rule.actions, function (_, action) { - allDetails.push('Action: ' + action.attribute + ' -> ' + action.value); - }); - - return allDetails; - } - - return []; + var actions = []; + $.each(rule.actions, function (_, action) { + actions.push(action.attribute); + actions.push(action.value); + }); + return actions; + } else if (filterType.value === 'any') { + // Return all relevant details for the rule + var allDetails = []; + allDetails.push('Name: ' + rule.name); + allDetails.push('Comments: ' + rule.comments); + + // Add conditions + $.each(rule.conditions, function (_, condition) { + allDetails.push('Condition: ' + condition.expression); + }); + + // Add actions + $.each(rule.actions, function (_, action) { + allDetails.push('Action: ' + action.attribute + ' -> ' + action.value); + }); + return allDetails; + } + return []; }, /**