diff options
-rw-r--r-- | .github/workflows/ci.yml (renamed from .github/workflows/test.yml) | 6 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | index.html | 62 |
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 @@ -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. @@ -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); } |