mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Update delete user dialog (#13761)
* Add destructive confirmation style * Update delete user dialog
This commit is contained in:
parent
544c8fe3bb
commit
e13c632afa
@ -2,6 +2,7 @@ import "@material/mwc-button/mwc-button";
|
|||||||
import { mdiAlertOutline } from "@mdi/js";
|
import { mdiAlertOutline } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
|
import { classMap } from "lit/directives/class-map";
|
||||||
import { ifDefined } from "lit/directives/if-defined";
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import "../../components/ha-dialog";
|
import "../../components/ha-dialog";
|
||||||
@ -96,6 +97,9 @@ class DialogBox extends LitElement {
|
|||||||
@click=${this._confirm}
|
@click=${this._confirm}
|
||||||
?dialogInitialFocus=${!this._params.prompt}
|
?dialogInitialFocus=${!this._params.prompt}
|
||||||
slot="primaryAction"
|
slot="primaryAction"
|
||||||
|
class=${classMap({
|
||||||
|
destructive: this._params.destructive || false,
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
${this._params.confirmText
|
${this._params.confirmText
|
||||||
? this._params.confirmText
|
? this._params.confirmText
|
||||||
@ -153,6 +157,9 @@ class DialogBox extends LitElement {
|
|||||||
.secondary {
|
.secondary {
|
||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
}
|
}
|
||||||
|
.destructive {
|
||||||
|
--mdc-theme-primary: var(--error-color);
|
||||||
|
}
|
||||||
ha-dialog {
|
ha-dialog {
|
||||||
--mdc-dialog-heading-ink-color: var(--primary-text-color);
|
--mdc-dialog-heading-ink-color: var(--primary-text-color);
|
||||||
--mdc-dialog-content-ink-color: var(--primary-text-color);
|
--mdc-dialog-content-ink-color: var(--primary-text-color);
|
||||||
|
@ -16,6 +16,7 @@ export interface ConfirmationDialogParams extends BaseDialogBoxParams {
|
|||||||
dismissText?: string;
|
dismissText?: string;
|
||||||
confirm?: () => void;
|
confirm?: () => void;
|
||||||
cancel?: () => void;
|
cancel?: () => void;
|
||||||
|
destructive?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PromptDialogParams extends BaseDialogBoxParams {
|
export interface PromptDialogParams extends BaseDialogBoxParams {
|
||||||
|
@ -207,12 +207,16 @@ export class HaConfigUsers extends LitElement {
|
|||||||
if (
|
if (
|
||||||
!(await showConfirmationDialog(this, {
|
!(await showConfirmationDialog(this, {
|
||||||
title: this.hass!.localize(
|
title: this.hass!.localize(
|
||||||
"ui.panel.config.users.editor.confirm_user_deletion",
|
"ui.panel.config.users.editor.confirm_user_deletion_title",
|
||||||
"name",
|
"name",
|
||||||
entry.name
|
entry.name
|
||||||
),
|
),
|
||||||
|
text: this.hass!.localize(
|
||||||
|
"ui.panel.config.users.editor.confirm_user_deletion_text"
|
||||||
|
),
|
||||||
dismissText: this.hass!.localize("ui.common.cancel"),
|
dismissText: this.hass!.localize("ui.common.cancel"),
|
||||||
confirmText: this.hass!.localize("ui.common.delete"),
|
confirmText: this.hass!.localize("ui.common.delete"),
|
||||||
|
destructive: true,
|
||||||
}))
|
}))
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1293,7 +1293,7 @@
|
|||||||
},
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
"confirmation_title": "Are you sure you want to delete this area?",
|
"confirmation_title": "Are you sure you want to delete this area?",
|
||||||
"confirmation_text": "All devices in this area will become unassigned."
|
"confirmation_text": "This user will be permanently deleted."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"backup": {
|
"backup": {
|
||||||
@ -2974,7 +2974,8 @@
|
|||||||
"system_generated_users_not_removable": "Unable to remove system users.",
|
"system_generated_users_not_removable": "Unable to remove system users.",
|
||||||
"system_generated_users_not_editable": "Unable to update system users.",
|
"system_generated_users_not_editable": "Unable to update system users.",
|
||||||
"unnamed_user": "Unnamed User",
|
"unnamed_user": "Unnamed User",
|
||||||
"confirm_user_deletion": "Are you sure you want to delete {name}?",
|
"confirm_user_deletion_title": "Delete {name}?",
|
||||||
|
"confirm_user_deletion_text": "This user will be permanently deleted.",
|
||||||
"active_tooltip": "Controls if user can login"
|
"active_tooltip": "Controls if user can login"
|
||||||
},
|
},
|
||||||
"add_user": {
|
"add_user": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user