From c05cbeae88026b36d50a03f76167a7177fd5ba5c Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Sun, 12 Nov 2023 18:13:21 +0000 Subject: [PATCH] showNotesPanel in device view (#5543) Signed-off-by: si458 --- docs/docs/meshcentral/config.md | 5 +++++ meshcentral-config-schema.json | 5 +++++ public/styles/style.css | 22 +++++++++++++++++++++- sample-config-advanced.json | 1 + views/default.handlebars | 23 ++++++++++++++++++++++- webserver.js | 3 ++- 6 files changed, 56 insertions(+), 3 deletions(-) diff --git a/docs/docs/meshcentral/config.md b/docs/docs/meshcentral/config.md index e2f8946b..94fcae60 100644 --- a/docs/docs/meshcentral/config.md +++ b/docs/docs/meshcentral/config.md @@ -1658,6 +1658,11 @@ See description for information about each item. "default": false, "description": "When enabled, this will hide the power timeline in the web ui" }, + "showNotesPanel": { + "type": "boolean", + "default": false, + "description": "When enabled, this will show the notes panel in the device view" + }, "agentInviteCodes": { "type": "boolean", "default": false, diff --git a/meshcentral-config-schema.json b/meshcentral-config-schema.json index 578d6fc4..9327a183 100644 --- a/meshcentral-config-schema.json +++ b/meshcentral-config-schema.json @@ -1651,6 +1651,11 @@ "default": false, "description": "When enabled, this will hide the power timeline in the web ui" }, + "showNotesPanel": { + "type": "boolean", + "default": false, + "description": "When enabled, this will show the notes panel in the device view" + }, "agentInviteCodes": { "type": "boolean", "default": false, diff --git a/public/styles/style.css b/public/styles/style.css index f5c8436b..fcbc0c8b 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -3247,4 +3247,24 @@ a { padding: 6px 12px; border: 1px solid #ccc; border-top: none; -} \ No newline at end of file +} + +#notesPanel table { + color: black; + background-color: #EEE; + border-color: #AAA; + border-width: 1px; + border-style: solid; + border-collapse: collapse; + width: 100%; +} + +#notesPanel thead { + background-color: #AAA; + font-weight: bold; +} + +#notesPanel thead tr { + background-color: #AAA; + font-weight: bold; +} diff --git a/sample-config-advanced.json b/sample-config-advanced.json index 85272d99..074c6fbc 100644 --- a/sample-config-advanced.json +++ b/sample-config-advanced.json @@ -191,6 +191,7 @@ "_ipkvm": false, "minify": true, "_hidePowerTimeline": true, + "_showNotesPanel": true, "_newAccounts": true, "_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ], "_userNameIsEmail": true, diff --git a/views/default.handlebars b/views/default.handlebars index e3a9b90e..fccf07ba 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -611,6 +611,18 @@
+ + + + + + + + + + +
Notes
+
@@ -1485,6 +1497,7 @@ var webRelayPort = parseInt('{{{webRelayPort}}}'); var webRelayDns = '{{{webRelayDns}}}'; var hidePowerTimeline = {{{hidePowerTimeline}}}; + var showNotesPanel = {{{showNotesPanel}}}; var sessionRefreshTimer = null; var domain = '{{{domain}}}'; var domainUrl = '{{{domainurl}}}'; @@ -2871,6 +2884,9 @@ QV('idx_dlgOkButton', true); focusTextBox('d2devNotes'); } + }else{ + if (message.notes) { QH('notesPanelArea', decodeURIComponent(message.notes)); } else { QH('notesPanelArea', ''); } + if (showNotesPanel && message.notes) { QV('notesPanel',true); }else{ QV('notesPanel', false); } } break; } @@ -7680,6 +7696,7 @@ meshserver.send({ action: 'lastconnect', nodeid: currentNode._id }); meshserver.send({ action: 'getsysinfo', nodeid: currentNode._id }); meshserver.send({ action: 'getnetworkinfo', nodeid: currentNode._id }); + meshserver.send({ action: 'getNotes', id: currentNode._id }); QH('p17info2', ''); } @@ -7964,7 +7981,11 @@ meshserver.send({ action: 'getNotes', id: decodeURIComponent(noteid) }); } - function showNotesEx(buttons, tag) { meshserver.send({ action: 'setNotes', id: decodeURIComponent(tag), notes: encodeURIComponentEx(Q('d2devNotes').value) }); } + function showNotesEx(buttons, tag) { + QH('notesPanelArea', Q('d2devNotes').value); + meshserver.send({ action: 'setNotes', id: decodeURIComponent(tag), notes: encodeURIComponentEx(Q('d2devNotes').value) }); + if (showNotesPanel && Q('d2devNotes').value != '') { QV('notesPanel',true); }else{ QV('notesPanel', false); } + } function openIpKvmRemoteControl(nodeid) { if (xxdialogMode) return; diff --git a/webserver.js b/webserver.js index b9206089..0314bdb1 100644 --- a/webserver.js +++ b/webserver.js @@ -3105,7 +3105,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF pluginHandler: (parent.pluginHandler == null) ? 'null' : parent.pluginHandler.prepExports(), 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)), webRelayDns: ((args.relaydns != null) ? args.relaydns[0] : ''), - hidePowerTimeline: (domain.hidepowertimeline ? 'true' : 'false') + hidePowerTimeline: (domain.hidepowertimeline ? 'true' : 'false'), + showNotesPanel: (domain.shownotespanel ? 'true' : 'false') }, dbGetFunc.req, domain), user); } xdbGetFunc.req = req;