mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-17 06:16:33 +00:00
Avoid fetching logbook when there will never be entries (#7239)
This commit is contained in:
parent
5937be695f
commit
c2fba15fc6
@ -6,6 +6,7 @@ import { HomeAssistant } from "../types";
|
|||||||
import { UNAVAILABLE_STATES } from "./entity";
|
import { UNAVAILABLE_STATES } from "./entity";
|
||||||
|
|
||||||
const LOGBOOK_LOCALIZE_PATH = "ui.components.logbook.messages";
|
const LOGBOOK_LOCALIZE_PATH = "ui.components.logbook.messages";
|
||||||
|
export const CONTINUOUS_DOMAINS = ["proximity", "sensor"];
|
||||||
|
|
||||||
export interface LogbookEntry {
|
export interface LogbookEntry {
|
||||||
when: string;
|
when: string;
|
||||||
|
@ -13,7 +13,11 @@ import { computeStateDomain } from "../../common/entity/compute_state_domain";
|
|||||||
import { throttle } from "../../common/util/throttle";
|
import { throttle } from "../../common/util/throttle";
|
||||||
import "../../components/ha-circular-progress";
|
import "../../components/ha-circular-progress";
|
||||||
import "../../components/state-history-charts";
|
import "../../components/state-history-charts";
|
||||||
import { getLogbookData, LogbookEntry } from "../../data/logbook";
|
import {
|
||||||
|
CONTINUOUS_DOMAINS,
|
||||||
|
getLogbookData,
|
||||||
|
LogbookEntry,
|
||||||
|
} from "../../data/logbook";
|
||||||
import "../../panels/logbook/ha-logbook";
|
import "../../panels/logbook/ha-logbook";
|
||||||
import { haStyle, haStyleScrollbar } from "../../resources/styles";
|
import { haStyle, haStyleScrollbar } from "../../resources/styles";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
@ -40,7 +44,12 @@ export class MoreInfoLogbook extends LitElement {
|
|||||||
}
|
}
|
||||||
const stateObj = this.hass.states[this.entityId];
|
const stateObj = this.hass.states[this.entityId];
|
||||||
|
|
||||||
if (!stateObj) {
|
if (!stateObj || stateObj.attributes.unit_of_measurement) {
|
||||||
|
return html``;
|
||||||
|
}
|
||||||
|
|
||||||
|
const domain = computeStateDomain(stateObj);
|
||||||
|
if (CONTINUOUS_DOMAINS.includes(domain)) {
|
||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,9 +164,9 @@ export class MoreInfoLogbook extends LitElement {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||||
ha-logbook {
|
ha-logbook {
|
||||||
max-height: unset;
|
max-height: unset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ha-circular-progress {
|
ha-circular-progress {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user