Skip to content

Commit

Permalink
Various fixes in dialogs (#20935)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
silamon authored Jun 21, 2024
1 parent 2e5cce5 commit d3222f8
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 22 deletions.
3 changes: 3 additions & 0 deletions src/panels/config/devices/ha-config-device-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,9 @@ export class HaConfigDevicePage extends LitElement {
: this.hass.localize(
`ui.panel.config.devices.confirm_delete`
),
confirmText: this.hass.localize("ui.common.delete"),
dismissText: this.hass.localize("ui.common.cancel"),
destructive: true,
});

if (!confirmed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export class EntitySettingsHelperTab extends LitElement {
text: this.hass.localize(
"ui.dialogs.entity_registry.editor.confirm_delete"
),
confirmText: this.hass.localize("ui.common.delete"),
dismissText: this.hass.localize("ui.common.cancel"),
destructive: true,
}))
) {
return;
Expand Down
3 changes: 3 additions & 0 deletions src/panels/config/entities/entity-registry-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) {
text: this.hass.localize(
"ui.dialogs.entity_registry.editor.confirm_delete"
),
confirmText: this.hass.localize("ui.common.delete"),
dismissText: this.hass.localize("ui.common.cancel"),
destructive: true,
}))
) {
return;
Expand Down
16 changes: 7 additions & 9 deletions src/panels/config/entities/ha-config-entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ ${
></ha-svg-icon>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.entities.picker.remove_selected.button"
"ui.panel.config.entities.picker.delete_selected.button"
)}
</div>
</ha-menu-item>
Expand Down Expand Up @@ -1256,25 +1256,23 @@ ${rejected
});
showConfirmationDialog(this, {
title: this.hass.localize(
`ui.panel.config.entities.picker.remove_selected.confirm_${
removeableEntities.length !== this._selected.length ? "partly_" : ""
}title`,
{ number: removeableEntities.length }
`ui.panel.config.entities.picker.delete_selected.confirm_title`
),
text:
removeableEntities.length === this._selected.length
? this.hass.localize(
"ui.panel.config.entities.picker.remove_selected.confirm_text"
"ui.panel.config.entities.picker.delete_selected.confirm_text"
)
: 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,
}
),
confirmText: this.hass.localize("ui.common.remove"),
confirmText: this.hass.localize("ui.common.delete"),
dismissText: this.hass.localize("ui.common.cancel"),
destructive: true,
confirm: () => {
removeableEntities.forEach((entity) =>
removeEntityRegistryEntry(this.hass, entity)
Expand Down
2 changes: 0 additions & 2 deletions src/panels/config/repairs/dialog-integration-startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class DialogIntegrationStartup extends LitElement {
return html`
<ha-dialog
open
scrimClickAction
escapeKeyAction
hideActions
.heading=${createCloseHeading(
this.hass,
Expand Down
2 changes: 0 additions & 2 deletions src/panels/config/repairs/dialog-system-information.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ class DialogSystemInformation extends LitElement {
<ha-dialog
open
@closed=${this.closeDialog}
scrimClickAction
escapeKeyAction
.heading=${createCloseHeading(
this.hass,
this.hass.localize("ui.panel.config.repairs.system_information")
Expand Down
2 changes: 1 addition & 1 deletion src/panels/profile/ha-refresh-tokens-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class HaRefreshTokens extends LitElement {
text: this.hass.localize(
"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,
}))
) {
Expand Down
16 changes: 8 additions & 8 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@
"refresh": "Refresh",
"cancel": "Cancel",
"delete": "Delete",
"delete_all": "Delete all",
"download": "[%key:supervisor::backup::download%]",
"duplicate": "Duplicate",
"remove": "Remove",
Expand Down Expand Up @@ -4094,12 +4095,11 @@
"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."
},
"remove_selected": {
"button": "Remove selected",
"confirm_title": "Do you want to remove {number} {number, plural,\n one {entity}\n other {entities}\n}?",
"confirm_partly_title": "Only {number} {number, plural,\n one {selected entity}\n other {selected entities}\n} can be removed.",
"confirm_text": "You should remove them from your dashboard config and automations if they contain 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?"
"delete_selected": {
"button": "Delete selected",
"confirm_title": "Delete selected entities?",
"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_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."
},
"hide_selected": {
"button": "Hide selected",
Expand Down Expand Up @@ -6390,10 +6390,10 @@
"disable_expiration_failed": "Failed to disable refresh token expiration",
"enable_expiration_failed": "Failed to enable refresh token expiration",
"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",
"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.",
"current_token_tooltip": "Unable to delete current refresh token"
},
Expand Down

0 comments on commit d3222f8

Please sign in to comment.