Compare commits

...

2 Commits

Author SHA1 Message Date
Paulus Schoutsen
6b6736a9f5 Lint 2022-03-23 15:43:24 -07:00
Paulus Schoutsen
1e540a36dd Hide adjust stat dialog unless it has a sum 2022-03-23 15:10:45 -07:00
2 changed files with 24 additions and 20 deletions

View File

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

View File

@@ -117,26 +117,26 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) {
actions: {
title: "",
type: "overflow-menu",
template: (
_info,
statistic: StatisticsMetaData
) => html`<ha-icon-overflow-menu
.hass=${this.hass}
.narrow=${this.narrow}
.items=${[
{
path: mdiSlopeUphill,
label: localize(
"ui.panel.developer-tools.tabs.statistics.adjust_sum"
),
action: () =>
showStatisticsAdjustSumDialog(this, {
statistic: statistic,
}),
},
]}
style="color: var(--secondary-text-color)"
></ha-icon-overflow-menu>`,
template: (_info, statistic: StatisticsMetaData) =>
statistic.has_sum
? html`<ha-icon-overflow-menu
.hass=${this.hass}
.narrow=${this.narrow}
.items=${[
{
path: mdiSlopeUphill,
label: localize(
"ui.panel.developer-tools.tabs.statistics.adjust_sum"
),
action: () =>
showStatisticsAdjustSumDialog(this, {
statistic: statistic,
}),
},
]}
style="color: var(--secondary-text-color)"
></ha-icon-overflow-menu>`
: html``,
},
})
);
@@ -212,6 +212,8 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) {
source: "",
state: this.hass.states[statisticId],
issues: issues[statisticId],
has_sum: false,
has_mean: false,
});
}
});