Link filament spools card on dashboard to FilamentDB (new tab)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
import uuid as _uuid
|
||||
from pathlib import Path
|
||||
|
||||
@@ -42,6 +43,7 @@ def dashboard(request: Request, db: Session = Depends(get_db)):
|
||||
PrintJob.status.in_([JobStatus.queued, JobStatus.printing])
|
||||
).count(),
|
||||
"total_filaments": sum(r.get("rolls_in_stock", 0) for r in get_stock()),
|
||||
"filamentdb_url": os.environ.get("FILAMENTDB_URL", ""),
|
||||
"recent_jobs": db.query(PrintJob).order_by(PrintJob.created_at.desc()).limit(5).all(),
|
||||
})
|
||||
|
||||
|
||||
@@ -25,10 +25,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
<div class="card p-3">
|
||||
<div class="text-secondary small mb-1">Filament Spools</div>
|
||||
<div class="fs-2 fw-bold text-white">{{ total_filaments }}</div>
|
||||
</div>
|
||||
<a href="{{ filamentdb_url }}" target="_blank" rel="noopener" class="text-decoration-none">
|
||||
<div class="card p-3">
|
||||
<div class="text-secondary small mb-1">Filament Spools <i class="bi bi-box-arrow-up-right ms-1" style="font-size:.65rem"></i></div>
|
||||
<div class="fs-2 fw-bold text-white">{{ total_filaments }}</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user