Fixed repeating group action menu items bug.

Ylian Saint-Hilaire committed Sep 2, 2020 at 14:40 UTC df4c302470df5fb0f57b2e5c3aad3a7c76dd1a26
1 file changed +4 -4
views/default.handlebars
+4 -4
@@ -4366,7 +4366,7 @@
4366 }
4367
4368 function groupActionFunction() {
4369 - var addedOptions = '', nodeids = getCheckedDevices();
4369 + var addedOptions = '', nodeids = getCheckedDevices(), added = 0;
4370
4371 // Check if any of the selected devices have a MQTT connection active
4372 if (features & 0x00400000) {
@@ -4375,9 +4375,9 @@
4375
4376 // Display the "Uninstall Agent" option if allowed and we selected connected devices.
4377 for (var i in nodeids) {
4378 - var node = getNodeFromId(nodeids[i]), rights = GetNodeRights(node), added = 0;
4379 - if ((rights & 1) && ((added & 2) == 0)) { added += 2; addedOptions += '<option value=102>' + "Move to device group" + '</option>'; }
4380 - if (((node.conn & 1) != 0) && ((rights & 0x8000) != 0) && ((added & 1) == 0)) { added += 1; addedOptions += '<option value=104>' + "Uninstall Agent" + '</option>'; }
4378 + var node = getNodeFromId(nodeids[i]), rights = GetNodeRights(node);
4379 + if ((rights & 1) && ((added & 2) == 0)) { added |= 2; addedOptions += '<option value=102>' + "Move to device group" + '</option>'; }
4380 + if (((node.conn & 1) != 0) && ((rights & 0x8000) != 0) && ((added & 1) == 0)) { added |= 1; addedOptions += '<option value=104>' + "Uninstall Agent" + '</option>'; }
4381 }
4382
4383 var x = "Select an operation to perform on all selected devices. Actions will be performed only with proper rights." + '<br /><br />';