1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-02-12 11:01:52 +00:00

rename hidepowerstate to hidepowertimeline

This commit is contained in:
Simon Smith 2023-10-06 12:31:25 +00:00
parent 8b8ec48430
commit 82c94cdf9d
6 changed files with 11 additions and 12 deletions

View file

@ -1642,10 +1642,10 @@ See description for information about each item.
"type": "object", "type": "object",
"description": "LDAP options passed to ldapauth-fork" "description": "LDAP options passed to ldapauth-fork"
}, },
"hidePowerState": { "hidePowerTimeline": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "When enabled, this will hide the power state table in the web ui" "description": "When enabled, this will hide the power timeline in the web ui"
}, },
"agentInviteCodes": { "agentInviteCodes": {
"type": "boolean", "type": "boolean",

View file

@ -1640,10 +1640,10 @@
"type": "object", "type": "object",
"description": "LDAP options passed to ldapauth-fork" "description": "LDAP options passed to ldapauth-fork"
}, },
"hidePowerState": { "hidePowerTimeline": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "When enabled, this will hide the power state table in the web ui" "description": "When enabled, this will hide the power timeline in the web ui"
}, },
"agentInviteCodes": { "agentInviteCodes": {
"type": "boolean", "type": "boolean",

View file

@ -189,7 +189,7 @@
"_agentKey": [ "abc", "123" ], "_agentKey": [ "abc", "123" ],
"_ipkvm": false, "_ipkvm": false,
"minify": true, "minify": true,
"_hidePowerState": true, "_hidePowerTimeline": true,
"_newAccounts": true, "_newAccounts": true,
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ], "_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
"_userNameIsEmail": true, "_userNameIsEmail": true,

View file

@ -1250,6 +1250,7 @@
var logoutControls = JSON.parse(decodeURIComponent('{{{logoutControls}}}')); var logoutControls = JSON.parse(decodeURIComponent('{{{logoutControls}}}'));
var authCookieRenewTimer = null; var authCookieRenewTimer = null;
var webRelayPort = parseInt('{{{webRelayPort}}}'); var webRelayPort = parseInt('{{{webRelayPort}}}');
var hidePowerTimeline = {{{hidePowerTimeline}}};
var webRelayDns = '{{{webRelayDns}}}'; var webRelayDns = '{{{webRelayDns}}}';
var meshserver = null; var meshserver = null;
var xdr = null; var xdr = null;
@ -3917,7 +3918,7 @@
// Draw device power bars. The bars are 766px wide. // Draw device power bars. The bars are 766px wide.
function drawDeviceTimeline() { function drawDeviceTimeline() {
if (currentNode.mtype == 3) { QH('p10html2', '<br />'); return; } if (currentNode.mtype == 3 || hidePowerTimeline) { QH('p10html2', '<br />'); return; }
var timeline = null, now = Date.now(); var timeline = null, now = Date.now();
if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; } if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; }

View file

@ -1473,6 +1473,7 @@
var sessionTime = parseInt('{{{sessiontime}}}'); var sessionTime = parseInt('{{{sessiontime}}}');
var webRelayPort = parseInt('{{{webRelayPort}}}'); var webRelayPort = parseInt('{{{webRelayPort}}}');
var webRelayDns = '{{{webRelayDns}}}'; var webRelayDns = '{{{webRelayDns}}}';
var hidePowerTimeline = {{{hidePowerTimeline}}};
var sessionRefreshTimer = null; var sessionRefreshTimer = null;
var domain = '{{{domain}}}'; var domain = '{{{domain}}}';
var domainUrl = '{{{domainurl}}}'; var domainUrl = '{{{domainurl}}}';
@ -8267,7 +8268,7 @@
// Draw device power bars. The bars are 766px wide. // Draw device power bars. The bars are 766px wide.
function drawDeviceTimeline() { function drawDeviceTimeline() {
if ((currentNode == null) || (xxcurrentView < 10) || (xxcurrentView > 19) || (currentNode.mtype == 3)) return; if ((currentNode == null) || (xxcurrentView < 10) || (xxcurrentView > 19) || (currentNode.mtype == 3) || (hidePowerTimeline)) return;
var timeline = null, now = Date.now(); var timeline = null, now = Date.now();
if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; } if (currentNode._id == powerTimelineNode) { timeline = powerTimeline; }
@ -8315,10 +8316,7 @@
// Add the language and timezone of the browser to the server so the server can localize the time correctly. // Add the language and timezone of the browser to the server so the server can localize the time correctly.
var tz = ''; var tz = '';
try { tz = '&tz=' + encodeURIComponentEx(Intl.DateTimeFormat().resolvedOptions().timeZone); } catch (ex) {} try { tz = '&tz=' + encodeURIComponentEx(Intl.DateTimeFormat().resolvedOptions().timeZone); } catch (ex) {}
const hidePowerState = {{{hidePowerState}}}; 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>');
if(!hidePowerState){
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>');
}
} }
// Return a color for the given power state // Return a color for the given power state

View file

@ -3105,7 +3105,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
pluginHandler: (parent.pluginHandler == null) ? 'null' : parent.pluginHandler.prepExports(), 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)), 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] : ''), webRelayDns: ((args.relaydns != null) ? args.relaydns[0] : ''),
hidePowerState: (domain.hidepowerstate ? 'true' : 'false') hidePowerTimeline: (domain.hidepowertimeline ? 'true' : 'false')
}, dbGetFunc.req, domain), user); }, dbGetFunc.req, domain), user);
} }
xdbGetFunc.req = req; xdbGetFunc.req = req;