🚸 prompt user to confirm logout (#4501)

* 🚸 prompt user to confirm logout

* 👌 update dialog title/text/confirm
This commit is contained in:
Ian Richardson 2020-01-19 00:02:36 -06:00 committed by Paulus Schoutsen
parent 28511d0cbf
commit 1a2ebabd22
2 changed files with 9 additions and 1 deletions

View File

@ -37,6 +37,7 @@ import { haStyle } from "../../resources/styles";
import { HomeAssistant } from "../../types"; import { HomeAssistant } from "../../types";
import { fireEvent } from "../../common/dom/fire_event"; import { fireEvent } from "../../common/dom/fire_event";
import { UnsubscribeFunc } from "home-assistant-js-websocket"; import { UnsubscribeFunc } from "home-assistant-js-websocket";
import { showConfirmationDialog } from "../../dialogs/confirmation/show-dialog-confirmation";
class HaPanelProfile extends LitElement { class HaPanelProfile extends LitElement {
@property() public hass!: HomeAssistant; @property() public hass!: HomeAssistant;
@ -173,7 +174,12 @@ class HaPanelProfile extends LitElement {
} }
private _handleLogOut() { private _handleLogOut() {
fireEvent(this, "hass-logout"); showConfirmationDialog(this, {
title: this.hass.localize("ui.panel.profile.logout_title"),
text: this.hass.localize("ui.panel.profile.logout_text"),
confirmBtnText: this.hass.localize("ui.panel.profile.logout"),
confirm: () => fireEvent(this, "hass-logout"),
});
} }
static get styles(): CSSResultArray { static get styles(): CSSResultArray {

View File

@ -1848,6 +1848,8 @@
"current_user": "You are currently logged in as {fullName}.", "current_user": "You are currently logged in as {fullName}.",
"is_owner": "You are an owner.", "is_owner": "You are an owner.",
"logout": "Log out", "logout": "Log out",
"logout_title": "Log out?",
"logout_text": "Are you sure you want to log out?",
"force_narrow": { "force_narrow": {
"header": "Always hide the sidebar", "header": "Always hide the sidebar",
"description": "This will hide the sidebar by default, similar to the mobile experience." "description": "This will hide the sidebar by default, similar to the mobile experience."