54 lines
3.3 KiB
HTML
54 lines
3.3 KiB
HTML
<!-- retoor <retoor@molodetz.nl> -->
|
|
{% extends "admin/base_admin.html" %}
|
|
{% block admin_content %}
|
|
<h1>{{ service.title }}</h1>
|
|
<p class="muted">{{ service.description }}</p>
|
|
<div data-service-monitor="detail" data-service="{{ service.name }}">
|
|
<div class="tabs" role="tablist" data-tabs>
|
|
<button type="button" class="active" data-tab="overview">Overzicht</button>
|
|
<button type="button" data-tab="config">Configuratie</button>
|
|
<button type="button" data-tab="logs">Logs</button>
|
|
</div>
|
|
<section data-panel="overview">
|
|
<p>Status: <span class="status {{ service.status }}" data-field="status">{{ service.status }}</span></p>
|
|
<div class="stat-cards" data-field="cards">
|
|
{% for card in service.metrics.cards or [] %}<div class="stat-card"><span class="value">{{ card.value }}</span><span class="name">{{ card.label }}</span></div>{% endfor %}
|
|
</div>
|
|
<div class="actions">
|
|
<form method="post" action="/admin/services/{{ service.name }}/command"><input type="hidden" name="verb" value="{{ 'stop' if service.enabled else 'start' }}"><button class="button ghost small" type="submit">{{ 'Stop' if service.enabled else 'Start' }}</button></form>
|
|
<form method="post" action="/admin/services/{{ service.name }}/command"><input type="hidden" name="verb" value="run"><button class="button ghost small" type="submit">Nu draaien</button></form>
|
|
<form method="post" action="/admin/services/{{ service.name }}/command"><input type="hidden" name="verb" value="clear"><button class="button ghost small" type="submit">Logs wissen</button></form>
|
|
</div>
|
|
</section>
|
|
<section data-panel="config" hidden>
|
|
<form class="form" method="post" action="/admin/services/{{ service.name }}/config">
|
|
{% for group in service.fields | map(attribute='group') | unique %}
|
|
<span class="label">{{ group }}</span>
|
|
{% for field in service.fields if field.group == group %}
|
|
<div class="field">
|
|
<label for="f-{{ field.key }}">{{ field.label }}</label>
|
|
{% if field.type in ('bool', 'select') %}
|
|
<select id="f-{{ field.key }}" name="{{ field.key }}">
|
|
{% for option in (field.options if field.type == 'select' else ['0', '1']) %}
|
|
<option value="{{ option }}" {% if field.value == option | string %}selected{% endif %}>{{ option }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
{% elif field.type == 'text' %}
|
|
<textarea id="f-{{ field.key }}" name="{{ field.key }}">{{ field.value }}</textarea>
|
|
{% else %}
|
|
<input id="f-{{ field.key }}" type="{{ 'password' if field.secret else ('number' if field.type == 'int' else 'text') }}" name="{{ field.key }}" value="{{ field.value }}" {% if field.minimum is not none %}min="{{ field.minimum }}"{% endif %} {% if field.maximum is not none %}max="{{ field.maximum }}"{% endif %}>
|
|
{% endif %}
|
|
{% if field.help %}<span class="help">{{ field.help }}</span>{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
{% endfor %}
|
|
<div class="actions"><button class="button" type="submit">Opslaan</button></div>
|
|
</form>
|
|
</section>
|
|
<section data-panel="logs" hidden>
|
|
<pre class="log-tail" data-field="logs">{{ service.logs | join('\n') }}</pre>
|
|
</section>
|
|
</div>
|
|
{% endblock %}
|
|
{% block extra_js %}<script type="module" src="{{ static_url('/static/js/utils/ServiceMonitor.js') }}"></script>{% endblock %}
|