Deselect devices after group operations.

Ylian Saint-Hilaire committed May 29, 2020 at 15:17 UTC a1994b63db0eec8b3f47a804fb928cfbe22b6126
1 file changed +13 -2
views/default.handlebars
+13 -2
@@ -4038,11 +4038,17 @@
4038 return nodeids;
4039 }
4040
4041 + function uncheckAllDevices() {
4042 + var elements = document.getElementsByClassName('DeviceCheckbox');
4043 + for (var i=0;i<elements.length;i++) { elements[i].checked = false; }
4044 + }
4045 +
4046 function groupActionFunctionEx() {
4047 var op = Q('d2groupop').value;
4048 if (op == 100) {
4049 // Group wake
4050 meshserver.send({ action: 'wakedevices', nodeids: getCheckedDevices() });
4051 + uncheckAllDevices();
4052 } else if (op == 101) {
4053 // Group delete, ask for confirmation
4054 var x = "Confirm delete selected devices(s)?" + '<br /><br />';
@@ -4064,6 +4070,7 @@
4070 } else {
4071 // Power operation
4072 meshserver.send({ action: 'poweraction', nodeids: getCheckedDevices(), actiontype: parseInt(op) });
4073 + uncheckAllDevices();
4074 }
4075 }
4076
@@ -4082,6 +4089,7 @@
4089 csv += '"' + n._id.split(',').join('') + '","' + n.name.split(',').join('') + '","' + (n.rname?(n.rname.split(',').join('')):'') + '","' + (n.host?(n.host.split(',').join('')):'') + '","' + n.icon + '","' + (n.ip?n.ip:'') + '","' + (n.osdesc?(n.osdesc.split(',').join('')):'') + '","' + n.state + '","' + meshes[n.meshid].name.split(',').join('') + '","' + (n.conn?n.conn:'') + '","' + (n.pwr?n.pwr:'') + '"\r\n';
4090 }
4091 saveAs(new Blob([csv], { type: 'application/octet-stream' }), "devicelist.csv");
4092 + uncheckAllDevices();
4093 return false;
4094 }
4095
@@ -4089,11 +4097,12 @@
4097 var chkNodeIds = getCheckedDevices(), r = [];
4098 for (var i in chkNodeIds) { r.push(getNodeFromId(chkNodeIds[i])); }
4099 saveAs(new Blob([JSON.stringify(r, null, 2)], { type: 'application/octet-stream' }), "devicelist.json");
4100 + uncheckAllDevices();
4101 return false;
4102 }
4103
4104 function d2groupActionFunctionDelCheck() { QE('idx_dlgOkButton', Q('d2check').checked); }
4096 - function d2groupActionFunctionDelExec() { meshserver.send({ action: 'removedevices', nodeids: getCheckedDevices() }); }
4105 + function d2groupActionFunctionDelExec() { meshserver.send({ action: 'removedevices', nodeids: getCheckedDevices() }); uncheckAllDevices(); }
4106
4107 function onSortSelectChange(skipsave) {
4108 sort = document.getElementById('sortselect').selectedIndex;
@@ -5642,6 +5651,7 @@
5651
5652 function p10showSendMqttMsgDialogEx(b, nodeids) {
5653 meshserver.send({ action: 'sendmqttmsg', nodeids: nodeids, topic: Q('dp2topic').value, msg: Q('dp2msg').value });
5654 + uncheckAllDevices();
5655 }
5656
5657 function p10showSendUninstallAgentDialog(nodeids) {
@@ -5657,7 +5667,7 @@
5667 }
5668
5669 function p10validateSendUninstallAgentDialog() { QE('idx_dlgOkButton', Q('p10check').checked); }
5660 - function p10showSendUninstallAgentDialogEx(b, nodeids) { meshserver.send({ action: 'uninstallagent', nodeids: nodeids }); }
5670 + function p10showSendUninstallAgentDialogEx(b, nodeids) { meshserver.send({ action: 'uninstallagent', nodeids: nodeids }); uncheckAllDevices(); }
5671
5672 function p10showChangeGroupDialog(nodeids) {
5673 if (xxdialogMode) return false;
@@ -5684,6 +5694,7 @@
5694
5695 function p10showChangeGroupDialogEx(b, nodeids) {
5696 meshserver.send({ action: 'changeDeviceMesh', nodeids: nodeids, meshid: Q('p10newGroup').value });
5697 + uncheckAllDevices();
5698 }
5699
5700 function p10showDeleteNodeDialog(nodeid) {