Bläddra i källkod

Printers: a corrected value clears the failed connection check (#3624)
- Changing the IP address, serial number or access code in Add or
Edit Printer clears the failed-check warning, so the next save
checks the new values instead of offering only Save anyway
- Back is now Check again, which runs the check on the form's values
- The access code field has a show/hide button, hidden by default

maziggy 1 dag sedan
förälder
incheckning
c1ed068e7e
70 ändrade filer med 293 tillägg och 46 borttagningar
  1. 1 0
      CHANGELOG.md
  2. 168 0
      frontend/src/__tests__/components/AddPrinterPreflight.test.tsx
  3. 3 1
      frontend/src/i18n/locales/de.ts
  4. 3 1
      frontend/src/i18n/locales/en.ts
  5. 3 1
      frontend/src/i18n/locales/es.ts
  6. 3 1
      frontend/src/i18n/locales/fr.ts
  7. 3 1
      frontend/src/i18n/locales/it.ts
  8. 3 1
      frontend/src/i18n/locales/ja.ts
  9. 3 1
      frontend/src/i18n/locales/ko.ts
  10. 3 1
      frontend/src/i18n/locales/nl.ts
  11. 3 1
      frontend/src/i18n/locales/pl.ts
  12. 3 1
      frontend/src/i18n/locales/pt-BR.ts
  13. 3 1
      frontend/src/i18n/locales/ru.ts
  14. 3 1
      frontend/src/i18n/locales/sv.ts
  15. 3 1
      frontend/src/i18n/locales/tr.ts
  16. 3 1
      frontend/src/i18n/locales/uk.ts
  17. 3 1
      frontend/src/i18n/locales/zh-CN.ts
  18. 3 1
      frontend/src/i18n/locales/zh-TW.ts
  19. 73 27
      frontend/src/pages/PrintersPage.tsx
  20. 0 0
      static/assets/ArchivesPage-BgtWnpGi.js
  21. 0 0
      static/assets/CamWallPage-DjVfw3fP.js
  22. 0 0
      static/assets/CameraPage-DR4AJB42.js
  23. 0 0
      static/assets/FileManagerPage-C0rkaO7N.js
  24. 0 0
      static/assets/InventoryPage-Ch5PduD8.js
  25. 0 0
      static/assets/Layout-BICboYfE.js
  26. 0 0
      static/assets/Layout-DpexWd3Y.js
  27. 0 0
      static/assets/MaintenancePage-4llcV3lz.js
  28. 0 0
      static/assets/ModelSourcesPage-DmuxmLnR.js
  29. 0 0
      static/assets/PrintersPage-4olMHSR6.js
  30. 0 0
      static/assets/PrintersPage-CuNJSDmV.js
  31. 0 0
      static/assets/SettingsPage-CQTB73yr.js
  32. 0 0
      static/assets/SliceModal-Blewkytg.js
  33. 0 0
      static/assets/SpoolBuddyInventoryPage-wmpojhsW.js
  34. 1 1
      static/assets/SpoolBuddySettingsPage-BdmnLhU-.js
  35. 0 0
      static/assets/SpoolBuddyWriteTagPage-B3_jIO34.js
  36. 0 0
      static/assets/de-CJJoH4SB.js
  37. 0 0
      static/assets/de-Cx7ZB7Jf.js
  38. 0 0
      static/assets/es-DUNcV6QO.js
  39. 0 0
      static/assets/es-DVMtQnhG.js
  40. 0 0
      static/assets/fr-B3TdRqu-.js
  41. 0 0
      static/assets/fr-COO6m3qg.js
  42. 0 0
      static/assets/index-ByEtDKgd.js
  43. 0 0
      static/assets/it-DrJIgEGP.js
  44. 0 0
      static/assets/it-EDt9aD15.js
  45. 0 0
      static/assets/ja-CF0gm2Aa.js
  46. 0 0
      static/assets/ja-CHc9O7rw.js
  47. 0 0
      static/assets/ko-Ctqe556j.js
  48. 0 0
      static/assets/ko-uKIRcP0t.js
  49. 0 0
      static/assets/locationSensorDefaults-BeHYmC19.js
  50. 0 0
      static/assets/nl-BpmRfh-Y.js
  51. 0 0
      static/assets/nl-vGlcqEjm.js
  52. 0 0
      static/assets/pl-B6Mzzpix.js
  53. 0 0
      static/assets/pl-XSWHpnym.js
  54. 0 0
      static/assets/pt-BR-96vIWv-g.js
  55. 0 0
      static/assets/pt-BR-DG7jFp8j.js
  56. 0 0
      static/assets/ru-DEwOuLNF.js
  57. 0 0
      static/assets/ru-DnC_pWOA.js
  58. 0 0
      static/assets/spoolCost-CrjAznh-.js
  59. 0 0
      static/assets/sv-3LUvbB6e.js
  60. 0 0
      static/assets/sv-BOiq16eh.js
  61. 0 0
      static/assets/tr-BOR-VT8X.js
  62. 0 0
      static/assets/tr-xw7muBEy.js
  63. 0 0
      static/assets/uk-CtMheslB.js
  64. 0 0
      static/assets/uk-Dzpx2d3f.js
  65. 0 0
      static/assets/usePageFileDrop-BZaxGplX.js
  66. 0 0
      static/assets/zh-CN-CtApxkcW.js
  67. 0 0
      static/assets/zh-CN-D1Gr5Ssc.js
  68. 0 0
      static/assets/zh-TW-B56t8UY7.js
  69. 0 0
      static/assets/zh-TW-C-YD8WN9.js
  70. 2 2
      static/index.html

+ 1 - 0
CHANGELOG.md

@@ -15,6 +15,7 @@ All notable changes to Bambuddy will be documented in this file.
 - **Choose which printer an "Any model" job takes (#2915, requested by @bryanmahin, contributed by @Keybored02 in #3547)** — Several printers of a model can take an "Any model" job, and the one with the fewest print hours always got it. **Settings > Workflow > Printer Order for Any-Model Jobs** now chooses: the fewest print hours (the default, as before), the most (use up the machines near replacement first), the printer idle the longest (by its last finished print; one that never printed goes first), or the printers' own priority, a number in **Edit Printer** (lowest first, none last). The order only ranks printers that can take the job: a busy, offline or filament-short printer is still passed over, and preferred colours still come first. Powering a printer on with an Auto Power On plug follows the same order.
 
 ### Fixed
+- **Add and Edit Printer: a corrected value clears the failed connection check, and the access code can be shown (#3624, reported by @balin77)** — When the connection check on save failed, its warning stayed on screen after the IP address, serial number or access code was corrected. The only way to save was **Save anyway**, which saved without checking the corrected value, and the way to check again was **Back**, which did not say so. Changing one of those fields now clears the warning, so the normal button comes back and the next save checks the new values. **Back** is now **Check again**, which runs the check at once, for a printer that has just been switched on; **Save anyway** stays. The access code field has an eye button to show what was typed, hidden by default. Translated in all locales.
 - **A tap on a phone presses the button instead of selecting its label, and opens an AMS slot's card anywhere on the slot (#3577, reported by @balin77)** — On a phone or tablet, a tap on a button that lasted a little long or moved a little selected its label as text, with handles and the copy menu, instead of pressing it. That happened all over the app, as buttons never turned text selection off. Button labels can no longer be selected, and iOS no longer offers its long-press menu on them; text in fields and the rest of the page can still be selected and copied. An AMS slot on the printer card opened its card on hover only, which a phone only fakes after a tap, so a tap on the material name selected the word and the card stayed shut. A slot (AMS, AMS-HT or external spool, filled or empty) now opens its card on a tap anywhere on it, and a second tap, a tap elsewhere or Escape closes it, so only one is open at a time. Enter or Space opens it from the keyboard. A mouse still opens it on hover. Wiki updated.
 - **A long colour or filament name continues on the next line of a spool label (#3621, reported by @mohan456-wqs)** — Every line of a label got one line of text, cut off with "…" when it was too wide, also where the label had room below it. On the 40 × 30 box label the column beside the QR code holds only five to seven Chinese characters, so a Chinese filament name was cut after a few. A line that is too wide now continues on up to three lines, as long as every line ticked below it still gets its own; only what still doesn't fit is cut. Lines break at spaces, and between Chinese or Japanese characters, which have none, without separating a closing bracket or comma from the word before it. Labels whose lines fit look as before.
 - **The QR scanner reads a photo of a small spool label (#3616, reported by @balin77)** — **Take photo** answered "No QR code found in the photo" when the label filled only a small part of the photo, although the phone's camera app read it at once. Where the browser has no QR decoder of its own (every iPhone, and every phone with Bambuddy opened over plain HTTP, where the photo is the only way to scan), the photo was scaled down to 1600 pixels before it was read, and a small label lost too much detail. When that finds nothing, the photo is now read again at its own size, up to 4096 pixels on the long side, which phone browsers can still handle. This takes under a second more, and only for a photo the first read could not read.

+ 168 - 0
frontend/src/__tests__/components/AddPrinterPreflight.test.tsx

@@ -6,6 +6,7 @@
  */
 
 import { describe, it, expect, beforeEach } from 'vitest';
+import type { UserEvent } from '@testing-library/user-event';
 import { screen, waitFor } from '@testing-library/react';
 import userEvent from '@testing-library/user-event';
 import { render } from '../utils';
@@ -91,3 +92,170 @@ describe('AddPrinterModal pre-flight', () => {
     expect(screen.queryByText(/Some connection checks failed/i)).not.toBeInTheDocument();
   });
 });
+
+// A corrected value resets the failed check, "Check again" runs it again, and
+// the access code can be shown (#3624).
+describe('a failed connection check after a correction (#3624)', () => {
+  const WRONG = '12345678';
+  let checked: Record<string, unknown>[];
+  let created: Record<string, unknown> | null;
+
+  beforeEach(() => {
+    checked = [];
+    created = null;
+    server.use(
+      http.get('/api/v1/printers/', () => HttpResponse.json([])),
+      http.get('/api/v1/queue/', () => HttpResponse.json([])),
+      http.get('/api/v1/discovery/info', () =>
+        HttpResponse.json({ is_docker: false, ssdp_running: false, scan_running: false, subnets: [] }),
+      ),
+      // Only the mistyped code fails.
+      http.post('/api/v1/printers/diagnostic', async ({ request }) => {
+        const body = (await request.json()) as Record<string, unknown>;
+        checked.push(body);
+        const fail = body.access_code === WRONG;
+        return HttpResponse.json({
+          printer_id: null,
+          ip_address: body.ip_address,
+          overall: fail ? 'problems' : 'ok',
+          checks: [{ id: 'developer_mode', status: fail ? 'fail' : 'pass', params: {} }],
+        });
+      }),
+      http.post('/api/v1/printers/', async ({ request }) => {
+        created = (await request.json()) as Record<string, unknown>;
+        return HttpResponse.json({ id: 9, name: 'Test Printer' });
+      }),
+    );
+  });
+
+  async function failedAdd(user: UserEvent) {
+    render(<PrintersPage />);
+    await user.click(await screen.findByText(/add printer/i));
+    await user.type(await screen.findByPlaceholderText('My Printer'), 'Test Printer');
+    await user.type(screen.getByPlaceholderText('192.168.1.100 or printer.local'), '192.168.1.55');
+    await user.type(screen.getByPlaceholderText('01P00A000000000'), '01P00A000000000');
+    await user.type(screen.getByPlaceholderText('From printer settings'), WRONG);
+    await user.click(addButton()!);
+    await screen.findByText(/Some connection checks failed/i);
+  }
+
+  const addButton = () =>
+    screen.queryAllByRole('button', { name: /add printer/i }).find((b) => b.getAttribute('type') === 'submit');
+
+  it('clears the warning when the access code is corrected, and checks the new one', async () => {
+    const user = userEvent.setup();
+    await failedAdd(user);
+
+    const code = screen.getByPlaceholderText('From printer settings');
+    await user.clear(code);
+    await user.type(code, '87654321');
+
+    expect(screen.queryByText(/Some connection checks failed/i)).not.toBeInTheDocument();
+    expect(screen.queryByRole('button', { name: /save anyway/i })).not.toBeInTheDocument();
+    await user.click(addButton()!);
+
+    await waitFor(() => expect(created).not.toBeNull());
+    expect(checked.at(-1)?.access_code).toBe('87654321');
+    expect(created!.access_code).toBe('87654321');
+  });
+
+  it.each([
+    ['IP address', '192.168.1.100 or printer.local'],
+    ['serial number', '01P00A000000000'],
+  ])('clears the warning when the %s changes', async (_field, placeholder) => {
+    const user = userEvent.setup();
+    await failedAdd(user);
+
+    await user.type(screen.getByPlaceholderText(placeholder), '1');
+
+    expect(screen.queryByText(/Some connection checks failed/i)).not.toBeInTheDocument();
+    expect(addButton()).toBeDefined();
+  });
+
+  it('keeps the warning when a field the check does not read changes', async () => {
+    const user = userEvent.setup();
+    await failedAdd(user);
+
+    await user.type(screen.getByPlaceholderText('My Printer'), ' 2');
+
+    expect(screen.getByText(/Some connection checks failed/i)).toBeInTheDocument();
+  });
+
+  it('runs the check again on "Check again", and saves once it passes', async () => {
+    const user = userEvent.setup();
+    await failedAdd(user);
+    expect(screen.queryByRole('button', { name: /^back$/i })).not.toBeInTheDocument();
+
+    // Still the wrong code: checked again, still warned, nothing saved.
+    await user.click(screen.getByRole('button', { name: /check again/i }));
+    await waitFor(() => expect(checked).toHaveLength(2));
+    expect(await screen.findByText(/Some connection checks failed/i)).toBeInTheDocument();
+    expect(created).toBeNull();
+
+    // The printer answers now (here: the mock no longer fails it).
+    server.use(
+      http.post('/api/v1/printers/diagnostic', () =>
+        HttpResponse.json({ printer_id: null, ip_address: '192.168.1.55', overall: 'ok', checks: [] }),
+      ),
+    );
+    await user.click(screen.getByRole('button', { name: /check again/i }));
+    await waitFor(() => expect(created).not.toBeNull());
+  });
+
+  it('shows and hides the access code', async () => {
+    const user = userEvent.setup();
+    render(<PrintersPage />);
+    await user.click(await screen.findByText(/add printer/i));
+    const code = await screen.findByPlaceholderText('From printer settings');
+    expect(code).toHaveAttribute('type', 'password');
+
+    await user.click(screen.getByRole('button', { name: 'Show access code' }));
+    expect(code).toHaveAttribute('type', 'text');
+
+    await user.click(screen.getByRole('button', { name: 'Hide access code' }));
+    expect(code).toHaveAttribute('type', 'password');
+  });
+
+  it('does the same in the Edit Printer dialog', async () => {
+    const user = userEvent.setup();
+    const printer = {
+      id: 1, name: 'A1 mini', ip_address: '192.168.1.100', serial_number: '0300AA000000001',
+      access_code: '', model: 'A1 Mini', enabled: true, nozzle_diameter: 0.4, nozzle_type: 'hardened_steel',
+      location: null, auto_archive: true, is_active: true, wear_cost_per_hour: null, dispatch_priority: null,
+      require_plate_clear: null, created_at: '2024-01-01T00:00:00Z', updated_at: '2024-01-01T00:00:00Z',
+    };
+    let saved: Record<string, unknown> | null = null;
+    server.use(
+      http.get('/api/v1/printers/', () => HttpResponse.json([printer])),
+      http.get('/api/v1/printers/:id/status', () => HttpResponse.json({ connected: false, state: 'IDLE' })),
+      http.patch('/api/v1/printers/:id', async ({ request }) => {
+        saved = (await request.json()) as Record<string, unknown>;
+        return HttpResponse.json({ ...printer, ...saved });
+      }),
+    );
+    render(<PrintersPage />);
+    await waitFor(() => expect(screen.getByText('A1 mini')).toBeInTheDocument());
+    const menuBtn = [...document.querySelectorAll('button')].find((b) => b.querySelector('.lucide-ellipsis-vertical'))!;
+    await user.click(menuBtn);
+    await user.click(await screen.findByRole('button', { name: /^edit$/i }));
+    await screen.findByText('Edit Printer');
+
+    const code = screen.getByLabelText('Access Code');
+    await user.type(code, WRONG);
+    await user.click(screen.getByRole('button', { name: /save changes/i }));
+    await screen.findByText(/Some connection checks failed/i);
+    await user.click(screen.getByRole('button', { name: /check again/i }));
+    await waitFor(() => expect(checked).toHaveLength(2));
+    expect(await screen.findByText(/Some connection checks failed/i)).toBeInTheDocument();
+
+    await user.click(screen.getByRole('button', { name: 'Show access code' }));
+    expect(code).toHaveAttribute('type', 'text');
+
+    await user.clear(code);
+    await user.type(code, '87654321');
+    expect(screen.queryByText(/Some connection checks failed/i)).not.toBeInTheDocument();
+    await user.click(screen.getByRole('button', { name: /save changes/i }));
+    await waitFor(() => expect(saved).not.toBeNull());
+    expect(saved!.access_code).toBe('87654321');
+  });
+});

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

@@ -289,7 +289,7 @@ export default {
     addPreflight: {
       checking: 'Verbindung wird geprüft...',
       warning: 'Einige Verbindungsprüfungen sind fehlgeschlagen. Dieser Drucker wird möglicherweise als offline angezeigt. Prüfe die Punkte unten, behebe was möglich ist, oder speichere trotzdem.',
-      back: 'Zurück',
+      checkAgain: 'Erneut prüfen',
       saveAnyway: 'Trotzdem speichern',
     },
     title: 'Drucker',
@@ -300,6 +300,8 @@ export default {
     serialNumber: 'Seriennummer',
     ipAddress: 'IP-Adresse / Hostname',
     accessCode: 'Zugangscode',
+    showAccessCode: 'Zugangscode anzeigen',
+    hideAccessCode: 'Zugangscode verbergen',
     model: 'Modell',
     nozzleCount: 'Düsenanzahl',
     autoArchive: 'Automatische Archivierung',

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

@@ -293,7 +293,7 @@ export default {
     addPreflight: {
       checking: 'Checking connection...',
       warning: 'Some connection checks failed. This printer may show as offline. Review the checks below, fix what you can, or save anyway.',
-      back: 'Back',
+      checkAgain: 'Check again',
       saveAnyway: 'Save anyway',
     },
     editPrinter: 'Edit Printer',
@@ -302,6 +302,8 @@ export default {
     serialNumber: 'Serial Number',
     ipAddress: 'IP Address / Hostname',
     accessCode: 'Access Code',
+    showAccessCode: 'Show access code',
+    hideAccessCode: 'Hide access code',
     model: 'Model',
     nozzleCount: 'Nozzle Count',
     autoArchive: 'Auto Archive',

+ 3 - 1
frontend/src/i18n/locales/es.ts

@@ -289,7 +289,7 @@ export default {
     addPreflight: {
       checking: 'Comprobando la conexión...',
       warning: 'Algunas comprobaciones de conexión fallaron. Esta impresora podría aparecer como desconectada. Revisa las comprobaciones de abajo, soluciona lo que puedas o guárdala de todos modos.',
-      back: 'Atrás',
+      checkAgain: 'Comprobar de nuevo',
       saveAnyway: 'Guardar de todos modos',
     },
     title: 'Impresoras',
@@ -300,6 +300,8 @@ export default {
     serialNumber: 'Número de serie',
     ipAddress: 'Dirección IP / Nombre de host',
     accessCode: 'Código de acceso',
+    showAccessCode: 'Mostrar código de acceso',
+    hideAccessCode: 'Ocultar código de acceso',
     model: 'Modelo',
     nozzleCount: 'Número de boquillas',
     autoArchive: 'Archivado automático',

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

@@ -289,7 +289,7 @@ export default {
     addPreflight: {
       checking: 'Vérification de la connexion...',
       warning: 'Certaines vérifications de connexion ont échoué. Cette imprimante pourrait apparaître hors ligne. Examinez les vérifications ci-dessous, corrigez ce que vous pouvez, ou enregistrez quand même.',
-      back: 'Retour',
+      checkAgain: 'Vérifier à nouveau',
       saveAnyway: 'Enregistrer quand même',
     },
     title: 'Imprimantes',
@@ -300,6 +300,8 @@ export default {
     serialNumber: 'Numéro de série',
     ipAddress: 'Adresse IP / Nom d\'hôte',
     accessCode: 'Code d\'accès',
+    showAccessCode: 'Afficher le code d\'accès',
+    hideAccessCode: 'Masquer le code d\'accès',
     model: 'Modèle',
     nozzleCount: 'Nombre de buses',
     autoArchive: 'Auto-archivage',

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

@@ -289,7 +289,7 @@ export default {
     addPreflight: {
       checking: 'Verifica della connessione...',
       warning: 'Alcuni controlli di connessione non sono riusciti. Questa stampante potrebbe risultare offline. Controlla le verifiche qui sotto, risolvi ciò che puoi oppure salva comunque.',
-      back: 'Indietro',
+      checkAgain: 'Verifica di nuovo',
       saveAnyway: 'Salva comunque',
     },
     title: 'Stampanti',
@@ -300,6 +300,8 @@ export default {
     serialNumber: 'Numero Seriale',
     ipAddress: 'Indirizzo IP',
     accessCode: 'Codice di Accesso',
+    showAccessCode: 'Mostra codice di accesso',
+    hideAccessCode: 'Nascondi codice di accesso',
     model: 'Modello',
     nozzleCount: 'Numero Ugelli',
     autoArchive: 'Auto Archiviazione',

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

@@ -288,7 +288,7 @@ export default {
     addPreflight: {
       checking: '接続を確認しています...',
       warning: '一部の接続チェックに失敗しました。このプリンターはオフラインと表示される可能性があります。下のチェックを確認し、可能な範囲で修正するか、そのまま保存してください。',
-      back: '戻る',
+      checkAgain: '再確認',
       saveAnyway: 'そのまま保存',
     },
     title: 'プリンター',
@@ -299,6 +299,8 @@ export default {
     serialNumber: 'シリアル番号',
     ipAddress: 'IPアドレス / ホスト名',
     accessCode: 'アクセスコード',
+    showAccessCode: 'アクセスコードを表示',
+    hideAccessCode: 'アクセスコードを隠す',
     model: 'モデル',
     nozzleCount: 'ノズル数',
     autoArchive: '自動アーカイブ',

+ 3 - 1
frontend/src/i18n/locales/ko.ts

@@ -288,6 +288,8 @@ export default {
     serialNumber: '일련번호',
     ipAddress: 'IP 주소 / 호스트명',
     accessCode: '액세스 코드',
+    showAccessCode: '액세스 코드 표시',
+    hideAccessCode: '액세스 코드 숨기기',
     model: '모델',
     nozzleCount: '노즐 수',
     autoArchive: '자동 아카이브',
@@ -943,7 +945,7 @@ export default {
     addPreflight: {
       checking: '연결 확인 중...',
       warning: '일부 연결 확인이 실패했습니다. 이 프린터가 오프라인으로 표시될 수 있습니다. 아래 항목을 검토하고 수정하거나 그냥 저장하세요.',
-      back: '뒤로',
+      checkAgain: '다시 확인',
       saveAnyway: '그냥 저장'
     }
   },

+ 3 - 1
frontend/src/i18n/locales/nl.ts

@@ -291,7 +291,7 @@ export default {
     addPreflight: {
       checking: 'Verbinding controleren...',
       warning: 'Sommige verbindingscontroles zijn mislukt. Deze printer kan als offline worden weergegeven. Controleer de onderstaande controles, herstel wat je kunt of sla toch op.',
-      back: 'Terug',
+      checkAgain: 'Opnieuw controleren',
       saveAnyway: 'Toch opslaan',
     },
     editPrinter: 'Printer bewerken',
@@ -300,6 +300,8 @@ export default {
     serialNumber: 'Serienummer',
     ipAddress: 'IP-adres / hostnaam',
     accessCode: 'Toegangscode',
+    showAccessCode: 'Toegangscode tonen',
+    hideAccessCode: 'Toegangscode verbergen',
     model: 'Model',
     nozzleCount: 'Aantal nozzles',
     autoArchive: 'Automatisch archiveren',

+ 3 - 1
frontend/src/i18n/locales/pl.ts

@@ -293,7 +293,7 @@ export default {
     addPreflight: {
       checking: 'Sprawdzanie połączenia...',
       warning: 'Część testów połączenia nie powiodła się. Ta drukarka może być widoczna jako offline. Przejrzyj poniższe testy, popraw, co możesz, lub mimo to zapisz.',
-      back: 'Wstecz',
+      checkAgain: 'Sprawdź ponownie',
       saveAnyway: 'Zapisz mimo to',
     },
     editPrinter: 'Edytuj drukarkę',
@@ -302,6 +302,8 @@ export default {
     serialNumber: 'Numer seryjny',
     ipAddress: 'Adres IP / nazwa hosta',
     accessCode: 'Kod dostępu',
+    showAccessCode: 'Pokaż kod dostępu',
+    hideAccessCode: 'Ukryj kod dostępu',
     model: 'Model',
     nozzleCount: 'Liczba dysz',
     autoArchive: 'Automatyczne archiwizowanie',

+ 3 - 1
frontend/src/i18n/locales/pt-BR.ts

@@ -289,7 +289,7 @@ export default {
     addPreflight: {
       checking: 'Verificando a conexão...',
       warning: 'Algumas verificações de conexão falharam. Esta impressora pode aparecer como offline. Revise as verificações abaixo, corrija o que puder ou salve mesmo assim.',
-      back: 'Voltar',
+      checkAgain: 'Verificar novamente',
       saveAnyway: 'Salvar mesmo assim',
     },
     title: 'Impressoras',
@@ -300,6 +300,8 @@ export default {
     serialNumber: 'Número de Série',
     ipAddress: 'Endereço IP / Nome do Host',
     accessCode: 'Código de Acesso',
+    showAccessCode: 'Mostrar código de acesso',
+    hideAccessCode: 'Ocultar código de acesso',
     model: 'Modelo',
     nozzleCount: 'Número de Bicos',
     autoArchive: 'Arquivamento Automático',

+ 3 - 1
frontend/src/i18n/locales/ru.ts

@@ -285,7 +285,7 @@ export default {
     addPreflight: {
       checking: "Проверка подключения...",
       warning: "Некоторые проверки подключения не пройдены. Принтер может отображаться как отключённый. Проверьте результаты ниже, исправьте возможные проблемы или сохраните настройки как есть.",
-      back: "Назад",
+      checkAgain: "Проверить снова",
       saveAnyway: "Всё равно сохранить",
     },
     editPrinter: "Изменить принтер",
@@ -294,6 +294,8 @@ export default {
     serialNumber: "Серийный номер",
     ipAddress: "IP-адрес / имя хоста",
     accessCode: "Код доступа",
+    showAccessCode: "Показать код доступа",
+    hideAccessCode: "Скрыть код доступа",
     model: "Модель",
     nozzleCount: "Количество сопел",
     autoArchive: "Автоматически архивировать",

+ 3 - 1
frontend/src/i18n/locales/sv.ts

@@ -291,7 +291,7 @@ export default {
     addPreflight: {
       checking: 'Kontrollerar anslutning...',
       warning: 'Vissa anslutningskontroller misslyckades. Denna skrivare kan visas som offline. Granska kontrollerna nedan, åtgärda vad du kan, eller spara ändå.',
-      back: 'Tillbaka',
+      checkAgain: 'Kontrollera igen',
       saveAnyway: 'Spara ändå',
     },
     editPrinter: 'Redigera skrivare',
@@ -300,6 +300,8 @@ export default {
     serialNumber: 'Serienummer',
     ipAddress: 'IP-adress / värdnamn',
     accessCode: 'Åtkomstkod',
+    showAccessCode: 'Visa åtkomstkod',
+    hideAccessCode: 'Dölj åtkomstkod',
     model: 'Modell',
     nozzleCount: 'Antal munstycken',
     autoArchive: 'Autoarkivera',

+ 3 - 1
frontend/src/i18n/locales/tr.ts

@@ -291,7 +291,7 @@ export default {
     addPreflight: {
       checking: 'Bağlantı kontrol ediliyor...',
       warning: 'Bazı bağlantı kontrolleri başarısız oldu. Bu yazıcı çevrimdışı olarak görünebilir. Aşağıdaki kontrolleri inceleyin, düzeltebileceklerinizi düzeltin veya yine de kaydedin.',
-      back: 'Geri',
+      checkAgain: 'Tekrar kontrol et',
       saveAnyway: 'Yine de kaydet',
     },
     editPrinter: 'Yazıcıyı Düzenle',
@@ -300,6 +300,8 @@ export default {
     serialNumber: 'Seri Numarası',
     ipAddress: 'IP Adresi / Ana Bilgisayar Adı',
     accessCode: 'Erişim Kodu',
+    showAccessCode: 'Erişim kodunu göster',
+    hideAccessCode: 'Erişim kodunu gizle',
     model: 'Model',
     nozzleCount: 'Nozul Sayısı',
     autoArchive: 'Otomatik Arşivle',

+ 3 - 1
frontend/src/i18n/locales/uk.ts

@@ -291,7 +291,7 @@ export default {
     addPreflight: {
       checking: "Перевірка підключення...",
       warning: "Деякі перевірки підключення завершилися невдало. Принтер може відображатися як офлайн. Перегляньте результати нижче, усуньте можливі проблеми або все одно збережіть принтер.",
-      back: "Назад",
+      checkAgain: "Перевірити знову",
       saveAnyway: "Усе одно зберегти",
     },
     editPrinter: "Редагувати принтер",
@@ -300,6 +300,8 @@ export default {
     serialNumber: "Серійний номер",
     ipAddress: "IP-адреса / ім’я хоста",
     accessCode: "Код доступу",
+    showAccessCode: "Показати код доступу",
+    hideAccessCode: "Приховати код доступу",
     model: "Модель",
     nozzleCount: "Кількість сопел",
     autoArchive: "Автоархів",

+ 3 - 1
frontend/src/i18n/locales/zh-CN.ts

@@ -289,7 +289,7 @@ export default {
     addPreflight: {
       checking: '正在检查连接...',
       warning: '部分连接检查未通过。此打印机可能显示为离线。请查看下方的检查项,尽量修复,或仍然保存。',
-      back: '返回',
+      checkAgain: '重新检查',
       saveAnyway: '仍然保存',
     },
     title: '打印机',
@@ -300,6 +300,8 @@ export default {
     serialNumber: '序列号',
     ipAddress: 'IP 地址 / 主机名',
     accessCode: '访问码',
+    showAccessCode: '显示访问码',
+    hideAccessCode: '隐藏访问码',
     model: '型号',
     nozzleCount: '喷嘴数量',
     autoArchive: '自动归档',

+ 3 - 1
frontend/src/i18n/locales/zh-TW.ts

@@ -289,7 +289,7 @@ export default {
     addPreflight: {
       checking: '正在檢查連線...',
       warning: '部分連線檢查未通過。此印表機可能顯示為離線。請查看下方的檢查項目,盡量修復,或仍然儲存。',
-      back: '返回',
+      checkAgain: '重新檢查',
       saveAnyway: '仍然儲存',
     },
     title: '印表機',
@@ -300,6 +300,8 @@ export default {
     serialNumber: '序列號',
     ipAddress: 'IP 位址 / 主機名稱',
     accessCode: '存取碼',
+    showAccessCode: '顯示存取碼',
+    hideAccessCode: '隱藏存取碼',
     model: '型號',
     nozzleCount: '噴嘴數量',
     autoArchive: '自動歸檔',

+ 73 - 27
frontend/src/pages/PrintersPage.tsx

@@ -7857,6 +7857,47 @@ function PrinterCard({
   );
 }
 
+/**
+ * A printer's access code, hidden unless shown (#3624). It is eight
+ * characters read off the printer's screen, some easy to confuse, and a typo
+ * was only found by the failed connection check.
+ */
+function AccessCodeInput({
+  value,
+  onChange,
+  placeholder,
+  required,
+}: {
+  value: string;
+  onChange: (value: string) => void;
+  placeholder: string;
+  required?: boolean;
+}) {
+  const { t } = useTranslation();
+  const [shown, setShown] = useState(false);
+  return (
+    <div className="relative">
+      <input
+        type={shown ? 'text' : 'password'}
+        required={required}
+        aria-label={t('printers.accessCode')}
+        className="w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none pr-10"
+        value={value}
+        onChange={(e) => onChange(e.target.value)}
+        placeholder={placeholder}
+      />
+      <button
+        type="button"
+        onClick={() => setShown(!shown)}
+        className="absolute right-2 top-1/2 -translate-y-1/2 text-bambu-gray hover:text-white"
+        aria-label={shown ? t('printers.hideAccessCode') : t('printers.showAccessCode')}
+      >
+        {shown ? <EyeOff className="w-4 h-4" /> : <Eye className="w-4 h-4" />}
+      </button>
+    </div>
+  );
+}
+
 export function AddPrinterModal({
   onClose,
   onAdd,
@@ -7901,6 +7942,14 @@ export function AddPrinterModal({
   const [checkingSave, setCheckingSave] = useState(false);
   const [saveWarning, setSaveWarning] = useState<PrinterDiagnosticResult | null>(null);
 
+  // A field the connection check reads was changed: its warning is about
+  // values no longer in the form, so it goes, and the next save checks the
+  // new ones (#3624).
+  const setCheckedFields = (patch: Partial<typeof form>) => {
+    setForm((f) => ({ ...f, ...patch }));
+    setSaveWarning(null);
+  };
+
   // Fetch discovery info on mount + restore the last custom CIDR the user
   // typed (kept in localStorage so they don't retype `10.1.1.0/24` every
   // time they open this modal).
@@ -8035,8 +8084,7 @@ export function AddPrinterModal({
   const selectPrinter = (printer: DiscoveredPrinter) => {
     // Don't pre-fill serial if it's a placeholder (unknown-*) - user needs to enter actual serial
     const serialNumber = printer.serial.startsWith('unknown-') ? '' : printer.serial;
-    setForm({
-      ...form,
+    setCheckedFields({
       name: printer.name || '',
       serial_number: serialNumber,
       ip_address: printer.ip_address,
@@ -8220,7 +8268,7 @@ export function AddPrinterModal({
                 pattern="(\d{1,3}(\.\d{1,3}){3}|[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?)*)"
                 className="w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"
                 value={form.ip_address}
-                onChange={(e) => setForm({ ...form, ip_address: e.target.value })}
+                onChange={(e) => setCheckedFields({ ip_address: e.target.value })}
                 placeholder="192.168.1.100 or printer.local"
               />
             </div>
@@ -8231,18 +8279,16 @@ export function AddPrinterModal({
                 required
                 className="w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"
                 value={form.serial_number}
-                onChange={(e) => setForm({ ...form, serial_number: e.target.value })}
+                onChange={(e) => setCheckedFields({ serial_number: e.target.value })}
                 placeholder="01P00A000000000"
               />
             </div>
             <div>
               <label className="block text-sm text-bambu-gray mb-1">{t('printers.accessCode')}</label>
-              <input
-                type="password"
+              <AccessCodeInput
                 required
-                className="w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"
                 value={form.access_code}
-                onChange={(e) => setForm({ ...form, access_code: e.target.value })}
+                onChange={(access_code) => setCheckedFields({ access_code })}
                 placeholder={t('printers.modal.fromPrinterSettings')}
               />
             </div>
@@ -8326,13 +8372,10 @@ export function AddPrinterModal({
                 </div>
                 <DiagnosticChecklist result={saveWarning} />
                 <div className="flex gap-3">
-                  <Button
-                    type="button"
-                    variant="secondary"
-                    onClick={() => setSaveWarning(null)}
-                    className="flex-1"
-                  >
-                    {t('printers.addPreflight.back')}
+                  {/* Runs the check again on the form's values: the printer
+                      may just have been switched on (#3624). */}
+                  <Button type="submit" variant="secondary" disabled={checkingSave} className="flex-1">
+                    {checkingSave ? t('printers.addPreflight.checking') : t('printers.addPreflight.checkAgain')}
                   </Button>
                   <Button type="button" onClick={() => onAdd(form)} className="flex-1">
                     {t('printers.addPreflight.saveAnyway')}
@@ -8707,6 +8750,14 @@ function EditPrinterModal({
   const [checkingSave, setCheckingSave] = useState(false);
   const [saveWarning, setSaveWarning] = useState<PrinterDiagnosticResult | null>(null);
 
+  // A field the connection check reads was changed: its warning is about
+  // values no longer in the form, so it goes, and the next save checks the
+  // new ones (#3624).
+  const setCheckedFields = (patch: Partial<typeof form>) => {
+    setForm((f) => ({ ...f, ...patch }));
+    setSaveWarning(null);
+  };
+
   const updateMutation = useMutation({
     mutationFn: (data: Partial<PrinterCreate>) => api.updatePrinter(printer.id, data),
     onSuccess: () => {
@@ -8796,7 +8847,7 @@ function EditPrinterModal({
                 pattern="(\d{1,3}(\.\d{1,3}){3}|[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?)*)"
                 className="w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"
                 value={form.ip_address}
-                onChange={(e) => setForm({ ...form, ip_address: e.target.value })}
+                onChange={(e) => setCheckedFields({ ip_address: e.target.value })}
                 placeholder="192.168.1.100 or printer.local"
               />
             </div>
@@ -8812,11 +8863,9 @@ function EditPrinterModal({
             </div>
             <div>
               <label className="block text-sm text-bambu-gray mb-1">{t('printers.accessCode')}</label>
-              <input
-                type="password"
-                className="w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none"
+              <AccessCodeInput
                 value={form.access_code}
-                onChange={(e) => setForm({ ...form, access_code: e.target.value })}
+                onChange={(access_code) => setCheckedFields({ access_code })}
                 placeholder={t('printers.accessCodePlaceholder')}
               />
             </div>
@@ -8952,13 +9001,10 @@ function EditPrinterModal({
                 </div>
                 <DiagnosticChecklist result={saveWarning} />
                 <div className="flex gap-3">
-                  <Button
-                    type="button"
-                    variant="secondary"
-                    onClick={() => setSaveWarning(null)}
-                    className="flex-1"
-                  >
-                    {t('printers.addPreflight.back')}
+                  {/* Runs the check again on the form's values: the printer
+                      may just have been switched on (#3624). */}
+                  <Button type="submit" variant="secondary" disabled={checkingSave} className="flex-1">
+                    {checkingSave ? t('printers.addPreflight.checking') : t('printers.addPreflight.checkAgain')}
                   </Button>
                   <Button
                     type="button"

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/ArchivesPage-BgtWnpGi.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/CamWallPage-DjVfw3fP.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/CameraPage-DR4AJB42.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/FileManagerPage-C0rkaO7N.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/InventoryPage-Ch5PduD8.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/Layout-BICboYfE.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/Layout-DpexWd3Y.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/MaintenancePage-4llcV3lz.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/ModelSourcesPage-DmuxmLnR.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/PrintersPage-4olMHSR6.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/PrintersPage-CuNJSDmV.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/SettingsPage-CQTB73yr.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/SliceModal-Blewkytg.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/SpoolBuddyInventoryPage-wmpojhsW.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
static/assets/SpoolBuddySettingsPage-BdmnLhU-.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/SpoolBuddyWriteTagPage-B3_jIO34.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/de-CJJoH4SB.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/de-Cx7ZB7Jf.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/es-DUNcV6QO.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/es-DVMtQnhG.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/fr-B3TdRqu-.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/fr-COO6m3qg.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/index-ByEtDKgd.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/it-DrJIgEGP.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/it-EDt9aD15.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/ja-CF0gm2Aa.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/ja-CHc9O7rw.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/ko-Ctqe556j.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/ko-uKIRcP0t.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/locationSensorDefaults-BeHYmC19.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/nl-BpmRfh-Y.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/nl-vGlcqEjm.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/pl-B6Mzzpix.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/pl-XSWHpnym.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/pt-BR-96vIWv-g.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/pt-BR-DG7jFp8j.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/ru-DEwOuLNF.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/ru-DnC_pWOA.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/spoolCost-CrjAznh-.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/sv-3LUvbB6e.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/sv-BOiq16eh.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/tr-BOR-VT8X.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/tr-xw7muBEy.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/uk-CtMheslB.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/uk-Dzpx2d3f.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/usePageFileDrop-BZaxGplX.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/zh-CN-CtApxkcW.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/zh-CN-D1Gr5Ssc.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/zh-TW-B56t8UY7.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
static/assets/zh-TW-C-YD8WN9.js


+ 2 - 2
static/index.html

@@ -26,7 +26,7 @@
 
     <!-- Splash screens for iOS -->
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
-    <script type="module" crossorigin src="/assets/index-CFO4qhPY.js"></script>
+    <script type="module" crossorigin src="/assets/index-ByEtDKgd.js"></script>
     <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
     <link rel="modulepreload" crossorigin href="/assets/client-CI_mRuxq.js">
     <link rel="modulepreload" crossorigin href="/assets/react-dom--SxW8qhX.js">
@@ -122,7 +122,7 @@
     <link rel="modulepreload" crossorigin href="/assets/useColorCatalogVersion-p84g0m2K.js">
     <link rel="modulepreload" crossorigin href="/assets/circle-minus-CPviT500.js">
     <link rel="modulepreload" crossorigin href="/assets/ConnectionDiagnostic-BYvKBjRf.js">
-    <link rel="modulepreload" crossorigin href="/assets/Layout-DpexWd3Y.js">
+    <link rel="modulepreload" crossorigin href="/assets/Layout-BICboYfE.js">
     <link rel="stylesheet" crossorigin href="/assets/index-BwbfDElS.css">
   </head>
   <body>

Vissa filer visades inte eftersom för många filer har ändrats