Use new restart dialog in dev tools (#15530)

This commit is contained in:
Paul Bottein 2023-02-21 12:49:13 +01:00 committed by GitHub
parent 3e72b1cb5d
commit 3066a9d10d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 22 deletions

View File

@ -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) {

View File

@ -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 {

View File

@ -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?",