This is an automated email from the ASF dual-hosted git repository.
mtien pushed a commit to branch support/nifi-1.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/support/nifi-1.x by this push:
new 8d04559e07 NIFI-11433 - use .add() for set instead of .push() (#7193)
8d04559e07 is described below
commit 8d04559e073229f3edcc130c3be6147197b4f1d2
Author: Scott Aslan <[email protected]>
AuthorDate: Tue Apr 25 13:43:45 2023 -0400
NIFI-11433 - use .add() for set instead of .push() (#7193)
* replace d3.nest, use add instead of push for Set, use forEach to loop
over Set
* es5 function syntax
Merged #7193 into main.
---
.../main/webapp/js/nf/canvas/nf-controller-service.js | 16 ++++++----------
.../main/webapp/js/nf/canvas/nf-controller-services.js | 6 ++----
.../src/main/webapp/js/nf/canvas/nf-settings.js | 6 +-----
3 files changed, 9 insertions(+), 19 deletions(-)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
index 9c09beb398..b705e98adf 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
@@ -450,13 +450,9 @@
* @param {array} bulletins
*/
var updateReferencingComponentBulletins = function (bulletins) {
- var bulletinsBySource = d3.nest()
- .key(function (d) {
- return d.sourceId;
- })
- .map(bulletins, d3.map);
+ var bulletinsBySource = new Map(bulletins.map(function(d) { return
[d.sourceId, d]; }));
- bulletinsBySource.each(function (sourceBulletins, sourceId) {
+ bulletinsBySource.forEach(function (sourceBulletins, sourceId) {
$('div.' + sourceId + '-bulletins').each(function () {
updateBulletins(sourceBulletins, $(this));
});
@@ -830,14 +826,14 @@
*/
var getReferencingControllerServiceIds = function (controllerService) {
var ids = new Set();
- ids.push(controllerService.id);
+ ids.add(controllerService.id);
var checkReferencingServices = function (referencingComponents) {
$.each(referencingComponents, function (_,
referencingComponentEntity) {
var referencingComponent =
referencingComponentEntity.component;
if (referencingComponent.referenceType ===
'ControllerService') {
// add the id
- ids.push(referencingComponent.id);
+ ids.add(referencingComponent.id);
// consider it's referencing components if appropriate
if (referencingComponent.referenceCycle === false) {
@@ -930,7 +926,7 @@
// start polling for each controller service
var polling = [];
- services.each(function (controllerServiceId) {
+ services.forEach(function (controllerServiceId) {
getControllerService(controllerServiceId,
controllerServiceData).done(function(controllerServiceEntity) {
polling.push(stopReferencingSchedulableComponents(controllerServiceEntity,
pollCondition));
});
@@ -1229,7 +1225,7 @@
// start polling for each controller service
var polling = [];
- services.each(function (controllerServiceId) {
+ services.forEach(function (controllerServiceId) {
getControllerService(controllerServiceId,
controllerServiceData).done(function(controllerServiceEntity) {
if (enabled) {
polling.push(enableReferencingServices(controllerServiceEntity, pollCondition));
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js
index 1c8b1995ec..3742830bcc 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js
@@ -1452,11 +1452,9 @@
// if there are some bulletins process them
if (!nfCommon.isEmpty(controllerServiceBulletins)) {
- var controllerServiceBulletinsBySource = d3.nest()
- .key(function(d) { return d.sourceId; })
- .map(controllerServiceBulletins, d3.map);
+ var controllerServiceBulletinsBySource = new
Map(controllerServiceBulletins.map(function(d) { return [d.sourceId, d]; }));
-
controllerServiceBulletinsBySource.each(function(sourceBulletins, sourceId) {
+
controllerServiceBulletinsBySource.forEach(function(sourceBulletins, sourceId) {
var controllerService =
controllerServicesData.getItemById(sourceId);
if (nfCommon.isDefinedAndNotNull(controllerService)) {
controllerServicesData.updateItem(sourceId,
$.extend(controllerService, {
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
index 45a35bc274..54177e4f1f 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
@@ -3069,11 +3069,7 @@
// if there are some bulletins process them
if (!nfCommon.isEmpty(reportingTaskBulletins)) {
- var reportingTaskBulletinsBySource = d3.nest()
- .key(function (d) {
- return d.sourceId;
- })
- .map(reportingTaskBulletins, d3.map);
+ var reportingTaskBulletinsBySource = new
Map(reportingTaskBulletins.map(function(d) { return [d.sourceId, d]; }));
reportingTaskBulletinsBySource.each(function (sourceBulletins,
sourceId) {
var reportingTask =
reportingTasksData.getItemById(sourceId);