Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-04-16 Thread via GitHub


mcgilman merged PR #8273:
URL: https://github.com/apache/nifi/pull/8273


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-04-16 Thread via GitHub


mcgilman commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1567741800


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,562 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+ruleWarningListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+violation.subjectPermissionDto.canRead ? 
$(violationListItemNameEl).text(violation.subjectDisplayName) : 
$(violationListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+warning.subjectPermissionDto.canRead ? 
$(warningListItemNameEl).text(warning.subjectDisplayName) : 
$(warningListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+  

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-04-16 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1567607846


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,562 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+ruleWarningListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+violation.subjectPermissionDto.canRead ? 
$(violationListItemNameEl).text(violation.subjectDisplayName) : 
$(violationListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+warning.subjectPermissionDto.canRead ? 
$(warningListItemNameEl).text(warning.subjectDisplayName) : 
$(warningListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+   

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-04-15 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1565769286


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,562 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+ruleWarningListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+violation.subjectPermissionDto.canRead ? 
$(violationListItemNameEl).text(violation.subjectDisplayName) : 
$(violationListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+warning.subjectPermissionDto.canRead ? 
$(warningListItemNameEl).text(warning.subjectDisplayName) : 
$(warningListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+   

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-04-12 Thread via GitHub


mcgilman commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1563327796


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/flow-analysis-drawer.jsp:
##
@@ -0,0 +1,84 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
+
+
+
+Rules analysis pending...
+
+
+
+Flow Guide
+
+
+
+Show enforced violations
+
+
+
+Show warning violations
+
+
+
+NiFi Flow
+
+
+
+
+
+Enforced Rules 
+
+
+
+
+
+
+
+Warning Rules 
+
+
+
+
+
+
+Enforced Violations 
+
+
+
+
+
+
+Warning Violations 
+
+
+
+
+
+
+View Documentation
+Edit Rule
+
+
+
+
+
+Violation details
+Go to 
component

Review Comment:
   Minor but I noticed inconsistent enabled states on the icons in the context 
menu.
   
   https://github.com/apache/nifi/assets/123395/460a95c2-c84b-46e0-9c1e-c9854efec757;>
   
   https://github.com/apache/nifi/assets/123395/2ca6f9bd-ef6c-4426-ae4a-0aed7b2a02d9;>
   



##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,562 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+ruleWarningListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+violation.subjectPermissionDto.canRead ? 
$(violationListItemNameEl).text(violation.subjectDisplayName) : 
$(violationListItemNameEl).text('Unauthorized').addClass('unauthorized');
+

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-19 Thread via GitHub


mcgilman commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1531038999


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +407,602 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+ruleWarningListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+violation.subjectPermissionDto.canRead ? 
$(violationListItemNameEl).text(violation.subjectDisplayName) : 
$(violationListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+warning.subjectPermissionDto.canRead ? 
$(warningListItemNameEl).text(warning.subjectDisplayName) : 
$(warningListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+  

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-19 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1530355434


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +407,602 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+ruleWarningListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+violation.subjectPermissionDto.canRead ? 
$(violationListItemNameEl).text(violation.subjectDisplayName) : 
$(violationListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+warning.subjectPermissionDto.canRead ? 
$(warningListItemNameEl).text(warning.subjectDisplayName) : 
$(warningListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+   

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-15 Thread via GitHub


mcgilman commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1526743150


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +407,602 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+ruleWarningListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+violation.subjectPermissionDto.canRead ? 
$(violationListItemNameEl).text(violation.subjectDisplayName) : 
$(violationListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+warning.subjectPermissionDto.canRead ? 
$(warningListItemNameEl).text(warning.subjectDisplayName) : 
$(warningListItemNameEl).text('Unauthorized').addClass('unauthorized');
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+  

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-15 Thread via GitHub


mcgilman commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1526709847


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,556 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);

Review Comment:
   @tpalfy Typically we would just report it as unauthorized and clear out 
component details. Please see the Controller Service references, Parameter 
references, Parameter Provider references, etc for examples.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-14 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1525292949


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,556 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);

Review Comment:
   @mcgilman Quick update: @tpalfy's work has been reviewed and merged into 
`main`. I've rebased this PR to include those changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-07 Thread via GitHub


sardell commented on PR #8273:
URL: https://github.com/apache/nifi/pull/8273#issuecomment-1984539412

   @mcgilman I believe I addressed all your comments. Thanks for the quick 
assist, @tpalfy!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-07 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1516859726


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,556 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);

Review Comment:
   I've updated this PR to show 'Unauthorized' for the fields that will return 
`null` if a user doesn't have read permission. @tpalfy's PR will need to be 
merged first as a result.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-07 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1516856485


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,556 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-07 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1516140292


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/flow-analysis-drawer.jsp:
##
@@ -0,0 +1,85 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
+
+
+
+Start a new analysis

Review Comment:
   I updated my work to disable this button and show a spinner while a report 
is being run.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-05 Thread via GitHub


tpalfy commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1513231844


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,556 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);

Review Comment:
   @mcgilman I opened a PR https://issues.apache.org/jira/browse/NIFI-12862 
that should take care of this issue.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-04 Thread via GitHub


tpalfy commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1511380014


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,556 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);

Review Comment:
   @mcgilman I have opened https://issues.apache.org/jira/browse/NIFI-12862 and 
going to open a PR for the backend to fix this issue.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-03-01 Thread via GitHub


tpalfy commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1509031907


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,556 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);

Review Comment:
   @mcgilman this is a good observation. I'm trying to figure out how to solve 
this. In cluster mode usually the Merger (and in this case the 
FlowAnalysisResultEntityMerger) actually filters the result based on 
authorization. But in non-cluster mode I don't see what the usual practice is.
   Do you have a suggestion?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-29 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1508148578


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,556 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);

Review Comment:
   > In past features, referencing components where the user lacked permissions 
were rendered as unauthorized
   
   I'm assuming that those past features would handle the permission logic on 
the backend so details like the name aren't returned in the request response. 
   
   cc @tpalfy 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-29 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1508139735


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,556 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-29 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1508127197


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/flow-status.jsp:
##
@@ -71,6 +71,7 @@
 
 
 
+

Review Comment:
   Good catch. I'll update the background color styling to match the 
hover/focus states of the search icon.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-29 Thread via GitHub


mcgilman commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1507857234


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,556 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-29 Thread via GitHub


mcgilman commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1507846158


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-29 Thread via GitHub


tpalfy commented on PR #8273:
URL: https://github.com/apache/nifi/pull/8273#issuecomment-1971265091

   LGTM
   Tested with built-in and some custom rules. All issues raised by me seem to 
be addressed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-02 Thread via GitHub


sardell commented on PR #8273:
URL: https://github.com/apache/nifi/pull/8273#issuecomment-1924612023

   @tpalfy I believe I addressed all of the issues you pointed out. When you 
have time, could you please take another look?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-02 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1476649837


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-02 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1476628525


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-02 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1476627180


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-02 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1476626561


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-01 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1474564178


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-02-01 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1474542558


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-01-26 Thread via GitHub


mcgilman commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1468196770


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-01-25 Thread via GitHub


tpalfy commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r142453


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-01-25 Thread via GitHub


tpalfy commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1463631993


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-01-23 Thread via GitHub


sardell commented on PR #8273:
URL: https://github.com/apache/nifi/pull/8273#issuecomment-1907023978

   > Hey @sardell  Thanks for the PR! Would love to have you help contribute 
this into the new UI work. That work is still in progress and is being tracked 
here [1]. Please add a line item there and file a sub-task. Please see [2] for 
a high-level overview of layout, structure, and dataflow throughout the 
application. These details will be formalized in a README soon, but wanted to 
pass along a pointer in the meantime.
   > 
   > The UX in this new effort is largely unchanged from the previous UI. So 
any designs for this PR should be directly applicable to the new UI. The only 
real difference is moving away from the large full-screen modal (though that 
may still be used for component documentation or custom UIs yet to be 
developed) to separate pages.
   > 
   > [1] https://issues.apache.org/jira/browse/NIFI-12400 [2] #8053
   
   @mcgilman Thanks for that quick rundown. I'm very excited to see this UI 
framework update coming together so fast! I've added a line item and sub-task 
to NIFI-12400 and will begin work shortly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-01-23 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1463925689


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-01-23 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1463913231


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-01-23 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1463913231


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-01-23 Thread via GitHub


mcgilman commented on PR #8273:
URL: https://github.com/apache/nifi/pull/8273#issuecomment-1906159835

   > I'm not sure how this will translate over to the new UI work that's 
currently in-progress, but I'll gladly take responsibility for adding it there 
as well.
   
   Hey @sardell  Thanks for the PR! Would love to have you help contribute 
this into the new UI work. That work is still in progress and is being tracked 
here [1]. Please add a line item there and file a sub-task. Please see [2] for 
a high-level overview of layout, structure, and dataflow throughout the 
application. These details will be formalized in a README soon, but wanted to 
pass along a pointer in the meantime.
   
   [1] https://issues.apache.org/jira/browse/NIFI-12400
   [2] https://github.com/apache/nifi/pull/8053


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-01-22 Thread via GitHub


tpalfy commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1462197492


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

Re: [PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-01-19 Thread via GitHub


sardell commented on code in PR #8273:
URL: https://github.com/apache/nifi/pull/8273#discussion_r1459356177


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-flow-status-controller.js:
##
@@ -400,6 +406,554 @@
 }
 }
 
+/**
+ * The flow analysis controller.
+ */
+
+this.flowAnalysis = {
+
+/**
+ * Create the list of rule violations
+ */
+buildRuleViolationsList: function(rules, violationsAndRecs) {
+var ruleViolationCountEl = $('#rule-violation-count');
+var ruleViolationListEl = $('#rule-violations-list');
+var ruleWarningCountEl = $('#rule-warning-count');
+var ruleWarningListEl = $('#rule-warnings-list');
+var violations = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'ENFORCE'
+});
+var warnings = violationsAndRecs.filter(function 
(violation) {
+return violation.enforcementPolicy === 'WARN'
+});
+ruleViolationCountEl.empty().text('(' + violations.length 
+ ')');
+ruleWarningCountEl.empty().text('(' + warnings.length + 
')');
+ruleViolationListEl.empty();
+violations.forEach(function(violation) {
+var rule = rules.find(function(rule) {
+return rule.id === violation.ruleId;
+});
+// create DOM elements
+var violationListItemEl = $('');
+var violationEl = $('');
+var violationListItemWrapperEl = $('');
+var violationRuleEl = $('');
+var violationListItemNameEl = $('');
+var violationListItemIdEl = $('');
+var violationInfoButtonEl = $('');
+
+// add text content and button data
+$(violationRuleEl).text(rule.name);
+
$(violationListItemNameEl).text(violation.subjectDisplayName);
+$(violationListItemIdEl).text(violation.subjectId);
+
$(violationListItemEl).append(violationRuleEl).append(violationListItemWrapperEl);
+$(violationInfoButtonEl).data('violationInfo', 
violation);
+
+// build list DOM structure
+
violationListItemWrapperEl.append(violationListItemNameEl).append(violationListItemIdEl);
+
violationEl.append(violationListItemWrapperEl).append(violationInfoButtonEl);
+
violationListItemEl.append(violationRuleEl).append(violationEl)
+ruleViolationListEl.append(violationListItemEl);
+});
+
+warnings.forEach(function(warning) {
+var rule = rules.find(function(rule) {
+return rule.id === warning.ruleId;
+});
+// create DOM elements
+var warningListItemEl = $('');
+var warningEl = $('');
+var warningListItemWrapperEl = $('');
+var warningRuleEl = $('');
+var warningListItemNameEl = $('');
+var warningListItemIdEl = $('');
+var warningInfoButtonEl = $('');
+
+// add text content and button data
+$(warningRuleEl).text(rule.name);
+
$(warningListItemNameEl).text(warning.subjectDisplayName);
+$(warningListItemIdEl).text(warning.subjectId);
+
$(warningListItemEl).append(warningRuleEl).append(warningListItemWrapperEl);
+$(warningInfoButtonEl).data('violationInfo', warning);
+
+// build list DOM structure
+
warningListItemWrapperEl.append(warningListItemNameEl).append(warningListItemIdEl);
+
warningEl.append(warningListItemWrapperEl).append(warningInfoButtonEl);
+
warningListItemEl.append(warningRuleEl).append(warningEl)
+ruleWarningListEl.append(warningListItemEl);
+});
+},
+
+/**
+ * 
+ * Render a new list when it differs from the previous 
violations response
+ */
+buildRuleViolations: function(rules, violations) {
+if 

[PR] NIFI-11520: Add a menu to display Flow Analysis report results [nifi]

2024-01-19 Thread via GitHub


sardell opened a new pull request, #8273:
URL: https://github.com/apache/nifi/pull/8273

   
   
   
   
   
   
   
   
   
   
   
   
   
   # Summary
   
   [NIFI-11520](https://issues.apache.org/jira/browse/NIFI-11520)
   
   This PR introduces a menu to the canvas that displays the results of a Flow 
Analysis report. This will enable UI users to see a list of their established 
rules and violations (scoped to the currently selected Process Group in the 
canvas). I'm not sure how this will translate over to the new UI work that's 
currently in-progress, but I'll gladly take responsibility for adding it there 
as well.
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue 
created
   
   ### Pull Request Tracking
   
   - [ ] Pull Request title starts with Apache NiFi Jira issue number, such as 
`NIFI-0`
   - [ ] Pull Request commit message starts with Apache NiFi Jira issue number, 
as such `NIFI-0`
   
   ### Pull Request Formatting
   
   - [ ] Pull Request based on current revision of the `main` branch
   - [ ] Pull Request refers to a feature branch with one commit containing 
changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request 
creation.
   
   ### Build
   
   - [ ] Build completed using `mvn clean install -P contrib-check`
 - [ ] JDK 21
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 
2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License 
Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` 
files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org