Various fixes in dialogs (#20935)

* allow escape and scrim action for repair dialogs

* improve delete entity dialogs

* reiterate refresh token dialog wordings (kept refresh token for now)

* improve device delete dialogs

* Improve deletable text and invalidation
This commit is contained in:
Simon Lamon 2024-06-21 11:15:01 +02:00 committed by GitHub
parent 2e5cce5409
commit d3222f8bb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 25 additions and 22 deletions

View File

@ -1028,6 +1028,9 @@ export class HaConfigDevicePage extends LitElement {
: this.hass.localize( : this.hass.localize(
`ui.panel.config.devices.confirm_delete` `ui.panel.config.devices.confirm_delete`
), ),
confirmText: this.hass.localize("ui.common.delete"),
dismissText: this.hass.localize("ui.common.cancel"),
destructive: true,
}); });
if (!confirmed) { if (!confirmed) {

View File

@ -164,6 +164,9 @@ export class EntitySettingsHelperTab extends LitElement {
text: this.hass.localize( text: this.hass.localize(
"ui.dialogs.entity_registry.editor.confirm_delete" "ui.dialogs.entity_registry.editor.confirm_delete"
), ),
confirmText: this.hass.localize("ui.common.delete"),
dismissText: this.hass.localize("ui.common.cancel"),
destructive: true,
})) }))
) { ) {
return; return;

View File

@ -215,6 +215,9 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
text: this.hass.localize( text: this.hass.localize(
"ui.dialogs.entity_registry.editor.confirm_delete" "ui.dialogs.entity_registry.editor.confirm_delete"
), ),
confirmText: this.hass.localize("ui.common.delete"),
dismissText: this.hass.localize("ui.common.cancel"),
destructive: true,
})) }))
) { ) {
return; return;

View File

@ -839,7 +839,7 @@ ${
></ha-svg-icon> ></ha-svg-icon>
<div slot="headline"> <div slot="headline">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.entities.picker.remove_selected.button" "ui.panel.config.entities.picker.delete_selected.button"
)} )}
</div> </div>
</ha-menu-item> </ha-menu-item>
@ -1256,25 +1256,23 @@ ${rejected
}); });
showConfirmationDialog(this, { showConfirmationDialog(this, {
title: this.hass.localize( title: this.hass.localize(
`ui.panel.config.entities.picker.remove_selected.confirm_${ `ui.panel.config.entities.picker.delete_selected.confirm_title`
removeableEntities.length !== this._selected.length ? "partly_" : ""
}title`,
{ number: removeableEntities.length }
), ),
text: text:
removeableEntities.length === this._selected.length removeableEntities.length === this._selected.length
? this.hass.localize( ? this.hass.localize(
"ui.panel.config.entities.picker.remove_selected.confirm_text" "ui.panel.config.entities.picker.delete_selected.confirm_text"
) )
: this.hass.localize( : this.hass.localize(
"ui.panel.config.entities.picker.remove_selected.confirm_partly_text", "ui.panel.config.entities.picker.delete_selected.confirm_partly_text",
{ {
removable: removeableEntities.length, deletable: removeableEntities.length,
selected: this._selected.length, selected: this._selected.length,
} }
), ),
confirmText: this.hass.localize("ui.common.remove"), confirmText: this.hass.localize("ui.common.delete"),
dismissText: this.hass.localize("ui.common.cancel"), dismissText: this.hass.localize("ui.common.cancel"),
destructive: true,
confirm: () => { confirm: () => {
removeableEntities.forEach((entity) => removeableEntities.forEach((entity) =>
removeEntityRegistryEntry(this.hass, entity) removeEntityRegistryEntry(this.hass, entity)

View File

@ -31,8 +31,6 @@ class DialogIntegrationStartup extends LitElement {
return html` return html`
<ha-dialog <ha-dialog
open open
scrimClickAction
escapeKeyAction
hideActions hideActions
.heading=${createCloseHeading( .heading=${createCloseHeading(
this.hass, this.hass,

View File

@ -143,8 +143,6 @@ class DialogSystemInformation extends LitElement {
<ha-dialog <ha-dialog
open open
@closed=${this.closeDialog} @closed=${this.closeDialog}
scrimClickAction
escapeKeyAction
.heading=${createCloseHeading( .heading=${createCloseHeading(
this.hass, this.hass,
this.hass.localize("ui.panel.config.repairs.system_information") this.hass.localize("ui.panel.config.repairs.system_information")

View File

@ -301,7 +301,7 @@ class HaRefreshTokens extends LitElement {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.profile.refresh_tokens.confirm_delete_all" "ui.panel.profile.refresh_tokens.confirm_delete_all"
), ),
confirmText: this.hass.localize("ui.common.delete"), confirmText: this.hass.localize("ui.common.delete_all"),
destructive: true, destructive: true,
})) }))
) { ) {

View File

@ -326,6 +326,7 @@
"refresh": "Refresh", "refresh": "Refresh",
"cancel": "Cancel", "cancel": "Cancel",
"delete": "Delete", "delete": "Delete",
"delete_all": "Delete all",
"download": "[%key:supervisor::backup::download%]", "download": "[%key:supervisor::backup::download%]",
"duplicate": "Duplicate", "duplicate": "Duplicate",
"remove": "Remove", "remove": "Remove",
@ -4094,12 +4095,11 @@
"confirm_title": "Do you want to disable {number} {number, plural,\n one {entity}\n other {entities}\n}?", "confirm_title": "Do you want to disable {number} {number, plural,\n one {entity}\n other {entities}\n}?",
"confirm_text": "Disabled entities will not be added to Home Assistant." "confirm_text": "Disabled entities will not be added to Home Assistant."
}, },
"remove_selected": { "delete_selected": {
"button": "Remove selected", "button": "Delete selected",
"confirm_title": "Do you want to remove {number} {number, plural,\n one {entity}\n other {entities}\n}?", "confirm_title": "Delete selected entities?",
"confirm_partly_title": "Only {number} {number, plural,\n one {selected entity}\n other {selected entities}\n} can be removed.", "confirm_text": "Are you sure you want to delete the entities?\n\nRemove them from your dashboard and automations if they include these entities.",
"confirm_text": "You should remove them from your dashboard config and automations if they contain these entities.", "confirm_partly_text": "You can only delete {deletable} of the {selected} entities. The others require the integration to stop providing them, and sometimes a Home Assistant restart is needed. Are you sure you want to delete the deletable entities?\n\nRemove them from your dashboard and automations if they include these entities."
"confirm_partly_text": "You can only remove {removable} of the selected {selected} entities. Entities can only be removed when the integration is no longer providing the entities. Sometimes you have to restart Home Assistant before you can remove the entities of a removed integration. Are you sure you want to remove the removable entities?"
}, },
"hide_selected": { "hide_selected": {
"button": "Hide selected", "button": "Hide selected",
@ -6390,10 +6390,10 @@
"disable_expiration_failed": "Failed to disable refresh token expiration", "disable_expiration_failed": "Failed to disable refresh token expiration",
"enable_expiration_failed": "Failed to enable refresh token expiration", "enable_expiration_failed": "Failed to enable refresh token expiration",
"confirm_delete_title": "Delete refresh token?", "confirm_delete_title": "Delete refresh token?",
"confirm_delete_text": "The refresh token for ''{name}'' will be permanently deleted. This will end the login session on the associated device.", "confirm_delete_text": "The refresh token for ''{name}'' will be permanently deleted. This associated device will not have access anymore.",
"delete_all_tokens": "Delete all tokens", "delete_all_tokens": "Delete all tokens",
"confirm_delete_all_title": "Delete all refresh tokens?", "confirm_delete_all_title": "Delete all refresh tokens?",
"confirm_delete_all": "Are you sure you want to delete all refresh tokens? Your current session token will not be removed. Your long-lived access tokens will not be removed.", "confirm_delete_all": "Are you sure you want to delete all refresh tokens? These associated devices will not have access anymore. Your current session and long-lived access tokens will not be deleted.",
"delete_failed": "Failed to delete the refresh token.", "delete_failed": "Failed to delete the refresh token.",
"current_token_tooltip": "Unable to delete current refresh token" "current_token_tooltip": "Unable to delete current refresh token"
}, },