Skip to content

Commit

Permalink
Improve delete device button and confirmation dialog (#13500)
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery authored Sep 1, 2022
1 parent 2751adf commit e273b6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/panels/config/devices/ha-config-device-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,18 @@ export class HaConfigDevicePage extends LitElement {
buttons.push({
action: async () => {
const confirmed = await showConfirmationDialog(this, {
text: this.hass.localize("ui.panel.config.devices.confirm_delete"),
text:
this._integrations(device, this.entries).length > 1
? this.hass.localize(
`ui.panel.config.devices.confirm_delete_integration`,
{
integration: domainToName(
this.hass.localize,
entry.domain
),
}
)
: this.hass.localize(`ui.panel.config.devices.confirm_delete`),
});

if (!confirmed) {
Expand All @@ -960,7 +971,7 @@ export class HaConfigDevicePage extends LitElement {
classes: "warning",
icon: mdiDelete,
label:
buttons.length > 1
this._integrations(device, this.entries).length > 1
? this.hass.localize(
`ui.panel.config.devices.delete_device_integration`,
{
Expand Down
3 changes: 2 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2576,7 +2576,7 @@
"download_diagnostics": "Download diagnostics",
"download_diagnostics_integration": "Download {integration} diagnostics",
"delete_device": "Delete",
"delete_device_integration": "Remove {integration} from device",
"delete_device_integration": "Remove device from {integration}",
"type": {
"device_heading": "Device",
"device": "device",
Expand Down Expand Up @@ -2653,6 +2653,7 @@
},
"delete": "Delete",
"confirm_delete": "Are you sure you want to delete this device?",
"confirm_delete_integration": "Are you sure you want to remove this device from {integration}?",
"picker": {
"search": "Search devices",
"filter": {
Expand Down

0 comments on commit e273b6b

Please sign in to comment.