mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
fix reload history when no selection made (#13137)
This commit is contained in:
parent
e8086b6a6f
commit
24688ba18e
@ -121,7 +121,7 @@ class HaPanelHistory extends SubscribeMixin(LitElement) {
|
|||||||
: ""}
|
: ""}
|
||||||
<ha-icon-button
|
<ha-icon-button
|
||||||
@click=${this._getHistory}
|
@click=${this._getHistory}
|
||||||
.disabled=${this._isLoading}
|
.disabled=${this._isLoading || !this._targetPickerValue}
|
||||||
.path=${mdiRefresh}
|
.path=${mdiRefresh}
|
||||||
.label=${this.hass.localize("ui.common.refresh")}
|
.label=${this.hass.localize("ui.common.refresh")}
|
||||||
></ha-icon-button>
|
></ha-icon-button>
|
||||||
@ -254,10 +254,14 @@ class HaPanelHistory extends SubscribeMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _getHistory() {
|
private async _getHistory() {
|
||||||
|
if (!this._targetPickerValue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this._isLoading = true;
|
this._isLoading = true;
|
||||||
const entityIds = this._getEntityIds();
|
const entityIds = this._getEntityIds();
|
||||||
|
|
||||||
if (entityIds === undefined) {
|
if (entityIds === undefined) {
|
||||||
|
this._isLoading = false;
|
||||||
this._stateHistory = undefined;
|
this._stateHistory = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -267,20 +271,22 @@ class HaPanelHistory extends SubscribeMixin(LitElement) {
|
|||||||
this._stateHistory = [];
|
this._stateHistory = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
const dateHistory = await fetchDateWS(
|
||||||
|
this.hass,
|
||||||
|
this._startDate,
|
||||||
|
this._endDate,
|
||||||
|
entityIds
|
||||||
|
);
|
||||||
|
|
||||||
const dateHistory = await fetchDateWS(
|
this._stateHistory = computeHistory(
|
||||||
this.hass,
|
this.hass,
|
||||||
this._startDate,
|
dateHistory,
|
||||||
this._endDate,
|
this.hass.localize
|
||||||
entityIds
|
);
|
||||||
);
|
} finally {
|
||||||
|
this._isLoading = false;
|
||||||
this._stateHistory = computeHistory(
|
}
|
||||||
this.hass,
|
|
||||||
dateHistory,
|
|
||||||
this.hass.localize
|
|
||||||
);
|
|
||||||
this._isLoading = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getEntityIds(): string[] | undefined {
|
private _getEntityIds(): string[] | undefined {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user