Hide adjust stat dialog unless it has a sum

This commit is contained in:
Paulus Schoutsen 2022-03-23 15:10:45 -07:00
parent f493280f0a
commit 1e540a36dd
2 changed files with 22 additions and 20 deletions

View File

@ -84,6 +84,8 @@ export interface StatisticsMetaData {
statistic_id: string; statistic_id: string;
source: string; source: string;
name?: string | null; name?: string | null;
has_sum: boolean;
has_mean: boolean;
} }
export type StatisticsValidationResult = export type StatisticsValidationResult =

View File

@ -117,10 +117,9 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) {
actions: { actions: {
title: "", title: "",
type: "overflow-menu", type: "overflow-menu",
template: ( template: (_info, statistic: StatisticsMetaData) =>
_info, statistic.has_sum
statistic: StatisticsMetaData ? html`<ha-icon-overflow-menu
) => html`<ha-icon-overflow-menu
.hass=${this.hass} .hass=${this.hass}
.narrow=${this.narrow} .narrow=${this.narrow}
.items=${[ .items=${[
@ -136,7 +135,8 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) {
}, },
]} ]}
style="color: var(--secondary-text-color)" style="color: var(--secondary-text-color)"
></ha-icon-overflow-menu>`, ></ha-icon-overflow-menu>`
: html``,
}, },
}) })
); );