From db9591f8b79226a4b31189467ab7429610ba8d5b Mon Sep 17 00:00:00 2001 From: karwosts Date: Thu, 20 Jun 2024 06:26:40 -0700 Subject: [PATCH] Offer to delete no-longer-recorded statistics --- .../statistics/developer-tools-statistics.ts | 16 ++++++++++++++-- src/translations/en.json | 3 ++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/panels/developer-tools/statistics/developer-tools-statistics.ts b/src/panels/developer-tools/statistics/developer-tools-statistics.ts index 0cb139971695..518dce24b947 100644 --- a/src/panels/developer-tools/statistics/developer-tools-statistics.ts +++ b/src/panels/developer-tools/statistics/developer-tools-statistics.ts @@ -282,6 +282,7 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) { { statistic_id: issue.data.statistic_id } )}`, confirmText: this.hass.localize("ui.common.delete"), + destructive: true, confirm: async () => { await clearStatistics(this.hass, [issue.data.statistic_id]); this._deletedStatistics.add(issue.data.statistic_id); @@ -314,7 +315,7 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) { }); break; case "entity_no_longer_recorded": - showAlertDialog(this, { + showConfirmationDialog(this, { title: this.hass.localize( "ui.panel.developer-tools.tabs.statistics.fix_issue.entity_no_longer_recorded.title" ), @@ -335,7 +336,17 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) { ${this.hass.localize( "ui.panel.developer-tools.tabs.statistics.fix_issue.entity_no_longer_recorded.info_text_3_link" )}`, + >

+ ${this.hass.localize( + "ui.panel.developer-tools.tabs.statistics.fix_issue.entity_no_longer_recorded.info_text_4" + )}`, + confirmText: this.hass.localize("ui.common.delete"), + destructive: true, + confirm: async () => { + await clearStatistics(this.hass, [issue.data.statistic_id]); + this._deletedStatistics.add(issue.data.statistic_id); + this._validateStatistics(); + }, }); break; case "unsupported_state_class": @@ -381,6 +392,7 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) { { statistic_id: issue.data.statistic_id } )}`, confirmText: this.hass.localize("ui.common.delete"), + destructive: true, confirm: async () => { await clearStatistics(this.hass, [issue.data.statistic_id]); this._deletedStatistics.add(issue.data.statistic_id); diff --git a/src/translations/en.json b/src/translations/en.json index d5c1b5b00f5a..24b1f2bcd8c3 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -6744,7 +6744,8 @@ "title": "Entity no longer recorded", "info_text_1": "We have generated statistics for this entity in the past, but state changes of this entity are no longer recorded, therefore, we cannot track long term statistics for it anymore.", "info_text_2": "You probably excluded this entity, or have just included some entities.", - "info_text_3_link": "See the recorder documentation for more information." + "info_text_3_link": "See the recorder documentation for more information.", + "info_text_4": "If you no longer wish to keep the long term statistics recorded in the past, you may delete them now." }, "unsupported_state_class": { "title": "Unsupported state class",