mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-22 03:49:18 +02:00
Show filament subtypes in all mapping dropdowns (#624)
All filament mapping dropdowns (single-printer, multi-printer, and "Print to Any" model-based) showed only the base material type (e.g. "PLA") without distinguishing subtypes like "PLA Basic" vs "PLA Matte", making entries with different subtypes but same color look identical. Backend: Add tray_sub_brands to available-filaments response and include it in the dedup key so different subtypes of the same color appear as separate entries. Frontend: Show tray_sub_brands in FilamentMapping, FilamentOverride, and PrinterSelector dropdowns, falling back to base type when unset. Add traySubBrands field to LoadedFilament interface.
This commit is contained in:
@@ -223,7 +223,7 @@ export function FilamentMapping({
|
||||
: '';
|
||||
return (
|
||||
<option key={f.globalTrayId} value={f.globalTrayId} className="bg-bambu-dark text-white">
|
||||
{f.label}: {f.type} ({f.colorName}){remainingLabel}
|
||||
{f.label}: {f.traySubBrands || f.type} ({f.colorName}){remainingLabel}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { FilamentReqsData } from './types';
|
||||
|
||||
interface FilamentOverrideProps {
|
||||
filamentReqs: FilamentReqsData | undefined;
|
||||
availableFilaments: Array<{ type: string; color: string; tray_info_idx: string; extruder_id: number | null }>;
|
||||
availableFilaments: Array<{ type: string; color: string; tray_info_idx: string; tray_sub_brands: string; extruder_id: number | null }>;
|
||||
overrides: Record<number, { type: string; color: string }>;
|
||||
onChange: (overrides: Record<number, { type: string; color: string }>) => void;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ export function FilamentOverride({
|
||||
|
||||
// Index available filaments by type (uppercased) for per-slot filtering
|
||||
const filamentsByType = useMemo(() => {
|
||||
const map: Record<string, Array<{ type: string; color: string; tray_info_idx: string; extruder_id: number | null }>> = {};
|
||||
const map: Record<string, Array<{ type: string; color: string; tray_info_idx: string; tray_sub_brands: string; extruder_id: number | null }>> = {};
|
||||
for (const f of availableFilaments) {
|
||||
const key = f.type.toUpperCase();
|
||||
if (!map[key]) map[key] = [];
|
||||
@@ -104,11 +104,11 @@ export function FilamentOverride({
|
||||
</option>
|
||||
{compatible.map((f, idx) => (
|
||||
<option
|
||||
key={`${f.type}-${f.color}-${idx}`}
|
||||
key={`${f.type}-${f.color}-${f.tray_sub_brands}-${idx}`}
|
||||
value={`${f.type}|${f.color}`}
|
||||
className="bg-bambu-dark text-white"
|
||||
>
|
||||
{f.type} ({getColorName(f.color)})
|
||||
{f.tray_sub_brands || f.type} ({getColorName(f.color)})
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
||||
@@ -171,7 +171,7 @@ function InlineMappingEditor({
|
||||
{filterFilamentsByNozzle(printerResult.loadedFilaments, req.nozzle_id)
|
||||
.map((f) => (
|
||||
<option key={f.globalTrayId} value={f.globalTrayId} className="bg-bambu-dark text-white">
|
||||
{f.label}: {f.type} ({f.colorName})
|
||||
{f.label}: {f.traySubBrands || f.type} ({f.colorName})
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user