From e273b6b65992bc33b58d34c3f5ecb5812162a583 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 1 Sep 2022 17:38:56 +0200 Subject: [PATCH] Improve delete device button and confirmation dialog (#13500) --- .../config/devices/ha-config-device-page.ts | 15 +++++++++++++-- src/translations/en.json | 3 ++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/panels/config/devices/ha-config-device-page.ts b/src/panels/config/devices/ha-config-device-page.ts index be85cdad5686..ddb82c4ca6cc 100644 --- a/src/panels/config/devices/ha-config-device-page.ts +++ b/src/panels/config/devices/ha-config-device-page.ts @@ -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) { @@ -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`, { diff --git a/src/translations/en.json b/src/translations/en.json index aa3507a6949c..920ec904997f 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -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", @@ -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": {