feat(printers): show AI failure detection state on printer cards (#1546)

The live Obico classification was only visible under Settings ->
Failure Detection, so tracking how detection matched an ongoing print
meant flipping between the Printers screen and Settings.

Each printer card's badge row now shows an AI badge whenever detection
is enabled for that printer, like the other health badges: gray Idle
while no print is being watched, then green Safe, amber Warning, or
red Failure while a print is actively monitored. The tooltip carries
the current smoothed score; clicking jumps to the full detection
status and history in Settings. Printers excluded from the monitored
subset show no badge.

Served by a new lightweight /obico/printer-status endpoint readable
with printer permissions alone - it exposes only the enabled flag, the
monitored-printer set, and per-printer classification, keeping ML URL
and other configuration behind the existing settings-gated endpoint.
This commit is contained in:
maziggy
2026-07-28 11:37:36 +02:00
parent 62ba751278
commit eae5359fbc
26 changed files with 833 additions and 163 deletions
+13
View File
@@ -2744,6 +2744,16 @@ export interface ObicoStatus {
external_url_configured: boolean;
}
// Lightweight subset served under printers:read for the printer-card badge (#1546)
export interface ObicoPrinterStatus {
enabled: boolean;
// null = all printers are monitored
monitored_printers: number[] | null;
per_printer: Record<string, { class: string; frame_count: number; score: number }>;
// null = no error, or the viewer lacks settings:read (error strings can embed config URLs)
last_error: string | null;
}
export interface ObicoTestConnection {
ok: boolean;
status_code: number | null;
@@ -6468,6 +6478,9 @@ export const api = {
getObicoStatus: () =>
request<ObicoStatus>('/obico/status'),
getObicoPrinterStatus: () =>
request<ObicoPrinterStatus>('/obico/printer-status'),
testObicoConnection: (url: string) =>
request<ObicoTestConnection>('/obico/test-connection', {
method: 'POST',