aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-10-03 18:50:01 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-10-03 18:50:01 +0300
commit8c36d69c256ec277b514fa1e25b2a6286e31e334 (patch)
tree12fe7ce3fd627d336214a01f42d4aa9e9728d116
parentdebian/README: update (diff)
parentindex.html: safer DOM generation using jQuery (diff)
downloadlinux-status-8c36d69c256ec277b514fa1e25b2a6286e31e334.tar.gz
linux-status-8c36d69c256ec277b514fa1e25b2a6286e31e334.zip
Merge tag 'v1.0.1' into debian
-rw-r--r--.github/workflows/ci.yml (renamed from .github/workflows/test.yml)6
-rw-r--r--README.md4
-rw-r--r--index.html62
3 files changed, 39 insertions, 33 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yml
index bd96b95..f0e1d49 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/ci.yml
@@ -1,4 +1,4 @@
-name: Test
+name: CI
on:
push:
@@ -7,10 +7,10 @@ on:
jobs:
test:
- runs-on: ubuntu-latest
strategy:
matrix:
- python-version: [3.6, 3.7, 3.8, 3.9]
+ python-version: [3.6, 3.7, 3.8, 3.9, 3.x]
+ runs-on: ubuntu-latest
name: 'Python ${{ matrix.python-version }}'
steps:
- name: Checkout
diff --git a/README.md b/README.md
index 42672bb..09cfd97 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,9 @@
linux-status
============
-[![Test](https://github.com/egor-tensin/linux-status/actions/workflows/test.yml/badge.svg)](https://github.com/egor-tensin/linux-status/actions/workflows/test.yml)
+[![CI](https://github.com/egor-tensin/linux-status/actions/workflows/ci.yml/badge.svg)](https://github.com/egor-tensin/linux-status/actions/workflows/ci.yml)
+[![Packages (Debian)](https://github.com/egor-tensin/linux-status/actions/workflows/debian.yml/badge.svg)](https://github.com/egor-tensin/linux-status/actions/workflows/debian.yml)
+[![Publish (Launchpad)](https://github.com/egor-tensin/linux-status/actions/workflows/ppa.yml/badge.svg)](https://github.com/egor-tensin/linux-status/actions/workflows/ppa.yml)
Simple Linux status web page.
diff --git a/index.html b/index.html
index 0c2911a..7c8c542 100644
--- a/index.html
+++ b/index.html
@@ -111,39 +111,43 @@ function set_system(data) {
var users = [];
+function create_user_block(name, lbl, cmd) {
+ let pre_id = `${lbl}_user_${name}`;
+ let collapse_id = `collapse_${pre_id}`;
+ let button_params = {
+ 'class': 'btn btn-outline-primary btn-sm button-expand',
+ 'data-toggle': 'collapse',
+ 'data-target': '#' + collapse_id
+ };
+ let a_params = {
+ href: '#' + collapse_id,
+ 'data-toggle': 'collapse'
+ };
+ return $('<div/>')
+ .append($('<p/>')
+ .append($('<button/>', button_params).text('+'))
+ .append($('<a/>', a_params)
+ .append($('<code/>').text(cmd))))
+ .append($('<div/>', {'class': 'collapse', id: collapse_id})
+ .append($('<pre/>', {'class': 'pre-scrollable', id: pre_id})))
+ .append($('<hr/>'));
+}
+
function add_user(name) {
if (users.includes(name)) {
return;
}
- let text = `
-<div class="row" id="user_${name}">
- <div class="col">
- <h2>${name}</h2>
- <hr>
- <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_failed_user_${name}">+</button><a href="#collapse_failed_user_${name}" data-toggle="collapse"><code>systemctl --user list-units --failed</code></a></p>
- <div class="collapse show" id="collapse_failed_user_${name}">
- <pre class="pre-scrollable" id="failed_user_${name}"></pre>
- </div>
- <hr>
- <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_overview_user_${name}">+</button><a href="#collapse_overview_user_${name}" data-toggle="collapse"><code>systemctl --user status</code></a></p>
- <div class="collapse" id="collapse_overview_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></p>
- <div class="collapse" id="collapse_timers_user_${name}">
- <pre class="pre-scrollable" id="timers_user_${name}"></pre>
- </div>
- <hr>
- <p><button type="button" class="btn btn-outline-primary btn-sm button-expand" data-toggle="collapse" data-target="#collapse_journal_user_${name}">+</button><a href="#collapse_journal_user_${name}" data-toggle="collapse"><code>journalctl --user -b --lines=20</code></a></p>
- <div class="collapse" id="collapse_journal_user_${name}">
- <pre class="pre-scrollable" id="journal_user_${name}"></pre>
- </div>
- <hr>
- </div>
-</div>
-`;
- $('#users').append(text);
+ let container = $('<div/>', {'class': 'row', id: 'user_' + name})
+ .append($('<div/>', {'class': 'col'})
+ .append($('<h2/>').text(name))
+ .append($('<hr/>'))
+ .append(create_user_block(name, 'failed', 'systemctl --user list-units --failed'))
+ .append(create_user_block(name, 'overview', 'systemctl --user status'))
+ .append(create_user_block(name, 'timers', 'systemctl --user list-timers --all'))
+ .append(create_user_block(name, 'journal', 'journalctl --user -b --lines=20')));
+
+ $('#users').append(container);
+ $('#collapse_failed_user_' + name).addClass('show');
users.push(name);
}