rename hidepowerstate to hidepowertimeline
Simon Smith committed
Oct 6, 2023 at 12:31 UTC
82c94cdf9dd57205637064ee551549d1f9e09f2c
6 files changed
+11
-12
docs/docs/meshcentral/config.md
+2
-2
@@ -1642,10 +1642,10 @@ See description for information about each item.
1642
"type": "object",
1643
"description": "LDAP options passed to ldapauth-fork"
1644
},
1645
- "hidePowerState": {
1645
+ "hidePowerTimeline": {
1646
"type": "boolean",
1647
"default": false,
1648
- "description": "When enabled, this will hide the power state table in the web ui"
1648
+ "description": "When enabled, this will hide the power timeline in the web ui"
1649
},
1650
"agentInviteCodes": {
1651
"type": "boolean",
meshcentral-config-schema.json
+2
-2
@@ -1640,10 +1640,10 @@
1640
"type": "object",
1641
"description": "LDAP options passed to ldapauth-fork"
1642
},
1643
- "hidePowerState": {
1643
+ "hidePowerTimeline": {
1644
"type": "boolean",
1645
"default": false,
1646
- "description": "When enabled, this will hide the power state table in the web ui"
1646
+ "description": "When enabled, this will hide the power timeline in the web ui"
1647
},
1648
"agentInviteCodes": {
1649
"type": "boolean",
sample-config-advanced.json
+1
-1
@@ -189,7 +189,7 @@
189
"_agentKey": [ "abc", "123" ],
190
"_ipkvm": false,
191
"minify": true,
192
- "_hidePowerState": true,
192
+ "_hidePowerTimeline": true,
193
"_newAccounts": true,
194
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
195
"_userNameIsEmail": true,
views/default-mobile.handlebars
+2
-1
@@ -1250,6 +1250,7 @@
1250
var logoutControls = JSON.parse(decodeURIComponent('{{{logoutControls}}}'));
1251
var authCookieRenewTimer = null;
1252
var webRelayPort = parseInt('{{{webRelayPort}}}');
1253
+ var hidePowerTimeline = {{{hidePowerTimeline}}};
1254
var webRelayDns = '{{{webRelayDns}}}';
1255
var meshserver = null;
1256
var xdr = null;
@@ -3917,7 +3918,7 @@
3918
3919
// Draw device power bars. The bars are 766px wide.
3920
function drawDeviceTimeline() {
3920
- if (currentNode.mtype == 3) { QH('p10html2', '<br />'); return; }
3921
+ if (currentNode.mtype == 3 || hidePowerTimeline) { QH('p10html2', '<br />'); return; }
3922
var timeline = null, now = Date.now();
3923
if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; }
3924
views/default.handlebars
+3
-5
@@ -1473,6 +1473,7 @@
1473
var sessionTime = parseInt('{{{sessiontime}}}');
1474
var webRelayPort = parseInt('{{{webRelayPort}}}');
1475
var webRelayDns = '{{{webRelayDns}}}';
1476
+ var hidePowerTimeline = {{{hidePowerTimeline}}};
1477
var sessionRefreshTimer = null;
1478
var domain = '{{{domain}}}';
1479
var domainUrl = '{{{domainurl}}}';
@@ -8267,7 +8268,7 @@
8268
8269
// Draw device power bars. The bars are 766px wide.
8270
function drawDeviceTimeline() {
8270
- if ((currentNode == null) || (xxcurrentView < 10) || (xxcurrentView > 19) || (currentNode.mtype == 3)) return;
8271
+ if ((currentNode == null) || (xxcurrentView < 10) || (xxcurrentView > 19) || (currentNode.mtype == 3) || (hidePowerTimeline)) return;
8272
var timeline = null, now = Date.now();
8273
if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; }
8274
@@ -8315,10 +8316,7 @@
8316
// Add the language and timezone of the browser to the server so the server can localize the time correctly.
8317
var tz = '';
8318
try { tz = '&tz=' + encodeURIComponentEx(Intl.DateTimeFormat().resolvedOptions().timeZone); } catch (ex) {}
8318
- const hidePowerState = {{{hidePowerState}}};
8319
- if(!hidePowerState){
8320
- QH('p10html2', '<table cellpadding=2 cellspacing=0><thead><tr style=><th scope=col style=text-align:center;width:150px>' + "Day" + '</th><th scope=col style=text-align:center><a onclick=downloadFile("devicepowerevents.ashx?id=' + currentNode._id + '&tf=' + new Date().getTimezoneOffset() + '&l=' + encodeURIComponentEx(getLang()) + tz + (urlargs.key?('&key=' + urlargs.key):'') + '",null,true)><img title="' + "Download power events" + '" src="images/link4.png" /></a>' + "7 Day Power State" + '</th></tr></thead><tbody>' + x + '</tbody></table>');
8321
- }
8319
+ QH('p10html2', '<table cellpadding=2 cellspacing=0><thead><tr style=><th scope=col style=text-align:center;width:150px>' + "Day" + '</th><th scope=col style=text-align:center><a onclick=downloadFile("devicepowerevents.ashx?id=' + currentNode._id + '&tf=' + new Date().getTimezoneOffset() + '&l=' + encodeURIComponentEx(getLang()) + tz + (urlargs.key?('&key=' + urlargs.key):'') + '",null,true)><img title="' + "Download power events" + '" src="images/link4.png" /></a>' + "7 Day Power State" + '</th></tr></thead><tbody>' + x + '</tbody></table>');
8320
}
8321
8322
// Return a color for the given power state
webserver.js
+1
-1
@@ -3105,7 +3105,7 @@ 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
- hidePowerState: (domain.hidepowerstate ? 'true' : 'false')
3108
+ hidePowerTimeline: (domain.hidepowertimeline ? 'true' : 'false')
3109
}, dbGetFunc.req, domain), user);
3110
}
3111
xdbGetFunc.req = req;