aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/index.html
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-01-23 17:13:49 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2022-01-23 17:13:49 +0300
commitd4ccff8141cc4325d5ffc8890a7be96c0a7f12e7 (patch)
treec426dceeaf31822530032382d0b147e2ba0e378b /index.html
parentapp.py: fix loginctl output parsing (diff)
downloadlinux-status-d4ccff8141cc4325d5ffc8890a7be96c0a7f12e7.tar.gz
linux-status-d4ccff8141cc4325d5ffc8890a7be96c0a7f12e7.zip
dump exceptions to browser's console
Diffstat (limited to '')
-rw-r--r--index.html17
1 files changed, 13 insertions, 4 deletions
diff --git a/index.html b/index.html
index 52a45fc..e12adeb 100644
--- a/index.html
+++ b/index.html
@@ -64,12 +64,21 @@ h1, .h1 {
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script>
+function dump_fail(data) {
+ console.log('Response code was: ' + data.status + ' ' + data.statusText);
+ console.log('Response was:\n' + data.responseText);
+}
+
+function get(url, success_callback) {
+ $.get(url, success_callback).fail(dump_fail);
+}
+
function reboot() {
- $.get('reboot');
+ get('reboot');
}
function shutdown() {
- $.get('poweroff');
+ get('poweroff');
}
function set_hostname(data) {
@@ -82,7 +91,7 @@ function set_top(data) {
}
function refresh_top() {
- $.get('top', function(data) {
+ get('top', function(data) {
set_top(JSON.parse(data));
});
}
@@ -183,7 +192,7 @@ function set_users(data) {
}
function refresh_status() {
- $.get('status', function(data) {
+ get('status', function(data) {
data = JSON.parse(data);
set_hostname(data['hostname']);
set_system(data['system']);