mirror of https://github.com/apache/nifi.git
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.
This commit is contained in:
parent
05418d94f0
commit
387504b66f
|
@ -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));
|
||||
|
|
|
@ -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, {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue