瀏覽代碼

Merge pull request #401 from aneopsy/queue-plate-name

feat(queue): display plate name alongside file name for multi-plate files
MartinNYHC 3 月之前
父節點
當前提交
ec82e4d428

+ 1 - 0
frontend/src/i18n/locales/de.ts

@@ -741,6 +741,7 @@ export default {
     clearPlate: 'Druckplatte freigeben & Nächsten starten',
     clearPlateSuccess: 'Druckplatte freigegeben — bereit für nächsten Druck',
     plateReady: 'Druckplatte freigegeben — bereit für nächsten Druck',
+    plateNumber: 'Platte {{index}}',
     // Sections
     sections: {
       currentlyPrinting: 'Aktuell druckend',

+ 1 - 0
frontend/src/i18n/locales/en.ts

@@ -741,6 +741,7 @@ export default {
     clearPlate: 'Clear Plate & Start Next',
     clearPlateSuccess: 'Plate cleared — ready for next print',
     plateReady: 'Plate cleared — ready for next print',
+    plateNumber: 'Plate {{index}}',
     // Sections
     sections: {
       currentlyPrinting: 'Currently Printing',

+ 1 - 0
frontend/src/i18n/locales/fr.ts

@@ -741,6 +741,7 @@ export default {
     clearPlate: 'Vider plateau & lancer suivant',
     clearPlateSuccess: 'Plateau vidé — prêt pour l\'impression suivante',
     plateReady: 'Plateau vidé — prêt pour l\'impression suivante',
+    plateNumber: 'Plateau {{index}}',
     // Sections
     sections: {
       currentlyPrinting: 'En cours',

+ 1 - 0
frontend/src/i18n/locales/it.ts

@@ -728,6 +728,7 @@ export default {
     dragToReorder: 'Trascina per riordinare (solo ASAP)',
     reorderHint: 'La posizione influisce solo sugli elementi ASAP. Quelli programmati partono all\'orario.',
     addedBy: 'Aggiunto da {{name}}',
+    plateNumber: 'Piatto {{index}}',
     // Sections
     sections: {
       currentlyPrinting: 'In stampa',

+ 1 - 0
frontend/src/i18n/locales/ja.ts

@@ -811,6 +811,7 @@ export default {
     clearPlate: 'プレートをクリアして次を開始',
     clearPlateSuccess: 'プレートをクリアしました — 次の印刷の準備完了',
     plateReady: 'プレートをクリアしました — 次の印刷の準備完了',
+    plateNumber: 'プレート {{index}}',
     sections: {
       currentlyPrinting: '印刷中',
       queued: 'キュー中',

+ 23 - 0
frontend/src/pages/QueuePage.tsx

@@ -314,12 +314,34 @@ function SortableQueueItem({
   printerState?: string | null;
   t: (key: string, options?: Record<string, unknown>) => string;
 }) {
+  // Fetch printer status every 30 seconds while printing to monitor progress
   const { data: status } = useQuery({
     queryKey: ['printerStatus', item.printer_id],
     queryFn: () => api.getPrinterStatus(item.printer_id!),
     refetchInterval: 30000,
     enabled: item.printer_id != null && printerState === 'printing',
   });
+
+  // Determine if we're printing a library file
+  const isLibraryFile = !!item.library_file_id && !item.archive_id;
+  // Fetch archive plate details
+  const { data: archivePlatesData } = useQuery({
+    queryKey: ['archive-plates', item.archive_id],
+    queryFn: () => api.getArchivePlates(item.archive_id!),
+    enabled: !!item.archive_id && !isLibraryFile,
+  });
+
+  // Fetch library file plate details
+  const { data: libraryPlatesData } = useQuery({
+    queryKey: ['library-file-plates', item.library_file_id],
+    queryFn: () => api.getLibraryFilePlates(item.library_file_id!),
+    enabled: isLibraryFile && !!item.library_file_id,
+  });
+
+  // Combine plates data from either source
+  const platesData = isLibraryFile ? libraryPlatesData : archivePlatesData;
+  const plates = platesData?.plates ?? [];
+
   const canReorder = hasPermission('queue:reorder');
   const {
     attributes,
@@ -419,6 +441,7 @@ function SortableQueueItem({
           <div className="flex items-center gap-2 mb-1">
             <p className="text-white font-medium truncate">
               {item.archive_name || item.library_file_name || `File #${item.archive_id || item.library_file_id}`}
+              {(platesData?.is_multi_plate ?? false) && item.plate_id !== undefined && item.plate_id !== null && ` • ${plates.find(plate => plate.index === item.plate_id)?.name || t('queue.plateNumber', { index: item.plate_id })}`}
             </p>
             {item.archive_id ? (
               <Link