aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xapp.py11
-rw-r--r--index.html32
2 files changed, 10 insertions, 33 deletions
diff --git a/app.py b/app.py
index 96ffc1d..a224b0b 100755
--- a/app.py
+++ b/app.py
@@ -283,29 +283,21 @@ class UserInstanceStatusTaskList(Task):
class StatusTask(Task):
def __init__(self):
self.hostname = hostname()
- self.top = TopTask()
self.system = SystemInstanceStatusTask()
self.user = UserInstanceStatusTaskList()
def run(self):
- self.top.run()
self.system.run()
self.user.run()
def result(self):
return {
'hostname': self.hostname,
- 'top': self.top.result(),
'system': self.system.result(),
'user': self.user.result(),
}
-class TimersTask(StatusTask):
- # TODO: I'm going to remove the timers-only endpoint completely.
- pass
-
-
User = namedtuple('User', ['uid', 'name'])
SystemdUser = namedtuple('SystemdUser', ['uid', 'name', 'runtime_dir'])
@@ -396,7 +388,6 @@ def systemd_users():
class Request(Enum):
STATUS = 'status'
- TIMERS = 'timers'
TOP = 'top'
REBOOT = 'reboot'
POWEROFF = 'poweroff'
@@ -413,8 +404,6 @@ class Request(Enum):
def process(self):
if self is Request.STATUS:
return StatusTask().complete()
- if self is Request.TIMERS:
- return TimersTask().complete()
if self is Request.TOP:
return TopTask().complete()
if self is Request.REBOOT:
diff --git a/index.html b/index.html
index 7c8f487..3cbf6cc 100644
--- a/index.html
+++ b/index.html
@@ -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() {