mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 16:26:43 +00:00
Dont virtualize logbook in more info (#6907)
This commit is contained in:
parent
cdf7558a8e
commit
af74f21af9
@ -8,7 +8,6 @@ import {
|
|||||||
PropertyValues,
|
PropertyValues,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { styleMap } from "lit-html/directives/style-map";
|
|
||||||
import { computeStateDomain } from "../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../common/entity/compute_state_domain";
|
||||||
import "../../components/ha-circular-progress";
|
import "../../components/ha-circular-progress";
|
||||||
import "../../components/state-history-charts";
|
import "../../components/state-history-charts";
|
||||||
@ -16,7 +15,7 @@ import { getRecentWithCache } from "../../data/cached-history";
|
|||||||
import { HistoryResult } from "../../data/history";
|
import { HistoryResult } from "../../data/history";
|
||||||
import { getLogbookData, LogbookEntry } from "../../data/logbook";
|
import { getLogbookData, LogbookEntry } from "../../data/logbook";
|
||||||
import "../../panels/logbook/ha-logbook";
|
import "../../panels/logbook/ha-logbook";
|
||||||
import { haStyle } from "../../resources/styles";
|
import { haStyle, haStyleScrollbar } from "../../resources/styles";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
|
|
||||||
@customElement("ha-more-info-history")
|
@customElement("ha-more-info-history")
|
||||||
@ -59,12 +58,10 @@ export class MoreInfoHistory extends LitElement {
|
|||||||
: this._entries.length
|
: this._entries.length
|
||||||
? html`
|
? html`
|
||||||
<ha-logbook
|
<ha-logbook
|
||||||
|
class="ha-scrollbar"
|
||||||
narrow
|
narrow
|
||||||
no-icon
|
no-icon
|
||||||
no-name
|
no-name
|
||||||
style=${styleMap({
|
|
||||||
height: `${(this._entries.length + 1) * 56}px`,
|
|
||||||
})}
|
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.entries=${this._entries}
|
.entries=${this._entries}
|
||||||
.userIdToName=${this._persons}
|
.userIdToName=${this._persons}
|
||||||
@ -140,6 +137,7 @@ export class MoreInfoHistory extends LitElement {
|
|||||||
static get styles() {
|
static get styles() {
|
||||||
return [
|
return [
|
||||||
haStyle,
|
haStyle,
|
||||||
|
haStyleScrollbar,
|
||||||
css`
|
css`
|
||||||
state-history-charts {
|
state-history-charts {
|
||||||
display: block;
|
display: block;
|
||||||
@ -151,8 +149,8 @@ export class MoreInfoHistory extends LitElement {
|
|||||||
}
|
}
|
||||||
ha-logbook {
|
ha-logbook {
|
||||||
max-height: 360px;
|
max-height: 360px;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
ha-circular-progress {
|
ha-circular-progress {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
@ -21,7 +21,6 @@ import { computeRTL, emitRTLDirection } from "../../common/util/compute_rtl";
|
|||||||
import "../../components/ha-circular-progress";
|
import "../../components/ha-circular-progress";
|
||||||
import "../../components/ha-icon";
|
import "../../components/ha-icon";
|
||||||
import { LogbookEntry } from "../../data/logbook";
|
import { LogbookEntry } from "../../data/logbook";
|
||||||
import { haStyleScrollbar } from "../../resources/styles";
|
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
|
|
||||||
@customElement("ha-logbook")
|
@customElement("ha-logbook")
|
||||||
@ -38,6 +37,9 @@ class HaLogbook extends LitElement {
|
|||||||
@property({ attribute: "rtl", type: Boolean })
|
@property({ attribute: "rtl", type: Boolean })
|
||||||
private _rtl = false;
|
private _rtl = false;
|
||||||
|
|
||||||
|
@property({ type: Boolean, attribute: "virtualize", reflect: true })
|
||||||
|
public virtualize = false;
|
||||||
|
|
||||||
@property({ type: Boolean, attribute: "no-icon" })
|
@property({ type: Boolean, attribute: "no-icon" })
|
||||||
public noIcon = false;
|
public noIcon = false;
|
||||||
|
|
||||||
@ -74,7 +76,7 @@ class HaLogbook extends LitElement {
|
|||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div
|
<div
|
||||||
class="container ha-scrollbar ${classMap({
|
class="container ${classMap({
|
||||||
narrow: this.narrow,
|
narrow: this.narrow,
|
||||||
rtl: this._rtl,
|
rtl: this._rtl,
|
||||||
"no-name": this.noName,
|
"no-name": this.noName,
|
||||||
@ -82,11 +84,15 @@ class HaLogbook extends LitElement {
|
|||||||
})}"
|
})}"
|
||||||
@scroll=${this._saveScrollPos}
|
@scroll=${this._saveScrollPos}
|
||||||
>
|
>
|
||||||
${scroll({
|
${this.virtualize
|
||||||
|
? scroll({
|
||||||
items: this.entries,
|
items: this.entries,
|
||||||
renderItem: (item: LogbookEntry, index?: number) =>
|
renderItem: (item: LogbookEntry, index?: number) =>
|
||||||
this._renderLogbookItem(item, index),
|
this._renderLogbookItem(item, index),
|
||||||
})}
|
})
|
||||||
|
: this.entries.map((item, index) =>
|
||||||
|
this._renderLogbookItem(item, index)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -185,10 +191,8 @@ class HaLogbook extends LitElement {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResult[] {
|
static get styles(): CSSResult {
|
||||||
return [
|
return css`
|
||||||
haStyleScrollbar,
|
|
||||||
css`
|
|
||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -283,8 +287,7 @@ class HaLogbook extends LitElement {
|
|||||||
.narrow .icon-message ha-icon {
|
.narrow .icon-message ha-icon {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
`,
|
`;
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
|
import { mdiRefresh } from "@mdi/js";
|
||||||
import "@polymer/app-layout/app-header/app-header";
|
import "@polymer/app-layout/app-header/app-header";
|
||||||
import "@polymer/app-layout/app-toolbar/app-toolbar";
|
import "@polymer/app-layout/app-toolbar/app-toolbar";
|
||||||
import "../../components/ha-icon-button";
|
|
||||||
import "../../components/ha-circular-progress";
|
|
||||||
import { computeRTL } from "../../common/util/compute_rtl";
|
|
||||||
import "../../components/entity/ha-entity-picker";
|
|
||||||
import "../../components/ha-menu-button";
|
|
||||||
import "../../layouts/ha-app-layout";
|
|
||||||
import "./ha-logbook";
|
|
||||||
import {
|
import {
|
||||||
LitElement,
|
css,
|
||||||
property,
|
|
||||||
internalProperty,
|
|
||||||
customElement,
|
customElement,
|
||||||
html,
|
html,
|
||||||
css,
|
internalProperty,
|
||||||
|
LitElement,
|
||||||
|
property,
|
||||||
PropertyValues,
|
PropertyValues,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { HomeAssistant } from "../../types";
|
import { computeRTL } from "../../common/util/compute_rtl";
|
||||||
import { haStyle } from "../../resources/styles";
|
import "../../components/entity/ha-entity-picker";
|
||||||
import { fetchUsers } from "../../data/user";
|
import "../../components/ha-circular-progress";
|
||||||
import { fetchPersons } from "../../data/person";
|
import "../../components/ha-date-range-picker";
|
||||||
|
import type { DateRangePickerRanges } from "../../components/ha-date-range-picker";
|
||||||
|
import "../../components/ha-icon-button";
|
||||||
|
import "../../components/ha-menu-button";
|
||||||
import {
|
import {
|
||||||
clearLogbookCache,
|
clearLogbookCache,
|
||||||
getLogbookData,
|
getLogbookData,
|
||||||
LogbookEntry,
|
LogbookEntry,
|
||||||
} from "../../data/logbook";
|
} from "../../data/logbook";
|
||||||
import { mdiRefresh } from "@mdi/js";
|
import { fetchPersons } from "../../data/person";
|
||||||
import "../../components/ha-date-range-picker";
|
import { fetchUsers } from "../../data/user";
|
||||||
import type { DateRangePickerRanges } from "../../components/ha-date-range-picker";
|
import "../../layouts/ha-app-layout";
|
||||||
|
import { haStyle } from "../../resources/styles";
|
||||||
|
import { HomeAssistant } from "../../types";
|
||||||
|
import "./ha-logbook";
|
||||||
|
|
||||||
@customElement("ha-panel-logbook")
|
@customElement("ha-panel-logbook")
|
||||||
export class HaPanelLogbook extends LitElement {
|
export class HaPanelLogbook extends LitElement {
|
||||||
@ -125,6 +125,7 @@ export class HaPanelLogbook extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.entries=${this._entries}
|
.entries=${this._entries}
|
||||||
.userIdToName=${this._userIdToName}
|
.userIdToName=${this._userIdToName}
|
||||||
|
virtualize
|
||||||
></ha-logbook>`}
|
></ha-logbook>`}
|
||||||
</ha-app-layout>
|
</ha-app-layout>
|
||||||
`;
|
`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user