mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-25 22:07:20 +00:00
Change Restart to be a button, update dialogs (#12499)
This commit is contained in:
parent
bdfb17d957
commit
1f3c23de29
@ -1,5 +1,3 @@
|
|||||||
import { ActionDetail } from "@material/mwc-list";
|
|
||||||
import { mdiDotsVertical } from "@mdi/js";
|
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { canShowPage } from "../../../common/config/can_show_page";
|
import { canShowPage } from "../../../common/config/can_show_page";
|
||||||
@ -44,22 +42,18 @@ class HaConfigSystemNavigation extends LitElement {
|
|||||||
back-path="/config"
|
back-path="/config"
|
||||||
.header=${this.hass.localize("ui.panel.config.dashboard.system.main")}
|
.header=${this.hass.localize("ui.panel.config.dashboard.system.main")}
|
||||||
>
|
>
|
||||||
<ha-button-menu
|
<mwc-button
|
||||||
corner="BOTTOM_START"
|
|
||||||
@action=${this._handleAction}
|
|
||||||
slot="toolbar-icon"
|
slot="toolbar-icon"
|
||||||
>
|
class="warning"
|
||||||
<ha-icon-button
|
.label=${this.narrow
|
||||||
slot="trigger"
|
? this.hass.localize(
|
||||||
.label=${this.hass.localize("ui.common.overflow_menu")}
|
"ui.panel.config.system_dashboard.restart_homeassistant_short"
|
||||||
.path=${mdiDotsVertical}
|
)
|
||||||
></ha-icon-button>
|
: this.hass.localize(
|
||||||
<mwc-list-item>
|
"ui.panel.config.system_dashboard.restart_homeassistant"
|
||||||
${this.hass.localize(
|
)}
|
||||||
"ui.panel.config.system_dashboard.restart_homeassistant"
|
@click=${this._restart}
|
||||||
)}
|
></mwc-button>
|
||||||
</mwc-list-item>
|
|
||||||
</ha-button-menu>
|
|
||||||
<ha-config-section
|
<ha-config-section
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
.isWide=${this.isWide}
|
.isWide=${this.isWide}
|
||||||
@ -77,28 +71,28 @@ class HaConfigSystemNavigation extends LitElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleAction(ev: CustomEvent<ActionDetail>) {
|
private _restart() {
|
||||||
switch (ev.detail.index) {
|
showConfirmationDialog(this, {
|
||||||
case 0:
|
title: this.hass.localize(
|
||||||
showConfirmationDialog(this, {
|
"ui.panel.config.system_dashboard.confirm_restart_title"
|
||||||
text: this.hass.localize(
|
),
|
||||||
"ui.panel.config.system_dashboard.confirm_restart"
|
text: this.hass.localize(
|
||||||
),
|
"ui.panel.config.system_dashboard.confirm_restart_text"
|
||||||
confirm: () => {
|
),
|
||||||
this.hass
|
confirmText: this.hass.localize(
|
||||||
.callService("homeassistant", "restart")
|
"ui.panel.config.system_dashboard.restart_homeassistant_short"
|
||||||
.catch((reason) => {
|
),
|
||||||
showAlertDialog(this, {
|
confirm: () => {
|
||||||
title: this.hass.localize(
|
this.hass.callService("homeassistant", "restart").catch((reason) => {
|
||||||
"ui.panel.config.system_dashboard.restart_error"
|
showAlertDialog(this, {
|
||||||
),
|
title: this.hass.localize(
|
||||||
text: reason.message,
|
"ui.panel.config.system_dashboard.restart_error"
|
||||||
});
|
),
|
||||||
});
|
text: reason.message,
|
||||||
},
|
});
|
||||||
});
|
});
|
||||||
break;
|
},
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
|
@ -167,8 +167,14 @@ export class DeveloperYamlConfig extends LitElement {
|
|||||||
|
|
||||||
private _restart() {
|
private _restart() {
|
||||||
showConfirmationDialog(this, {
|
showConfirmationDialog(this, {
|
||||||
|
title: this.hass.localize(
|
||||||
|
"ui.panel.developer-tools.tabs.yaml.section.server_management.confirm_restart_title"
|
||||||
|
),
|
||||||
text: this.hass.localize(
|
text: this.hass.localize(
|
||||||
"ui.panel.developer-tools.tabs.yaml.section.server_management.confirm_restart"
|
"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: () => {
|
confirm: () => {
|
||||||
this.hass.callService("homeassistant", "restart").catch((reason) => {
|
this.hass.callService("homeassistant", "restart").catch((reason) => {
|
||||||
|
@ -3170,8 +3170,10 @@
|
|||||||
"supervisor_stats": "Supervisor Stats"
|
"supervisor_stats": "Supervisor Stats"
|
||||||
},
|
},
|
||||||
"system_dashboard": {
|
"system_dashboard": {
|
||||||
"confirm_restart": "Are you sure you want to restart Home Assistant?",
|
"confirm_restart_text": "Restarting Home Assistant will stop all your active dashboards, automations and scripts.",
|
||||||
|
"confirm_restart_title": "Restart Home Assistant?",
|
||||||
"restart_homeassistant": "Restart Home Assistant",
|
"restart_homeassistant": "Restart Home Assistant",
|
||||||
|
"restart_homeassistant_short": "Restart",
|
||||||
"restart_error": "Failed to restart Home Assistant"
|
"restart_error": "Failed to restart Home Assistant"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -4203,10 +4205,9 @@
|
|||||||
},
|
},
|
||||||
"server_management": {
|
"server_management": {
|
||||||
"heading": "Home Assistant",
|
"heading": "Home Assistant",
|
||||||
"introduction": "Restarting Home Assistant will stop your dashboard and automations. After the reboot, each configuration will be reloaded.",
|
"confirm_restart_text": "Restarting Home Assistant will stop all your active dashboards, automations and scripts.",
|
||||||
|
"confirm_restart_title": "Restart Home Assistant?",
|
||||||
"restart": "Restart",
|
"restart": "Restart",
|
||||||
"restart_home_assistant": "Restart Home Assistant",
|
|
||||||
"confirm_restart": "Are you sure you want to restart Home Assistant?",
|
|
||||||
"stop": "Stop",
|
"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"
|
"restart_error": "Failed to restart Home Assistant"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user