Compare commits

..

No commits in common. "1cc5a247cf97cb3790f166cc2b8ab59c2cdc0bc3" and "4b56f1fba9bd3ad680b2ea83a89a5bc5bd6e31e3" have entirely different histories.

3 changed files with 2 additions and 104 deletions

30
app.py
View file

@ -813,12 +813,7 @@ def get_unraid_stats():
headers = {"x-api-key": UNRAID_API_KEY, "Content-Type": "application/json"} headers = {"x-api-key": UNRAID_API_KEY, "Content-Type": "application/json"}
query = """{ query = """{
vars { version } vars { version }
array { array { state disks { fsSize fsFree type } }
state
disks { name device fsSize fsFree type temp isSpinning }
caches { name device fsSize fsFree type temp isSpinning }
parities { name device temp isSpinning }
}
}""" }"""
try: try:
resp = requests.post(url, json={"query": query}, headers=headers, resp = requests.post(url, json={"query": query}, headers=headers,
@ -833,26 +828,6 @@ def get_unraid_stats():
free_bytes = sum(int(dk.get("fsFree", 0) or 0) for dk in data_disks) free_bytes = sum(int(dk.get("fsFree", 0) or 0) for dk in data_disks)
used_bytes = total_bytes - free_bytes used_bytes = total_bytes - free_bytes
used_pct = round(used_bytes / total_bytes * 100) if total_bytes else 0 used_pct = round(used_bytes / total_bytes * 100) if total_bytes else 0
def disk_row(dk, with_usage=True):
row = {
"name": dk.get("name") or dk.get("device") or "disk",
"device": dk.get("device", ""),
"temp": dk.get("temp"),
"spinning": dk.get("isSpinning"),
}
if with_usage:
dtotal = int(dk.get("fsSize", 0) or 0)
dfree = int(dk.get("fsFree", 0) or 0)
dused = dtotal - dfree
row.update({
"total": fmt_bytes(dtotal),
"used": fmt_bytes(dused),
"free": fmt_bytes(dfree),
"used_pct": round(dused / dtotal * 100) if dtotal else 0,
})
return row
return { return {
"status": "ok", "status": "ok",
"source": "api", "source": "api",
@ -863,9 +838,6 @@ def get_unraid_stats():
"array_used": fmt_bytes(used_bytes), "array_used": fmt_bytes(used_bytes),
"array_free": fmt_bytes(free_bytes), "array_free": fmt_bytes(free_bytes),
"array_used_pct": used_pct, "array_used_pct": used_pct,
"disks": [disk_row(dk) for dk in data_disks],
"caches": [disk_row(dk) for dk in arr.get("caches", [])],
"parities": [disk_row(dk, with_usage=False) for dk in arr.get("parities", [])],
} }
except Exception: except Exception:
pass pass

View file

@ -433,9 +433,6 @@ dd.is-accent { color: var(--accent); }
width: 100%; width: 100%;
min-height: 38px; min-height: 38px;
} }
/* Sits below the request pills, which use --row-h — match it so the
button reads as one more row rather than a shorter tacked-on control. */
.show-more.show-more-row { min-height: var(--row-h); }
/* ── Indexers ───────────────────────────────────────── */ /* ── Indexers ───────────────────────────────────────── */
/* One indexer per line, built to the same rhythm as the Ombi request rows /* One indexer per line, built to the same rhythm as the Ombi request rows
@ -532,36 +529,6 @@ dd.is-accent { color: var(--accent); }
} }
.req-sub { font-size: var(--fs-xs); color: var(--text-3); } .req-sub { font-size: var(--fs-xs); color: var(--text-3); }
/* ── Storage — per-disk breakdown ──────────────────────── */
/* Same row anatomy as indexer/request rows: name/sub on the left, a status
badge on the right. Data + cache disks get a usage meter; parity disks
(no filesystem) are rendered compact — name and temp only. */
.disk-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.85rem; }
.disk-item {
display: flex;
align-items: center;
gap: 0.7rem;
min-height: var(--row-h);
padding: 0.6rem 0.7rem;
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
min-width: 0;
}
.disk-info { min-width: 0; flex: 1; }
.disk-name {
font-size: var(--fs-sm); font-weight: 600;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.disk-sub { font-size: var(--fs-xs); color: var(--text-3); }
.disk-meter.meter { margin-top: 0.4rem; height: 4px; }
.disk-list-compact { margin-top: 0.5rem; }
.disk-item-compact { justify-content: space-between; padding: 0.5rem 0.7rem; min-height: auto; }
.disk-item-compact .disk-name { flex: 1; }
.badge.temp-ok { background: var(--ok-dim); color: var(--ok); }
.badge.temp-warn { background: var(--warn-dim); color: var(--warn); }
.badge.temp-danger { background: var(--danger-dim); color: var(--danger); }
/* ── Insights top lists ─────────────────────────────── */ /* ── Insights top lists ─────────────────────────────── */
.top-list { display: flex; flex-direction: column; gap: 0.4rem; } .top-list { display: flex; flex-direction: column; gap: 0.4rem; }
.top-item { .top-item {

View file

@ -170,47 +170,6 @@
{% if unraid.source == "local" %} {% if unraid.source == "local" %}
<p class="empty" style="margin-bottom:0;">Container disk usage ({{ unraid.mount }}). Set <code>UNRAID_API_KEY</code> for full array stats.</p> <p class="empty" style="margin-bottom:0;">Container disk usage ({{ unraid.mount }}). Set <code>UNRAID_API_KEY</code> for full array stats.</p>
{% endif %} {% endif %}
{% if unraid.disks or unraid.caches %}
<div class="disk-list">
{% for dk in unraid.disks + unraid.caches %}
{% set dpct = dk.used_pct %}
<div class="disk-item">
<div class="disk-info">
<div class="disk-name" title="{{ dk.device }}">{{ dk.name }}</div>
<div class="disk-sub">{{ dk.used }} of {{ dk.total }}</div>
<div class="meter disk-meter">
<div class="meter-fill {% if dpct > 85 %}danger{% elif dpct > 70 %}warn{% endif %}"
style="width: {{ dpct }}%;"
role="progressbar" aria-valuenow="{{ dpct }}" aria-valuemin="0" aria-valuemax="100"
aria-label="{{ dk.name }} usage"></div>
</div>
</div>
{% if dk.spinning == false %}
<span class="badge idle">Standby</span>
{% elif dk.temp is not none %}
<span class="badge temp-{% if dk.temp >= 55 %}danger{% elif dk.temp >= 45 %}warn{% else %}ok{% endif %}">{{ dk.temp }}&deg;C</span>
{% endif %}
</div>
{% endfor %}
</div>
{% endif %}
{% if unraid.parities %}
<div class="disk-list disk-list-compact">
{% for dk in unraid.parities %}
<div class="disk-item disk-item-compact">
<div class="disk-name" title="{{ dk.device }}">{{ dk.name }}</div>
{% if dk.spinning == false %}
<span class="badge idle">Standby</span>
{% elif dk.temp is not none %}
<span class="badge temp-{% if dk.temp >= 55 %}danger{% elif dk.temp >= 45 %}warn{% else %}ok{% endif %}">{{ dk.temp }}&deg;C</span>
{% endif %}
</div>
{% endfor %}
</div>
{% endif %}
{% else %} {% else %}
{{ service_error("Unraid", unraid.error) }} {{ service_error("Unraid", unraid.error) }}
{% endif %} {% endif %}
@ -403,7 +362,7 @@
{% endfor %} {% endfor %}
</div> </div>
{% if ombi.recent | length > 5 %} {% if ombi.recent | length > 5 %}
<button class="btn btn-quiet show-more show-more-row" onclick="toggleMore(this, 'req-list')" <button class="btn btn-quiet show-more" onclick="toggleMore(this, 'req-list')"
aria-expanded="false">Show {{ ombi.recent | length - 5 }} more</button> aria-expanded="false">Show {{ ombi.recent | length - 5 }} more</button>
{% endif %} {% endif %}
{% else %} {% else %}