showNotesPanel in device view (#5543)

Signed-off-by: si458 <simonsmith5521@gmail.com>

Simon Smith committed Nov 12, 2023 at 18:13 UTC c05cbeae88026b36d50a03f76167a7177fd5ba5c
6 files changed +56 -3
docs/docs/meshcentral/config.md
+5
@@ -1658,6 +1658,11 @@ See description for information about each item.
1658 "default": false,
1659 "description": "When enabled, this will hide the power timeline in the web ui"
1660 },
1661 + "showNotesPanel": {
1662 + "type": "boolean",
1663 + "default": false,
1664 + "description": "When enabled, this will show the notes panel in the device view"
1665 + },
1666 "agentInviteCodes": {
1667 "type": "boolean",
1668 "default": false,
meshcentral-config-schema.json
+5
@@ -1651,6 +1651,11 @@
1651 "default": false,
1652 "description": "When enabled, this will hide the power timeline in the web ui"
1653 },
1654 + "showNotesPanel": {
1655 + "type": "boolean",
1656 + "default": false,
1657 + "description": "When enabled, this will show the notes panel in the device view"
1658 + },
1659 "agentInviteCodes": {
1660 "type": "boolean",
1661 "default": false,
public/styles/style.css
+21 -1
@@ -3247,4 +3247,24 @@ a {
3247 padding: 6px 12px;
3248 border: 1px solid #ccc;
3249 border-top: none;
3250 -}
\ No newline at end of file
3250 +}
3251 +
3252 +#notesPanel table {
3253 + color: black;
3254 + background-color: #EEE;
3255 + border-color: #AAA;
3256 + border-width: 1px;
3257 + border-style: solid;
3258 + border-collapse: collapse;
3259 + width: 100%;
3260 +}
3261 +
3262 +#notesPanel thead {
3263 + background-color: #AAA;
3264 + font-weight: bold;
3265 +}
3266 +
3267 +#notesPanel thead tr {
3268 + background-color: #AAA;
3269 + font-weight: bold;
3270 +}
sample-config-advanced.json
+1
@@ -191,6 +191,7 @@
191 "_ipkvm": false,
192 "minify": true,
193 "_hidePowerTimeline": true,
194 + "_showNotesPanel": true,
195 "_newAccounts": true,
196 "_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
197 "_userNameIsEmail": true,
views/default.handlebars
+22 -1
@@ -611,6 +611,18 @@
611 <td style=width:auto valign=top>
612 <div id=p10html></div>
613 </td>
614 + <td style=width:100px;display:none id=notesPanel valign=top>
615 + <table>
616 + <thead>
617 + <tr><th>Notes</th></tr>
618 + </thead>
619 + <tbody>
620 + <tr>
621 + <td><textarea id=notesPanelArea readonly style=width:300px;height:200px;resize:none;overflow-y:scroll></textarea></td>
622 + </tr>
623 + </tbody>
624 + </table>
625 + </td>
626 <td style=width:20px></td>
627 <td style=width:200px;vertical-align:top;position:relative valign=top>
628 <div class="deviceNotifyLargeDot">
@@ -1485,6 +1497,7 @@
1497 var webRelayPort = parseInt('{{{webRelayPort}}}');
1498 var webRelayDns = '{{{webRelayDns}}}';
1499 var hidePowerTimeline = {{{hidePowerTimeline}}};
1500 + var showNotesPanel = {{{showNotesPanel}}};
1501 var sessionRefreshTimer = null;
1502 var domain = '{{{domain}}}';
1503 var domainUrl = '{{{domainurl}}}';
@@ -2871,6 +2884,9 @@
2884 QV('idx_dlgOkButton', true);
2885 focusTextBox('d2devNotes');
2886 }
2887 + }else{
2888 + if (message.notes) { QH('notesPanelArea', decodeURIComponent(message.notes)); } else { QH('notesPanelArea', ''); }
2889 + if (showNotesPanel && message.notes) { QV('notesPanel',true); }else{ QV('notesPanel', false); }
2890 }
2891 break;
2892 }
@@ -7680,6 +7696,7 @@
7696 meshserver.send({ action: 'lastconnect', nodeid: currentNode._id });
7697 meshserver.send({ action: 'getsysinfo', nodeid: currentNode._id });
7698 meshserver.send({ action: 'getnetworkinfo', nodeid: currentNode._id });
7699 + meshserver.send({ action: 'getNotes', id: currentNode._id });
7700 QH('p17info2', '');
7701 }
7702
@@ -7964,7 +7981,11 @@
7981 meshserver.send({ action: 'getNotes', id: decodeURIComponent(noteid) });
7982 }
7983
7967 - function showNotesEx(buttons, tag) { meshserver.send({ action: 'setNotes', id: decodeURIComponent(tag), notes: encodeURIComponentEx(Q('d2devNotes').value) }); }
7984 + function showNotesEx(buttons, tag) {
7985 + QH('notesPanelArea', Q('d2devNotes').value);
7986 + meshserver.send({ action: 'setNotes', id: decodeURIComponent(tag), notes: encodeURIComponentEx(Q('d2devNotes').value) });
7987 + if (showNotesPanel && Q('d2devNotes').value != '') { QV('notesPanel',true); }else{ QV('notesPanel', false); }
7988 + }
7989
7990 function openIpKvmRemoteControl(nodeid) {
7991 if (xxdialogMode) return;
webserver.js
+2 -1
@@ -3105,7 +3105,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
3105 pluginHandler: (parent.pluginHandler == null) ? 'null' : parent.pluginHandler.prepExports(),
3106 webRelayPort: ((args.relaydns != null) ? ((typeof args.aliasport == 'number') ? args.aliasport : args.port) : ((parent.webrelayserver != null) ? ((typeof args.relayaliasport == 'number') ? args.relayaliasport : parent.webrelayserver.port) : 0)),
3107 webRelayDns: ((args.relaydns != null) ? args.relaydns[0] : ''),
3108 - hidePowerTimeline: (domain.hidepowertimeline ? 'true' : 'false')
3108 + hidePowerTimeline: (domain.hidepowertimeline ? 'true' : 'false'),
3109 + showNotesPanel: (domain.shownotespanel ? 'true' : 'false')
3110 }, dbGetFunc.req, domain), user);
3111 }
3112 xdbGetFunc.req = req;