Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 41 additions & 3 deletions src/panels/config/areas/ha-config-area-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { afterNextRender } from "../../../common/util/render-status";
import "../../../components/ha-card";
import "../../../components/ha-icon-button";
import "../../../components/ha-icon-next";
import "../../logbook/ha-logbook";
import {
AreaRegistryEntry,
deleteAreaRegistryEntry,
Expand Down Expand Up @@ -72,6 +73,8 @@ class HaConfigAreaPage extends LitElement {

@state() private _related?: RelatedResult;

private _logbookTime = { recent: 86400 };

private _area = memoizeOne(
(
areaId: string,
Expand Down Expand Up @@ -115,6 +118,16 @@ class HaConfigAreaPage extends LitElement {
}
);

private _allEntities = memoizeOne(
(memberships: {
entities: EntityRegistryEntry[];
indirectEntities: EntityRegistryEntry[];
}) =>
memberships.entities
.map((entry) => entry.entity_id)
.concat(memberships.indirectEntities.map((entry) => entry.entity_id))
);

protected firstUpdated(changedProps) {
super.firstUpdated(changedProps);
loadAreaRegistryDetailDialog();
Expand All @@ -139,11 +152,12 @@ class HaConfigAreaPage extends LitElement {
`;
}

const { devices, entities } = this._memberships(
const memberships = this._memberships(
this.areaId,
this.devices,
this.entities
);
const { devices, entities } = memberships;

// Pre-compute the entity and device names, so we can sort by them
if (devices) {
Expand Down Expand Up @@ -359,8 +373,6 @@ class HaConfigAreaPage extends LitElement {
</ha-card>
`
: ""}
</div>
<div class="column">
${isComponentLoaded(this.hass, "scene")
? html`
<ha-card
Expand Down Expand Up @@ -442,6 +454,25 @@ class HaConfigAreaPage extends LitElement {
`
: ""}
</div>
<div class="column">
${isComponentLoaded(this.hass, "logbook")
? html`
<ha-card
outlined
.header=${this.hass.localize("panel.logbook")}
>
<ha-logbook
.hass=${this.hass}
.time=${this._logbookTime}
.entityIds=${this._allEntities(memberships)}
virtualize
narrow
no-icon
></ha-logbook>
</ha-card>
`
: ""}
</div>
</div>
</hass-tabs-subpage>
`;
Expand Down Expand Up @@ -699,6 +730,13 @@ class HaConfigAreaPage extends LitElement {
opacity: 0.5;
border-radius: 50%;
}
ha-logbook {
height: 800px;
}
:host([narrow]) ha-logbook {
height: 400px;
overflow: auto;
}
`,
];
}
Expand Down
5 changes: 4 additions & 1 deletion src/panels/logbook/ha-logbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,11 @@ export class HaLogbook extends LitElement {
static get styles() {
return [
css`
:host([virtualize]) {
:host {
display: block;
}

:host([virtualize]) {
height: 100%;
}

Expand Down