(ui) Replace dashboard host table with host cards

Restructure the dashboard Hosts section into a card per host so snapshot,
run, schedule, retention, and data metrics have room to breathe.

Add reusable host-card styling and keep the same links and operational data
available without forcing everything into a wide table.
This commit is contained in:
2026-05-19 23:46:52 +02:00
parent c2d7342a47
commit f3dcb8a3b9
2 changed files with 98 additions and 37 deletions

View File

@@ -144,6 +144,54 @@
font-size: 12px; font-size: 12px;
gap: 10px; gap: 10px;
} }
.host-list {
display: grid;
gap: 12px;
}
.host-card {
border: 1px solid var(--border);
border-radius: 8px;
padding: 14px;
}
.host-card-header {
align-items: start;
display: flex;
gap: 12px;
justify-content: space-between;
margin-bottom: 12px;
}
.host-card-title {
display: grid;
gap: 3px;
min-width: 0;
}
.host-card-title a {
font-size: 17px;
font-weight: 650;
overflow-wrap: anywhere;
}
.host-card-status {
flex: 0 0 auto;
}
.host-card-grid {
display: grid;
gap: 12px;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.host-card-item {
display: grid;
gap: 3px;
min-width: 0;
}
.host-card-item .label {
color: var(--muted);
font-size: 12px;
font-weight: 650;
text-transform: uppercase;
}
.host-card-item .value {
overflow-wrap: anywhere;
}
.messages { display: grid; gap: 8px; margin-bottom: 18px; } .messages { display: grid; gap: 8px; margin-bottom: 18px; }
.message { .message {
background: var(--panel); background: var(--panel);

View File

@@ -52,61 +52,74 @@
<section class="panel"> <section class="panel">
<h2>Hosts</h2> <h2>Hosts</h2>
<table> <div class="host-list">
<thead> {% for host in hosts %}
<tr> <article class="host-card">
<th>Host</th> <div class="host-card-header">
<th>Address</th> <div class="host-card-title">
<th>Enabled</th> <a href="{% url 'host_detail' host.host %}">{{ host.host }}</a>
<th>Snapshots</th> <span class="muted">{{ host.address }}</span>
<th>Latest Snapshot</th> </div>
<th>Latest Run</th> <div class="host-card-status">
<th>Next Run</th> <span class="status {% if host.enabled %}ok{% else %}skipped{% endif %}">{{ host.enabled|yesno:"enabled,disabled" }}</span>
<th>New Data</th> </div>
<th>Runs</th> </div>
<th>Retention</th> <div class="host-card-grid">
</tr> <div class="host-card-item">
</thead> <div class="label">Latest Snapshot</div>
<tbody> <div class="value">
{% for host in hosts %}
<tr>
<td><a href="{% url 'host_detail' host.host %}">{{ host.host }}</a></td>
<td>{{ host.address }}</td>
<td>{{ host.enabled|yesno:"yes,no" }}</td>
<td>{{ host.snapshot_count }}</td>
<td>
{% if host.latest_snapshot %} {% if host.latest_snapshot %}
<a href="{% url 'snapshot_detail' host.latest_snapshot.id %}">{{ host.latest_snapshot.dirname }}</a> <a href="{% url 'snapshot_detail' host.latest_snapshot.id %}">{{ host.latest_snapshot.dirname }}</a>
<div class="muted">{{ host.latest_snapshot.kind }} {{ host.latest_snapshot.status }}</div> <div class="muted">{{ host.latest_snapshot.kind }} {{ host.latest_snapshot.status }}</div>
{% else %} {% else %}
<span class="muted">none</span> <span class="muted">none</span>
{% endif %} {% endif %}
</td> </div>
<td> </div>
<div class="host-card-item">
<div class="label">Latest Run</div>
<div class="value">
{% if host.stats_summary.latest_run.id %} {% if host.stats_summary.latest_run.id %}
<a href="{% url 'run_detail' host.stats_summary.latest_run.id %}">Run {{ host.stats_summary.latest_run.id }}</a> <a href="{% url 'run_detail' host.stats_summary.latest_run.id %}">Run {{ host.stats_summary.latest_run.id }}</a>
<div class="muted">{{ host.stats_summary.latest_run.run_type }} {{ host.stats_summary.latest_run.duration_seconds|default:"" }}{% if host.stats_summary.latest_run.duration_seconds is not None %}s{% endif %}</div> <div class="muted">{{ host.stats_summary.latest_run.run_type }} {{ host.stats_summary.latest_run.duration_seconds|default:"" }}{% if host.stats_summary.latest_run.duration_seconds is not None %}s{% endif %}</div>
{% else %} {% else %}
<span class="muted">none</span> <span class="muted">none</span>
{% endif %} {% endif %}
</td> </div>
<td> </div>
<div class="host-card-item">
<div class="label">Next Run</div>
<div class="value">
{% if host.next_run_at %} {% if host.next_run_at %}
{{ host.next_run_at|date:"Y-m-d H:i T" }} {{ host.next_run_at|date:"Y-m-d H:i T" }}
<div class="muted">{{ scheduler_timezone }}</div> <div class="muted">{{ scheduler_timezone }}</div>
{% else %} {% else %}
<span class="muted">none</span> <span class="muted">none</span>
{% endif %} {% endif %}
</td> </div>
<td>{{ host.stats_summary.latest_run.rsync.literal_data_bytes|filesizeformat }}</td> </div>
<td>{{ host.run_count }}</td> <div class="host-card-item">
<td>d{{ host.retention_daily }} w{{ host.retention_weekly }} m{{ host.retention_monthly }} y{{ host.retention_yearly }}</td> <div class="label">Snapshots</div>
</tr> <div class="value">{{ host.snapshot_count }}</div>
{% empty %} </div>
<tr><td colspan="10" class="muted">No hosts configured yet.</td></tr> <div class="host-card-item">
{% endfor %} <div class="label">Runs</div>
</tbody> <div class="value">{{ host.run_count }}</div>
</table> </div>
<div class="host-card-item">
<div class="label">New Data</div>
<div class="value">{{ host.stats_summary.latest_run.rsync.literal_data_bytes|filesizeformat }}</div>
</div>
<div class="host-card-item">
<div class="label">Retention</div>
<div class="value">d{{ host.retention_daily }} w{{ host.retention_weekly }} m{{ host.retention_monthly }} y{{ host.retention_yearly }}</div>
</div>
</div>
</article>
{% empty %}
<p class="muted">No hosts configured yet.</p>
{% endfor %}
</div>
</section> </section>
<section class="panel"> <section class="panel">