diff --git a/src/dialogs/restart/dialog-restart.ts b/src/dialogs/restart/dialog-restart.ts index 156fb3b826..62f8232000 100644 --- a/src/dialogs/restart/dialog-restart.ts +++ b/src/dialogs/restart/dialog-restart.ts @@ -211,7 +211,14 @@ class DialogRestart extends LitElement { duration: 1000, }); - await this.hass.callService("homeassistant", "reload_all"); + try { + await this.hass.callService("homeassistant", "reload_all"); + } catch (err: any) { + showAlertDialog(this, { + title: this.hass.localize("ui.dialogs.restart.reload.failed"), + text: err.message, + }); + } } private async _restart(ev) { 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 933d42c730..8b67a7e7a5 100644 --- a/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts +++ b/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts @@ -7,7 +7,7 @@ import "../../../components/ha-card"; import "../../../components/ha-circular-progress"; import { checkCoreConfig } from "../../../data/core"; import { domainToName } from "../../../data/integration"; -import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; +import { showRestartDialog } from "../../../dialogs/restart/show-dialog-restart"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant, Route, TranslationDict } from "../../../types"; @@ -181,23 +181,7 @@ export class DeveloperYamlConfig extends LitElement { } private _restart() { - showConfirmationDialog(this, { - title: this.hass.localize( - "ui.panel.developer-tools.tabs.yaml.section.server_management.confirm_restart_title" - ), - text: this.hass.localize( - "ui.panel.developer-tools.tabs.yaml.section.server_management.confirm_restart_text" - ), - confirmText: this.hass.localize( - "ui.panel.developer-tools.tabs.yaml.section.server_management.restart" - ), - confirm: () => { - this.hass.callService("homeassistant", "restart").catch((reason) => { - this._isValid = false; - this._validateLog = reason.message; - }); - }, - }); + showRestartDialog(this); } static get styles(): CSSResultGroup { diff --git a/src/translations/en.json b/src/translations/en.json index 9e4e4cb204..fac38732c1 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1016,7 +1016,8 @@ "reload": { "title": "Quick reload", "description": "Load new YAML configurations without a restart.", - "reloading": "Reloading configuration" + "reloading": "Reloading configuration", + "failed": "Failed to reload configuration" }, "restart": { "title": "Restart Home Assistant", @@ -4942,8 +4943,6 @@ }, "server_management": { "heading": "Home Assistant", - "confirm_restart_text": "Restarting Home Assistant will stop all your active dashboards, automations and scripts.", - "confirm_restart_title": "Restart Home Assistant?", "restart": "Restart", "stop": "Stop", "confirm_stop": "Are you sure you want to stop Home Assistant?",