diff options
Diffstat (limited to '')
-rw-r--r-- | index.html | 32 |
1 files changed, 10 insertions, 22 deletions
@@ -45,7 +45,7 @@ h1, .h1 { <pre class="pre-scrollable" id="overview_system"></pre> </div> <hr> - <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_timers_system">+</button><a href="#collapse_timers_system" data-toggle="collapse"><code>systemctl --system list-timers --all</code></a> <span class="float-right"><small>refreshed every <span id="timers_system_refresh_interval">-</span> seconds</small></span></p> + <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_timers_system">+</button><a href="#collapse_timers_system" data-toggle="collapse"><code>systemctl --system list-timers --all</code></a> <span class="float-right"><small>refreshed every <span id="status_system_refresh_interval">-</span> seconds</small></span></p> <div class="collapse" id="collapse_timers_system"> <pre class="pre-scrollable" id="timers_system"></pre> </div> @@ -121,7 +121,7 @@ function add_user(name) { <pre class="pre-scrollable" id="overview_user_${name}"></pre> </div> <hr> - <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_timers_user_${name}">+</button><a href="#collapse_timers_user_${name}" data-toggle="collapse"><code>systemctl --user list-timers --all</code></a> <span class="float-right"><small>refreshed every <span id="timers_user_refresh_interval_${name}">${timers_refresh_interval_seconds}</span> seconds</small></span></p> + <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_timers_user_${name}">+</button><a href="#collapse_timers_user_${name}" data-toggle="collapse"><code>systemctl --user list-timers --all</code></a> <span class="float-right"><small>refreshed every ${status_refresh_interval_seconds} seconds</small></span></p> <div class="collapse" id="collapse_timers_user_${name}"> <pre class="pre-scrollable" id="timers_user_${name}"></pre> </div> @@ -164,38 +164,26 @@ function set_users(data) { function refresh_status() { $.get('status', function(data) { data = JSON.parse(data); - set_top(data['top']); set_hostname(data['hostname']); set_system(data['system']); set_users(data['user']); }); } -function refresh_timers() { - $.get('timers', function(data) { - data = JSON.parse(data); - set_system(data['system']); - set_users(data['user']); - }); -} +var status_refresh_interval_seconds = 30; -var timers_refresh_interval_seconds = 30; - -function loop_timers() { +function loop_status() { setInterval(function() { - refresh_timers(); - }, timers_refresh_interval_seconds * 1000); - $('#timers_system_refresh_interval').text(timers_refresh_interval_seconds); -} - -function loop() { - loop_top(); - loop_timers(); + refresh_status(); + }, status_refresh_interval_seconds * 1000); + $('#status_system_refresh_interval').text(status_refresh_interval_seconds); } function main() { + refresh_top(); refresh_status(); - loop(); + loop_top(); + loop_status(); } $(function() { |