From 4ae7752f69a91de0259b4a82efdfe6b80eb12435 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Mar 2026 12:20:02 +0000 Subject: [PATCH] Replace CLI command in install error with link to supervisor logs Show a confirmation dialog with an "OK" primary button and a "View supervisor logs" secondary button that navigates to the logs page, instead of displaying CLI commands in the error message. Also strip CLI command references from supervisor API error messages. https://claude.ai/code/session_01DxodYC7uLzxc6SDWyx17tk --- src/data/hassio/common.ts | 18 ++++++++++++------ .../apps/app-view/info/supervisor-app-info.ts | 7 ++++++- src/translations/en.json | 3 ++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/data/hassio/common.ts b/src/data/hassio/common.ts index 1a937b29ca..6670f78311 100644 --- a/src/data/hassio/common.ts +++ b/src/data/hassio/common.ts @@ -21,12 +21,18 @@ export interface HassioStats { export const hassioApiResultExtractor = (response: HassioResponse) => response.data; -export const extractApiErrorMessage = (error: any): string => - typeof error === "object" - ? typeof error.body === "object" - ? error.body.message || "Unknown error, see supervisor logs" - : error.body || error.message || "Unknown error, see supervisor logs" - : error; +export const extractApiErrorMessage = (error: any): string => { + const msg = + typeof error === "object" + ? typeof error.body === "object" + ? error.body.message || "Unknown error" + : error.body || error.message || "Unknown error" + : error; + // Strip CLI command references from supervisor error messages + return typeof msg === "string" + ? msg.replace(/\s*\(check with '[^']*'\)/g, "") + : msg; +}; const ignoredStatusCodes = new Set([502, 503, 504]); diff --git a/src/panels/config/apps/app-view/info/supervisor-app-info.ts b/src/panels/config/apps/app-view/info/supervisor-app-info.ts index bf2df43292..d42cc7c06d 100644 --- a/src/panels/config/apps/app-view/info/supervisor-app-info.ts +++ b/src/panels/config/apps/app-view/info/supervisor-app-info.ts @@ -1059,11 +1059,16 @@ class SupervisorAppInfo extends LitElement { }; fireEvent(this, "hass-api-called", eventdata); } catch (err: any) { - showAlertDialog(this, { + showConfirmationDialog(this, { title: this.hass.localize( "ui.panel.config.apps.dashboard.action_error.install" ), text: extractApiErrorMessage(err), + confirmText: this.hass.localize("ui.common.ok"), + dismissText: this.hass.localize( + "ui.panel.config.apps.dashboard.action_error.view_supervisor_logs" + ), + cancel: () => navigate("/config/logs?provider=supervisor"), }); } button.progress = false; diff --git a/src/translations/en.json b/src/translations/en.json index 86fc114f7c..d95cedd9ee 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2866,7 +2866,8 @@ "get_changelog": "Failed to get changelog", "start_invalid_config": "Invalid configuration", "go_to_config": "Go to configuration", - "validate_config": "Failed to validate app configuration" + "validate_config": "Failed to validate app configuration", + "view_supervisor_logs": "View supervisor logs" }, "uninstall_dialog": { "title": "Uninstall {name}?",