From 65f445c8786a2fc37920bea6c17cb5010b72dfad Mon Sep 17 00:00:00 2001 From: bergware Date: Mon, 25 Dec 2023 03:20:24 +0100 Subject: [PATCH] Dashboard: add NTP info to title attribute of current time --- emhttp/plugins/dynamix/DashStats.page | 9 +++++---- emhttp/plugins/dynamix/include/DashboardApps.php | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/emhttp/plugins/dynamix/DashStats.page b/emhttp/plugins/dynamix/DashStats.page index 91d77db84..063cbba96 100644 --- a/emhttp/plugins/dynamix/DashStats.page +++ b/emhttp/plugins/dynamix/DashStats.page @@ -209,7 +209,7 @@ switch ($theme) {
-


+


_(Model)_


_(Registration)_
Unraid OS

_(Uptime)_
@@ -1118,7 +1118,7 @@ function StopArray() { } function StopArrayNow() { $('span.hand').prop('onclick',null).off('click').addClass('busy').css({'cursor':'default'}); - $.post('/update.htm',{startState:'',cmdStop:'Stop',csrf_token:''},function(){refresh();}); + $.post('/update.htm',{cmdStop:'Stop'},function(){refresh();}); } function StartArray() { @@ -1129,7 +1129,7 @@ function StartArray() { } function StartArrayNow() { $('span.hand').prop('onclick',null).off('click').addClass('busy').css({'cursor':'default'}); - $.post('/update.htm',{startState:'',cmdStart:'Start',csrf_token:''},function(){refresh();}); + $.post('/update.htm',{cmdStart:'Start'},function(){refresh();}); } function Reboot() { @@ -1204,6 +1204,7 @@ function addProperties() { $('div#sys1').hover(function(){$('.sys1').hide();$('.var1').show();},function(){$('.sys1').show();$('.var1').hide();}); $('div#sys2').hover(function(){$('.sys2').hide();$('.var2').show();},function(){$('.sys2').show();$('.var2').hide();}); $('div#sys3').hover(function(){$('.sys3').hide();$('.var3').show();},function(){$('.sys3').show();$('.var3').hide();}); + $('#current_time').hover(function(){$.post('/webGui/include/DashboardApps.php',{ntp:'ntp'},function(ntp){$('#current_time').prop('title',ntp+"\n_(Go to date and time settings)_");});}); } function showContent() { var count = {'db-box1':$('table#db-box1 tbody').length, 'db-box2':$('table#db-box2 tbody').length, 'db-box3':$('table#db-box3 tbody').length} @@ -1381,7 +1382,7 @@ function selectsnapshot(uuid, name ,snaps, opt, getlist){ box.find('#targetsnapl').html(snaps); if (getlist) { var only = (opt == "remove") ? 0 : 1; - $.post("/plugins/dynamix.vm.manager/include/VMajax.php", {action:"snap-images", uuid:uuid, snapshotname:snaps, only:only}, function(data){if (data.html) box.find('#targetsnapimages').html(data.html);},'json'); + $.post("/plugins/dynamix.vm.manager/include/VMajax.php",{action:"snap-images",uuid:uuid,snapshotname:snaps,only:only},function(data){if (data.html) box.find('#targetsnapimages').html(data.html);},'json'); } document.getElementById("targetsnapfspc").checked = true; box.dialog({ diff --git a/emhttp/plugins/dynamix/include/DashboardApps.php b/emhttp/plugins/dynamix/include/DashboardApps.php index 813178a3f..f14af458e 100644 --- a/emhttp/plugins/dynamix/include/DashboardApps.php +++ b/emhttp/plugins/dynamix/include/DashboardApps.php @@ -21,6 +21,11 @@ require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php"; $_SERVER['REQUEST_URI'] = 'dashboard'; require_once "$docroot/webGui/include/Translations.php"; +if (isset($_POST['ntp'])) { + $ntp = exec("ntpq -pn|awk '{if (NR>3 && $2!=\".INIT.\") c++} END {print c}'"); + die($ntp ? sprintf(_('Clock synchronized with %s NTP server'.($ntp==1?'':'s')),$ntp) : _('Clock is unsynchronized with no NTP servers')); +} + if ($_POST['docker']) { $user_prefs = $dockerManPaths['user-prefs']; $DockerClient = new DockerClient();