add old style alertbox
* add old style alertbox Signed-off-by: si458 <simonsmith5521@gmail.com>
Simon Smith committed
Dec 14, 2023 at 14:24 UTC
947d84316b229f5a98a7709f471e1b20cef88408
2 files changed
+11
-1
agents/meshcore.js
+8
@@ -1466,6 +1466,14 @@ function handleServerCommand(data) {
1466
sendConsoleText('localappMsg: ' + data.appid + ', ' + JSON.stringify(data.value));
1467
if (data.appid != null) { sendToRegisteredApp(data.appid, data.value); } else { broadcastToRegisteredApps(data.value); }
1468
break;
1469
+ case 'alertbox': {
1470
+ // Display an old style alert box
1471
+ if (data.title && data.msg) {
1472
+ MeshServerLogEx(18, [data.title, data.msg], "Displaying alert box, title=" + data.title + ", message=" + data.msg, data);
1473
+ try { require('message-box').create(data.title, data.msg, 9999, 1).then(function () { }).catch(function () { }); } catch (ex) { }
1474
+ }
1475
+ break;
1476
+ }
1477
default:
1478
// Unknown action, ignore it.
1479
break;
views/default.handlebars
+3
-1
@@ -5767,7 +5767,7 @@
5767
} else if (op == 108) {
5768
// Device notification
5769
var x = "Perform batch device notification" + '<br /><br />';
5770
- x += '<select id=d2deviceop style=width:100%><option value=2>' + "Toast Notification" + '</option><option value=1>' + "Message Box" + '</option></select>';
5770
+ x += '<select id=d2deviceop style=width:100%><option value=2>' + "Toast Notification" + '</option><option value=1>' + "Message Box" + '</option><option value=3>' + "Alert Box" + '</option></select>';
5771
x += '<br /><input id=dp2notifyTitle maxlength=256 placeholder="' + "Title" + '" style=width:100% />';
5772
x += '<textarea id=d2notifyMsg style=background-color:#fcf3cf;width:100%;height:140px;resize:none;overflow-y:scroll></textarea>';
5773
setDialogMode(2, "Device Notification", 3, d2groupActionFunctionNotifyExec, x);
@@ -5820,6 +5820,8 @@
5820
for (var i = 0; i < chkNodeIds.length; i++) { meshserver.send({ action: 'msg', type: 'messagebox', nodeid: chkNodeIds[i], title: title, msg: msg }); }
5821
} else if (op == 2) { // Toast
5822
meshserver.send({ action: 'toast', nodeids: chkNodeIds, title: title, msg: msg });
5823
+ } else if (op == 3) { // Old Style MessageBox
5824
+ for (var i = 0; i < chkNodeIds.length; i++) { meshserver.send({ action: 'msg', type: 'alertbox', nodeid: chkNodeIds[i], title: title, msg: msg }); }
5825
}
5826
}
5827