mcgilman commented on code in PR #7191:
URL: https://github.com/apache/nifi/pull/7191#discussion_r1298690411
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js:
##########
@@ -633,6 +644,33 @@
// reporting task
var reportingTaskItem =
$('<li></li>').append(reportingTaskState).append(reportingTaskBulletins).append(reportingTaskLink).append(reportingTaskType).append(reportingTaskActiveThreadCount);
tasks.append(reportingTaskItem);
+ } else if (referencingComponent.referenceType ===
'FlowAnalysisRule') {
+ var flowAnalysisRuleLink = $('<span
class="referencing-component-name
link"></span>').text(referencingComponent.name).on('click', function () {
+ var flowAnalysisRuleGrid =
$('#flow-analysis-rules-table').data('gridInstance');
+ var flowAnalysisRuleData =
flowAnalysisRuleGrid.getData();
+
+ // select the selected row
+ var row =
flowAnalysisRuleData.getRowById(referencingComponent.id);
+ flowAnalysisRuleGrid.setSelectedRows([row]);
+ flowAnalysisRuleGrid.scrollRowIntoView(row);
+
+ // select the flow analysis rule tab
+ $('#settings-tabs').find('li:nth-child(4)').click();
Review Comment:
Unfortunately, here we are selecting a tab by index. By inserting the Flow
Rules into the 4th position, we need to update the selection for all tabs to
the right. So below we need to increment the tab index for Registry Clients and
Parameter Providers.
##########
nifi-api/src/main/java/org/apache/nifi/flow/VersionedFlowAnalysisRule.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+
+package org.apache.nifi.flow;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.nifi.flowanalysis.EnforcementPolicy;
+
+public class VersionedFlowAnalysisRule extends VersionedConfigurableExtension {
+
+ private String annotationData;
Review Comment:
`annotationData` is only used by custom UIs. (Wow... sorry for the super
late response here... just seeing it)
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/settings-content.jsp:
##########
@@ -23,7 +23,7 @@
<div class="clear"></div>
</div>
<div id="settings-tabs-content">
- <button id="new-service-or-task" class="add-button fa fa-plus"
title="Create a new reporting task controller service" style="display:
block;"></button>
+ <button id="new-service-or-task" class="add-button fa fa-plus"
title="Create a new reporting task/flow analysis rule controller service"
style="display: block;"></button>
Review Comment:
Yeah... just looked more closely here, we do programmatically update this.
We're good here.
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js:
##########
@@ -1079,7 +1118,7 @@
var referencingComponents = service.referencingComponents;
$.each(referencingComponents, function (_,
referencingComponentEntity) {
var referencingComponent =
referencingComponentEntity.component;
- if (referencingComponent.referenceType === 'Processor' ||
referencingComponent.referenceType === 'ReportingTask' ||
referencingComponent.referenceType === 'ParameterProvider' ||
referencingComponent.referenceType === 'FlowRegistryClient') {
+ if (referencingComponent.referenceType === 'Processor' ||
referencingComponent.referenceType === 'ReportingTask' ||
referencingComponent.referenceType === 'FlowAnalysisRule' ||
referencingComponent.referenceType === 'ParameterProvider' ||
referencingComponent.referenceType === 'FlowRegistryClient') {
Review Comment:
A Flow Analysis Rule is not a schedulable component and it doesn't produce
bulletins. I don't think this condition is needed here.
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js:
##########
@@ -865,7 +904,7 @@
referencingComponentRevisions[referencingComponentEntity.id] =
nfClient.getRevision(referencingComponentEntity);
}
} else {
- if (referencingComponent.referenceType === 'Processor' ||
referencingComponent.referenceType === 'ReportingTask') {
+ if (referencingComponent.referenceType === 'Processor' ||
referencingComponent.referenceType === 'ReportingTask' ||
referencingComponent.referenceType === 'FlowAnalysisRule') {
Review Comment:
If an Enabled Flow Analysis Rule references a Controller Service and that
service is Disabled, does the Flow Analysis Rule also need to be Disabled?
If not, this is unneeded.
If yes, this will attempt to include it in subsequent calls to update a
Controller Service Referencing Components. This happens when a user Disables a
Controller Service or when a user Enabled a Controller Service and selects
Service and Referencing Components. It would also mean that the back end would
need to consider Flow Analysis Rules in this API. I don't think it does
currently.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]