mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
don't use entity name as label in more info stats (#14213)
This commit is contained in:
parent
4c8e863c0e
commit
b3e2beac5a
@ -253,7 +253,7 @@ class StatisticsChart extends LitElement {
|
||||
const firstStat = stats[0];
|
||||
const meta = statisticsMetaData?.[firstStat.statistic_id];
|
||||
let name = names[firstStat.statistic_id];
|
||||
if (!name) {
|
||||
if (name === undefined) {
|
||||
name = getStatisticLabel(this.hass, firstStat.statistic_id, meta);
|
||||
}
|
||||
|
||||
@ -324,10 +324,14 @@ class StatisticsChart extends LitElement {
|
||||
const band = drawBands && (type === "min" || type === "max");
|
||||
statTypes.push(type);
|
||||
statDataSets.push({
|
||||
label: `${name} (${this.hass.localize(
|
||||
`ui.components.statistics_charts.statistic_types.${type}`
|
||||
)})
|
||||
`,
|
||||
label: name
|
||||
? `${name} (${this.hass.localize(
|
||||
`ui.components.statistics_charts.statistic_types.${type}`
|
||||
)})
|
||||
`
|
||||
: this.hass.localize(
|
||||
`ui.components.statistics_charts.statistic_types.${type}`
|
||||
),
|
||||
fill: drawBands
|
||||
? type === "min"
|
||||
? "+1"
|
||||
|
@ -36,6 +36,8 @@ export class MoreInfoHistory extends LitElement {
|
||||
|
||||
private _showMoreHref = "";
|
||||
|
||||
private _statNames?: Record<string, string>;
|
||||
|
||||
private _throttleGetStateHistory = throttle(() => {
|
||||
this._getStateHistory();
|
||||
}, 10000);
|
||||
@ -62,6 +64,7 @@ export class MoreInfoHistory extends LitElement {
|
||||
.isLoadingData=${!this._statistics}
|
||||
.statisticsData=${this._statistics}
|
||||
.statTypes=${statTypes}
|
||||
.names=${this._statNames}
|
||||
></statistics-chart>`
|
||||
: html`<state-history-charts
|
||||
up-to-now
|
||||
@ -113,6 +116,7 @@ export class MoreInfoHistory extends LitElement {
|
||||
computeDomain(this.entityId) === "sensor"
|
||||
) {
|
||||
const metadata = await getStatisticMetadata(this.hass, [this.entityId]);
|
||||
this._statNames = { [this.entityId]: "" };
|
||||
if (metadata.length) {
|
||||
this._statistics = await fetchStatistics(
|
||||
this.hass!,
|
||||
|
Loading…
x
Reference in New Issue
Block a user