Clean GPU names in dashboard and remove stale servers from DB
All checks were successful
Build-Publish / build (linux/amd64) (push) Successful in 4s
Build-Publish / build (linux/arm64) (push) Successful in 12s
Build-Publish / create-manifest (push) Successful in 2s
Build-Publish / publish-template (push) Successful in 9s

This commit is contained in:
j
2026-03-08 13:29:37 +13:00
parent 5052d4604f
commit 95c20df073
3 changed files with 42 additions and 1 deletions

View File

@@ -197,6 +197,12 @@ def collect_all():
# Update database (all in main collector thread)
with app.app_context():
# Remove servers no longer in config
config_keys = {(e['username'], e['hostname']) for e in entries}
for server in Server.query.all():
if (server.username, server.hostname) not in config_keys:
db.session.delete(server)
for key, (entry, result) in results.items():
server = Server.query.filter_by(
username=entry['username'],
@@ -363,6 +369,32 @@ def temp_color(temp_c):
return '#22c55e'
@app.template_filter('clean_gpu')
def clean_gpu(description):
if not description:
return '-'
s = str(description)
# Strip PCI address prefix (e.g. "01:00.0 ")
import re
s = re.sub(r'^[0-9a-f:.]+\s+', '', s, flags=re.IGNORECASE)
# Strip type prefix
for prefix in ['VGA compatible controller: ', '3D controller: ', 'Display controller: ']:
if s.startswith(prefix):
s = s[len(prefix):]
# Strip common vendor prefixes
for vendor in ['NVIDIA Corporation ', 'Advanced Micro Devices, Inc. ', 'AMD ', 'Intel Corporation ',
'Advanced Micro Devices Inc. ', 'Matrox Electronics Systems Ltd. ']:
if s.startswith(vendor):
s = s[len(vendor):]
# Strip revision suffix
s = re.sub(r'\s*\(rev [0-9a-f]+\)\s*$', '', s, flags=re.IGNORECASE)
# Prefer bracketed name if present (e.g. "GA106 [GeForce RTX 3060]" -> "GeForce RTX 3060")
bracket = re.search(r'\[(.+)\]', s)
if bracket:
s = bracket.group(1)
return s.strip()
@app.template_filter('usage_color')
def usage_color(percent):
try:

View File

@@ -144,6 +144,15 @@ main {
.server-os {
font-size: 0.75rem;
color: #64748b;
margin-bottom: 2px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.server-hw {
font-size: 0.7rem;
color: #475569;
margin-bottom: 10px;
overflow: hidden;
text-overflow: ellipsis;

View File

@@ -171,7 +171,7 @@
<h4>GPUs</h4>
<table>
{% for gpu in gpus %}
<tr><td>GPU {{ loop.index0 }}</td><td>{{ gpu.get('description', '-') }}</td></tr>
<tr><td>GPU {{ loop.index0 }}</td><td>{{ gpu.get('description', '-')|clean_gpu }}</td></tr>
{% endfor %}
</table>
</div>