mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix map card error rendering (#15910)
This commit is contained in:
parent
f2cf598f98
commit
0f97a76428
@ -11,6 +11,7 @@ import { classMap } from "lit/directives/class-map";
|
|||||||
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
||||||
import "../../../components/chart/state-history-charts";
|
import "../../../components/chart/state-history-charts";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
|
import "../../../components/ha-alert";
|
||||||
import {
|
import {
|
||||||
computeHistory,
|
computeHistory,
|
||||||
HistoryResult,
|
HistoryResult,
|
||||||
@ -192,10 +193,10 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard {
|
|||||||
>
|
>
|
||||||
${this._error
|
${this._error
|
||||||
? html`
|
? html`
|
||||||
<div>
|
<ha-alert alert-type="error">
|
||||||
${this.hass.localize("ui.components.history_charts.error")} :
|
${this.hass.localize("ui.components.history_charts.error")}:
|
||||||
${this._error.message || this._error.code}
|
${this._error.message || this._error.code}
|
||||||
</div>
|
</ha-alert>
|
||||||
`
|
`
|
||||||
: html`
|
: html`
|
||||||
<state-history-charts
|
<state-history-charts
|
||||||
|
@ -22,6 +22,7 @@ import {
|
|||||||
import { computeDomain } from "../../../common/entity/compute_domain";
|
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||||
import parseAspectRatio from "../../../common/util/parse-aspect-ratio";
|
import parseAspectRatio from "../../../common/util/parse-aspect-ratio";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
|
import "../../../components/ha-alert";
|
||||||
import "../../../components/ha-icon-button";
|
import "../../../components/ha-icon-button";
|
||||||
import "../../../components/map/ha-map";
|
import "../../../components/map/ha-map";
|
||||||
import type {
|
import type {
|
||||||
@ -65,7 +66,7 @@ class HuiMapCard extends LitElement implements LovelaceCard {
|
|||||||
|
|
||||||
private _colorIndex = 0;
|
private _colorIndex = 0;
|
||||||
|
|
||||||
private _error?: string;
|
@state() private _error?: { code: string; message: string };
|
||||||
|
|
||||||
private _subscribed?: Promise<(() => Promise<void>) | void>;
|
private _subscribed?: Promise<(() => Promise<void>) | void>;
|
||||||
|
|
||||||
@ -139,7 +140,10 @@ class HuiMapCard extends LitElement implements LovelaceCard {
|
|||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
if (this._error) {
|
if (this._error) {
|
||||||
return html`<div class="error">${this._error}</div>`;
|
return html`<ha-alert alert-type="error">
|
||||||
|
${this.hass.localize("ui.components.map.error")}: ${this._error.message}
|
||||||
|
(${this._error.code})
|
||||||
|
</ha-alert>`;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<ha-card id="card" .header=${this._config.title}>
|
<ha-card id="card" .header=${this._config.title}>
|
||||||
|
@ -491,6 +491,9 @@
|
|||||||
"no_history_found": "No state history found.",
|
"no_history_found": "No state history found.",
|
||||||
"error": "Unable to load history"
|
"error": "Unable to load history"
|
||||||
},
|
},
|
||||||
|
"map": {
|
||||||
|
"error": "Unable to load map"
|
||||||
|
},
|
||||||
"statistics_charts": {
|
"statistics_charts": {
|
||||||
"loading_statistics": "Loading statistics…",
|
"loading_statistics": "Loading statistics…",
|
||||||
"no_statistics_found": "No statistics found.",
|
"no_statistics_found": "No statistics found.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user