55 lines
3.9 KiB
HTML
55 lines
3.9 KiB
HTML
<div id="services" class="panel" hx-get="/api/services" hx-trigger="every 15s" hx-swap="outerHTML" hx-include="#svc-filters">
|
|
{% if error %}<div class="alert">{{ error }}</div>{% endif %}
|
|
<div class="muted small">system: {{ state }} · {{ units | length }} units</div>
|
|
<div class="table-wrap">
|
|
<table class="table">
|
|
<colgroup>
|
|
<col style="width: 30px">
|
|
<col style="width: 250px">
|
|
<col>
|
|
<col style="width: 130px">
|
|
<col style="width: 90px">
|
|
<col style="width: 190px">
|
|
</colgroup>
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th><a href="#" class="sortlink{% if sort == "name" %} active{% endif %}" data-form="svc-filters" data-sort="name" data-order="{% if sort == "name" and order == "asc" %}desc{% else %}asc{% endif %}">Unit{% if sort == "name" %} {{ "↓" if order == "desc" else "↑" }}{% endif %}</a></th>
|
|
<th class="muted">Description</th>
|
|
<th><a href="#" class="sortlink{% if sort == "state" %} active{% endif %}" data-form="svc-filters" data-sort="state" data-order="{% if sort == "state" and order == "asc" %}desc{% else %}asc{% endif %}">State{% if sort == "state" %} {{ "↓" if order == "desc" else "↑" }}{% endif %}</a></th>
|
|
<th><a href="#" class="sortlink{% if sort == "enabled" %} active{% endif %}" data-form="svc-filters" data-sort="enabled" data-order="{% if sort == "enabled" and order == "asc" %}desc{% else %}asc{% endif %}">Enabled{% if sort == "enabled" %} {{ "↓" if order == "desc" else "↑" }}{% endif %}</a></th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for u in units %}
|
|
{% set dot = "dot-dead" %}
|
|
{% if u.sub in ("running", "exited") and u.active == "active" %}{% set dot = "dot-run" %}{% endif %}
|
|
{% if u.active == "failed" %}{% set dot = "dot-failed" %}{% endif %}
|
|
{% if u.sub in ("activating", "deactivating", "reloading") %}{% set dot = "dot-busy" %}{% endif %}
|
|
<tr class="svc-row" data-unit="{{ u.name }}">
|
|
<td><span class="dot {{ dot }}"></span></td>
|
|
<td class="mono svc-name" role="button" tabindex="0" title="click for details"><span class="svc-caret">▸</span>{{ u.name }}</td>
|
|
<td class="muted cell-clip" title="{{ u.desc }}">{{ u.desc }}</td>
|
|
<td class="muted">{{ u.active }}{% if u.sub and u.sub not in ("running", "dead", "exited") %} <span class="small">({{ u.sub }})</span>{% endif %}</td>
|
|
<td class="muted">{{ u.enabled or "—" }}</td>
|
|
<td class="actions">
|
|
{% if u.active != "active" %}
|
|
<button class="btn" hx-post="/api/services/{{ u.name }}/action" hx-vals='{"action":"start"}' hx-include="#svc-filters" hx-target="#services" hx-swap="outerHTML">start</button>
|
|
{% else %}
|
|
<button class="btn" hx-post="/api/services/{{ u.name }}/action" hx-vals='{"action":"stop"}' hx-include="#svc-filters" hx-target="#services" hx-swap="outerHTML" hx-confirm="Stop {{ u.name }}?">stop</button>
|
|
<button class="btn" hx-post="/api/services/{{ u.name }}/action" hx-vals='{"action":"restart"}' hx-include="#svc-filters" hx-target="#services" hx-swap="outerHTML" hx-confirm="Restart {{ u.name }}?">restart</button>
|
|
{% endif %}
|
|
<button class="btn" hx-post="/api/services/{{ u.name }}/action" hx-vals='{"action":"{% if u.enabled == "enabled" or u.enabled == "indirect" or u.enabled == "static" %}disable{% else %}enable{% endif %}"}' hx-include="#svc-filters" hx-target="#services" hx-swap="outerHTML">{% if u.enabled == "enabled" or u.enabled == "indirect" or u.enabled == "static" %}disable{% else %}enable{% endif %}</button>
|
|
</td>
|
|
</tr>
|
|
<tr class="svc-detail-row" hidden data-unit="{{ u.name }}">
|
|
<td colspan="6"><div class="svc-detail"></div></td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="6" class="muted">no units match</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|