Merge pull request #1793 from jbtwo/fix-ups-settings-page

Fix UPS settings page when config contains empty values
This commit is contained in:
tom mortensen
2024-07-27 01:11:47 -07:00
committed by GitHub

View File

@@ -14,10 +14,15 @@ Tag="battery-3"
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
?>
<script>
function getUPSstatus() {
$.post('/plugins/dynamix.apcupsd/include/UPSstatus.php',{level:<?=$cfg['BATTERYLEVEL']?>,runtime:<?=$cfg['MINUTES']?>},function(data) {
var batteryLevel = "<?= _var($cfg,'BATTERYLEVEL',0) ?>";
var batteryRuntime = "<?= _var($cfg,'MINUTES',0) ?>";
$.post('/plugins/dynamix.apcupsd/include/UPSstatus.php',{level:batteryLevel,runtime:batteryRuntime},function(data) {
data = data.split('\n');
$('#ups_summary').html(data[0]);
$('#ups_status').html(data[1]);