mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 09:56:36 +00:00
Add logbook note (#8843)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
7d801ff84c
commit
587fb2a170
26
src/components/trace/hat-logbook-note.ts
Normal file
26
src/components/trace/hat-logbook-note.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { LitElement, css, html, customElement } from "lit-element";
|
||||||
|
|
||||||
|
@customElement("hat-logbook-note")
|
||||||
|
class HatLogbookNote extends LitElement {
|
||||||
|
render() {
|
||||||
|
return html`
|
||||||
|
Not all shown logbook entries might be related to this automation.
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
static styles = css`
|
||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
font-style: italic;
|
||||||
|
padding: 16px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"hat-logbook-note": HatLogbookNote;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
import {
|
||||||
|
css,
|
||||||
|
CSSResult,
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
LitElement,
|
||||||
|
property,
|
||||||
|
TemplateResult,
|
||||||
|
} from "lit-element";
|
||||||
|
import type { HomeAssistant } from "../../../../types";
|
||||||
|
import type { LogbookEntry } from "../../../../data/logbook";
|
||||||
|
import "../../../../components/trace/hat-logbook-note";
|
||||||
|
import "../../../logbook/ha-logbook";
|
||||||
|
|
||||||
|
@customElement("ha-automation-trace-logbook")
|
||||||
|
export class HaAutomationTraceLogbook extends LitElement {
|
||||||
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean, reflect: true }) public narrow!: boolean;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public logbookEntries!: LogbookEntry[];
|
||||||
|
|
||||||
|
protected render(): TemplateResult {
|
||||||
|
return this.logbookEntries.length
|
||||||
|
? html`
|
||||||
|
<ha-logbook
|
||||||
|
relative-time
|
||||||
|
.hass=${this.hass}
|
||||||
|
.entries=${this.logbookEntries}
|
||||||
|
.narrow=${this.narrow}
|
||||||
|
></ha-logbook>
|
||||||
|
<hat-logbook-note></hat-logbook-note>
|
||||||
|
`
|
||||||
|
: html`<div class="padded-box">
|
||||||
|
No Logbook entries found for this step.
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get styles(): CSSResult[] {
|
||||||
|
return [
|
||||||
|
css`
|
||||||
|
.padded-box {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"ha-automation-trace-logbook": HaAutomationTraceLogbook;
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ import {
|
|||||||
property,
|
property,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
|
import { classMap } from "lit-html/directives/class-map";
|
||||||
import {
|
import {
|
||||||
ActionTraceStep,
|
ActionTraceStep,
|
||||||
AutomationTraceExtended,
|
AutomationTraceExtended,
|
||||||
@ -18,11 +19,11 @@ import {
|
|||||||
import "../../../../components/ha-icon-button";
|
import "../../../../components/ha-icon-button";
|
||||||
import "../../../../components/ha-code-editor";
|
import "../../../../components/ha-code-editor";
|
||||||
import type { NodeInfo } from "../../../../components/trace/hat-graph";
|
import type { NodeInfo } from "../../../../components/trace/hat-graph";
|
||||||
|
import "../../../../components/trace/hat-logbook-note";
|
||||||
import { HomeAssistant } from "../../../../types";
|
import { HomeAssistant } from "../../../../types";
|
||||||
import { formatDateTimeWithSeconds } from "../../../../common/datetime/format_date_time";
|
import { formatDateTimeWithSeconds } from "../../../../common/datetime/format_date_time";
|
||||||
import { LogbookEntry } from "../../../../data/logbook";
|
import { LogbookEntry } from "../../../../data/logbook";
|
||||||
import { traceTabStyles } from "./styles";
|
import { traceTabStyles } from "./styles";
|
||||||
import { classMap } from "lit-html/directives/class-map";
|
|
||||||
import "../../../logbook/ha-logbook";
|
import "../../../logbook/ha-logbook";
|
||||||
|
|
||||||
@customElement("ha-automation-trace-path-details")
|
@customElement("ha-automation-trace-path-details")
|
||||||
@ -205,12 +206,15 @@ ${safeDump(trace.changed_variables).trimRight()}</pre
|
|||||||
}
|
}
|
||||||
|
|
||||||
return entries.length
|
return entries.length
|
||||||
? html`<ha-logbook
|
? html`
|
||||||
relative-time
|
<ha-logbook
|
||||||
.hass=${this.hass}
|
relative-time
|
||||||
.entries=${entries}
|
.hass=${this.hass}
|
||||||
.narrow=${this.narrow}
|
.entries=${entries}
|
||||||
></ha-logbook>`
|
.narrow=${this.narrow}
|
||||||
|
></ha-logbook>
|
||||||
|
<hat-logbook-note></hat-logbook-note>
|
||||||
|
`
|
||||||
: html`<div class="padded-box">
|
: html`<div class="padded-box">
|
||||||
No Logbook entries found for this step.
|
No Logbook entries found for this step.
|
||||||
</div>`;
|
</div>`;
|
||||||
|
@ -7,19 +7,20 @@ import {
|
|||||||
property,
|
property,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { AutomationTraceExtended } from "../../../../data/trace";
|
import type { AutomationTraceExtended } from "../../../../data/trace";
|
||||||
import { HomeAssistant } from "../../../../types";
|
import type { HomeAssistant } from "../../../../types";
|
||||||
import { LogbookEntry } from "../../../../data/logbook";
|
import type { LogbookEntry } from "../../../../data/logbook";
|
||||||
import "../../../../components/trace/hat-trace-timeline";
|
import "../../../../components/trace/hat-trace-timeline";
|
||||||
import { NodeInfo } from "../../../../components/trace/hat-graph";
|
import type { NodeInfo } from "../../../../components/trace/hat-graph";
|
||||||
|
import "../../../../components/trace/hat-logbook-note";
|
||||||
|
|
||||||
@customElement("ha-automation-trace-timeline")
|
@customElement("ha-automation-trace-timeline")
|
||||||
export class HaAutomationTraceTimeline extends LitElement {
|
export class HaAutomationTraceTimeline extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property() public trace!: AutomationTraceExtended;
|
@property({ attribute: false }) public trace!: AutomationTraceExtended;
|
||||||
|
|
||||||
@property() public logbookEntries!: LogbookEntry[];
|
@property({ attribute: false }) public logbookEntries!: LogbookEntry[];
|
||||||
|
|
||||||
@property() public selected!: NodeInfo;
|
@property() public selected!: NodeInfo;
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ export class HaAutomationTraceTimeline extends LitElement {
|
|||||||
allowPick
|
allowPick
|
||||||
>
|
>
|
||||||
</hat-trace-timeline>
|
</hat-trace-timeline>
|
||||||
|
<hat-logbook-note></hat-logbook-note>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import { showAlertDialog } from "../../../../dialogs/generic/show-dialog-box";
|
|||||||
import "./ha-automation-trace-path-details";
|
import "./ha-automation-trace-path-details";
|
||||||
import "./ha-automation-trace-timeline";
|
import "./ha-automation-trace-timeline";
|
||||||
import "./ha-automation-trace-config";
|
import "./ha-automation-trace-config";
|
||||||
|
import "./ha-automation-trace-logbook";
|
||||||
import { classMap } from "lit-html/directives/class-map";
|
import { classMap } from "lit-html/directives/class-map";
|
||||||
import { traceTabStyles } from "./styles";
|
import { traceTabStyles } from "./styles";
|
||||||
import {
|
import {
|
||||||
@ -252,10 +253,10 @@ export class HaAutomationTrace extends LitElement {
|
|||||||
`
|
`
|
||||||
: this._view === "logbook"
|
: this._view === "logbook"
|
||||||
? html`
|
? html`
|
||||||
<ha-logbook
|
<ha-automation-trace-logbook
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.entries=${this._logbookEntries}
|
.logbookEntries=${this._logbookEntries}
|
||||||
></ha-logbook>
|
></ha-automation-trace-logbook>
|
||||||
`
|
`
|
||||||
: this._view === "blueprint"
|
: this._view === "blueprint"
|
||||||
? html`
|
? html`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user