hide powerstate with hidepowerstate

Signed-off-by: Simon Smith <simonsmith5521@gmail.com>
This commit is contained in:
Simon Smith 2023-10-06 12:01:04 +00:00
parent 6d27ff5969
commit 8b8ec48430
5 changed files with 17 additions and 2 deletions

View File

@ -1642,6 +1642,11 @@ 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": {
"type": "boolean",
"default": false,
"description": "When enabled, this will hide the power state table in the web ui"
},
"agentInviteCodes": { "agentInviteCodes": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,

View File

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

View File

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

View File

@ -8315,8 +8315,11 @@
// 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}}};
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>'); 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
function powerColor(x) { if (x < powerColorTable.length) { return powerColorTable[x]; } return 'pwsYellow'; } function powerColor(x) { if (x < powerColorTable.length) { return powerColorTable[x]; } return 'pwsYellow'; }

View File

@ -3104,7 +3104,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
amtscanoptions: amtscanoptions, amtscanoptions: amtscanoptions,
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')
}, dbGetFunc.req, domain), user); }, dbGetFunc.req, domain), user);
} }
xdbGetFunc.req = req; xdbGetFunc.req = req;