mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-15 21:36:36 +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";
|
||||
|
||||
const LOGBOOK_LOCALIZE_PATH = "ui.components.logbook.messages";
|
||||
export const CONTINUOUS_DOMAINS = ["proximity", "sensor"];
|
||||
|
||||
export interface LogbookEntry {
|
||||
when: string;
|
||||
|
@ -13,7 +13,11 @@ import { computeStateDomain } from "../../common/entity/compute_state_domain";
|
||||
import { throttle } from "../../common/util/throttle";
|
||||
import "../../components/ha-circular-progress";
|
||||
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 { haStyle, haStyleScrollbar } from "../../resources/styles";
|
||||
import { HomeAssistant } from "../../types";
|
||||
@ -40,7 +44,12 @@ export class MoreInfoLogbook extends LitElement {
|
||||
}
|
||||
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``;
|
||||
}
|
||||
|
||||
@ -155,9 +164,9 @@ export class MoreInfoLogbook extends LitElement {
|
||||
overflow: auto;
|
||||
}
|
||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||
ha-logbook {
|
||||
max-height: unset;
|
||||
}
|
||||
ha-logbook {
|
||||
max-height: unset;
|
||||
}
|
||||
}
|
||||
ha-circular-progress {
|
||||
display: flex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user