|
|
@@ -1672,7 +1672,27 @@ function PrinterCard({
|
|
|
queryKey: ['queue', printer.id, 'pending'],
|
|
|
queryFn: () => api.getQueue(printer.id, 'pending'),
|
|
|
});
|
|
|
- const queueCount = queueItems?.length || 0;
|
|
|
+ // Filter queue items by filament compatibility (same logic as PrinterQueueWidget)
|
|
|
+ // so the badge only shows on printers that can actually run the queued jobs.
|
|
|
+ const queueCount = useMemo(() => {
|
|
|
+ if (!queueItems?.length) return 0;
|
|
|
+ return queueItems.filter(item => {
|
|
|
+ if (item.required_filament_types?.length && loadedFilamentTypes?.size) {
|
|
|
+ if (!item.required_filament_types.every((t: string) => loadedFilamentTypes.has(t.toUpperCase()))) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.filament_overrides?.length && loadedFilaments?.size) {
|
|
|
+ const hasColorMatch = item.filament_overrides.some((o: { type?: string; color?: string }) => {
|
|
|
+ const oType = (o.type || '').toUpperCase();
|
|
|
+ const oColor = (o.color || '').replace('#', '').toLowerCase().slice(0, 6);
|
|
|
+ return loadedFilaments.has(`${oType}:${oColor}`);
|
|
|
+ });
|
|
|
+ if (!hasColorMatch) return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }).length;
|
|
|
+ }, [queueItems, loadedFilamentTypes, loadedFilaments]);
|
|
|
|
|
|
// Fetch currently printing queue item to show who started it (Issue #206)
|
|
|
const { data: printingQueueItems } = useQuery({
|