diff --git a/src/panels/config/core/ha-config-system-navigation.ts b/src/panels/config/core/ha-config-system-navigation.ts index e1589eb1fe..548cc51e6c 100644 --- a/src/panels/config/core/ha-config-system-navigation.ts +++ b/src/panels/config/core/ha-config-system-navigation.ts @@ -6,7 +6,10 @@ import { canShowPage } from "../../../common/config/can_show_page"; import "../../../components/ha-card"; import "../../../components/ha-navigation-list"; import { CloudStatus } from "../../../data/cloud"; -import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; +import { + showAlertDialog, + showConfirmationDialog, +} from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-subpage"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; @@ -82,7 +85,16 @@ class HaConfigSystemNavigation extends LitElement { "ui.panel.config.system_dashboard.confirm_restart" ), confirm: () => { - this.hass.callService("homeassistant", "restart"); + this.hass + .callService("homeassistant", "restart") + .catch((reason) => { + showAlertDialog(this, { + title: this.hass.localize( + "ui.panel.config.system_dashboard.restart_error" + ), + text: reason.message, + }); + }); }, }); break; diff --git a/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts b/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts index e975cfc27d..57ca442c49 100644 --- a/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts +++ b/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts @@ -27,9 +27,9 @@ export class DeveloperYamlConfig extends LitElement { @state() private _reloadableDomains: string[] = []; - private _validateLog = ""; + @state() private _isValid: boolean | null = null; - private _isValid: boolean | null = null; + private _validateLog = ""; protected updated(changedProperties) { const oldHass = changedProperties.get("hass"); @@ -170,10 +170,11 @@ export class DeveloperYamlConfig extends LitElement { text: this.hass.localize( "ui.panel.developer-tools.tabs.yaml.section.server_management.confirm_restart" ), - confirmText: this.hass!.localize("ui.common.leave"), - dismissText: this.hass!.localize("ui.common.stay"), confirm: () => { - this.hass.callService("homeassistant", "restart"); + this.hass.callService("homeassistant", "restart").catch((reason) => { + this._isValid = false; + this._validateLog = reason.message; + }); }, }); } diff --git a/src/translations/en.json b/src/translations/en.json index 1479dbf2d8..4e7957a766 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -3165,7 +3165,8 @@ }, "system_dashboard": { "confirm_restart": "Are you sure you want to restart Home Assistant?", - "restart_homeassistant": "Restart Home Assistant" + "restart_homeassistant": "Restart Home Assistant", + "restart_error": "Failed to restart Home Assistant" } }, "lovelace": { @@ -4201,7 +4202,8 @@ "restart_home_assistant": "Restart Home Assistant", "confirm_restart": "Are you sure you want to restart Home Assistant?", "stop": "Stop", - "confirm_stop": "Are you sure you want to stop Home Assistant?" + "confirm_stop": "Are you sure you want to stop Home Assistant?", + "restart_error": "Failed to restart Home Assistant" } } }