mirror of
https://github.com/RunLit/Bambu-Run.git
synced 2026-06-22 22:19:03 +01:00
Add multi-AMS support: per-unit snapshot/usage tracking, grouped dashboard panels with real type labels, and dual-nozzle card UX fixes. Fixes a real-world AMS info-code parsing bug found by inspecting live H2C data.
This commit is contained in:
@@ -64,3 +64,93 @@
|
||||
opacity: 0.9;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
/* AMS unit type colors — CSS variables so RAE/standalone can override per theme */
|
||||
:root {
|
||||
--ams-badge-ams: #6c757d;
|
||||
--ams-badge-ams-2-pro: #0d6efd;
|
||||
--ams-badge-ams-ht: #fd7e14;
|
||||
--ams-group-border-color: rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
[data-coreui-theme="dark"] {
|
||||
--ams-group-border-color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.ams-badge-ams {
|
||||
background-color: var(--ams-badge-ams);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ams-badge-ams-2-pro {
|
||||
background-color: var(--ams-badge-ams-2-pro);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ams-badge-ams-ht {
|
||||
background-color: var(--ams-badge-ams-ht);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ams-filter-pills {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.ams-filter-pill {
|
||||
border-radius: 50rem;
|
||||
padding: 0.25rem 0.9rem;
|
||||
font-size: 0.85rem;
|
||||
border: 1px solid var(--ams-group-border-color);
|
||||
background-color: transparent;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.ams-filter-pill.active {
|
||||
opacity: 1;
|
||||
font-weight: 600;
|
||||
border-color: currentColor;
|
||||
}
|
||||
|
||||
/* Grouped AMS unit panels — wide (multi-slot) units stack one per row,
|
||||
compact (single-slot, e.g. AMS HT) units flow side-by-side and wrap. */
|
||||
.ams-groups {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.ams-group {
|
||||
border-radius: 0.5rem;
|
||||
padding: 0.75rem;
|
||||
border: 1px solid var(--ams-group-border-color);
|
||||
}
|
||||
|
||||
.ams-group--wide {
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
|
||||
.ams-group--compact {
|
||||
flex: 0 1 auto;
|
||||
min-width: 220px;
|
||||
}
|
||||
|
||||
.ams-badge-bg-ams {
|
||||
background-color: color-mix(in srgb, var(--ams-badge-ams) 8%, transparent);
|
||||
border-left: 3px solid var(--ams-badge-ams);
|
||||
}
|
||||
|
||||
.ams-badge-bg-ams-2-pro {
|
||||
background-color: color-mix(in srgb, var(--ams-badge-ams-2-pro) 8%, transparent);
|
||||
border-left: 3px solid var(--ams-badge-ams-2-pro);
|
||||
}
|
||||
|
||||
.ams-badge-bg-ams-ht {
|
||||
background-color: color-mix(in srgb, var(--ams-badge-ams-ht) 8%, transparent);
|
||||
border-left: 3px solid var(--ams-badge-ams-ht);
|
||||
}
|
||||
|
||||
.ams-badge-bg- {
|
||||
border-left: 3px solid var(--ams-group-border-color);
|
||||
}
|
||||
|
||||
@@ -625,8 +625,23 @@ function createFilamentDatasets(filamentTimeline, timestamps) {
|
||||
data: filamentTimeline[key]
|
||||
}));
|
||||
|
||||
// Sort by tray_id (numeric first, External last), then by start_idx (chronological)
|
||||
// Distinct (non-null/undefined) AMS units present in this timeline — used to decide
|
||||
// whether labels need an AMS unit prefix (avoid noise for the common single-AMS case).
|
||||
const distinctUnits = new Set(
|
||||
filamentEntries
|
||||
.map(e => e.data.ams_unit_id)
|
||||
.filter(uid => uid !== null && uid !== undefined)
|
||||
);
|
||||
const showUnitPrefix = distinctUnits.size > 1;
|
||||
|
||||
// Sort by AMS unit, then tray_id (numeric first, External last), then by start_idx
|
||||
filamentEntries.sort((a, b) => {
|
||||
const unitA = a.data.ams_unit_id ?? -1;
|
||||
const unitB = b.data.ams_unit_id ?? -1;
|
||||
if (unitA !== unitB) {
|
||||
return unitA - unitB;
|
||||
}
|
||||
|
||||
const trayA = a.data.tray_id;
|
||||
const trayB = b.data.tray_id;
|
||||
|
||||
@@ -659,6 +674,10 @@ function createFilamentDatasets(filamentTimeline, timestamps) {
|
||||
displayLabel = `Tray ${filament.tray_id} (${filament.type})`;
|
||||
}
|
||||
|
||||
if (showUnitPrefix && filament.ams_type) {
|
||||
displayLabel = `${filament.ams_type} · ${displayLabel}`;
|
||||
}
|
||||
|
||||
// Add brand if it's different from type (avoid redundancy)
|
||||
if (filament.brand && filament.brand !== filament.type && filament.brand !== 'External') {
|
||||
displayLabel += ` - ${filament.brand}`;
|
||||
|
||||
Reference in New Issue
Block a user