mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-17 14:26:35 +00:00
Make trace somewhat useable on mobile (#8752)
This commit is contained in:
parent
b8bfb44aec
commit
46580376dd
@ -31,6 +31,8 @@ import { classMap } from "lit-html/directives/class-map";
|
|||||||
export class HaAutomationTracePathDetails extends LitElement {
|
export class HaAutomationTracePathDetails extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean, reflect: true }) public narrow!: boolean;
|
||||||
|
|
||||||
@property() private selected!: NodeInfo;
|
@property() private selected!: NodeInfo;
|
||||||
|
|
||||||
@property() public trace!: AutomationTraceExtended;
|
@property() public trace!: AutomationTraceExtended;
|
||||||
@ -239,7 +241,7 @@ ${safeDump(trace.changed_variables).trimRight()}</pre
|
|||||||
margin: 16px;
|
margin: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.trace-info {
|
:host(:not([narrow])) .trace-info {
|
||||||
min-height: 250px;
|
min-height: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,13 +40,13 @@ export class HaAutomationTrace extends LitElement {
|
|||||||
|
|
||||||
@property() public automationId!: string;
|
@property() public automationId!: string;
|
||||||
|
|
||||||
@property() public automations!: AutomationEntity[];
|
@property({ attribute: false }) public automations!: AutomationEntity[];
|
||||||
|
|
||||||
@property() public isWide?: boolean;
|
@property({ type: Boolean }) public isWide?: boolean;
|
||||||
|
|
||||||
@property() public narrow!: boolean;
|
@property({ type: Boolean, reflect: true }) public narrow!: boolean;
|
||||||
|
|
||||||
@property() public route!: Route;
|
@property({ attribute: false }) public route!: Route;
|
||||||
|
|
||||||
@internalProperty() private _entityId?: string;
|
@internalProperty() private _entityId?: string;
|
||||||
|
|
||||||
@ -72,6 +72,20 @@ export class HaAutomationTrace extends LitElement {
|
|||||||
"hat-script-graph"
|
"hat-script-graph"
|
||||||
)?.getTrackedNodes();
|
)?.getTrackedNodes();
|
||||||
|
|
||||||
|
const title = stateObj?.attributes.friendly_name || this._entityId;
|
||||||
|
|
||||||
|
const actionButtons = html`<ha-icon-button
|
||||||
|
label="Refresh"
|
||||||
|
icon="hass:refresh"
|
||||||
|
@click=${() => this._loadTraces()}
|
||||||
|
></ha-icon-button>
|
||||||
|
<ha-icon-button
|
||||||
|
.disabled=${!this._runId}
|
||||||
|
label="Download Trace"
|
||||||
|
icon="hass:download"
|
||||||
|
@click=${this._downloadTrace}
|
||||||
|
></ha-icon-button>`;
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<hass-tabs-subpage
|
<hass-tabs-subpage
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@ -80,10 +94,20 @@ export class HaAutomationTrace extends LitElement {
|
|||||||
.backCallback=${() => this._backTapped()}
|
.backCallback=${() => this._backTapped()}
|
||||||
.tabs=${configSections.automation}
|
.tabs=${configSections.automation}
|
||||||
>
|
>
|
||||||
|
${this.narrow
|
||||||
|
? html`<span slot="header">
|
||||||
|
${title}
|
||||||
|
</span>
|
||||||
|
<div slot="toolbar-icon">
|
||||||
|
${actionButtons}
|
||||||
|
</div>`
|
||||||
|
: ""}
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div>
|
${!this.narrow
|
||||||
${stateObj?.attributes.friendly_name || this._entityId}
|
? html`<div>
|
||||||
</div>
|
${title}
|
||||||
|
</div>`
|
||||||
|
: ""}
|
||||||
${this._traces && this._traces.length > 0
|
${this._traces && this._traces.length > 0
|
||||||
? html`
|
? html`
|
||||||
<div>
|
<div>
|
||||||
@ -116,19 +140,7 @@ export class HaAutomationTrace extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
<div>
|
${!this.narrow ? html`<div>${actionButtons}</div>` : ""}
|
||||||
<ha-icon-button
|
|
||||||
label="Refresh"
|
|
||||||
icon="hass:refresh"
|
|
||||||
@click=${() => this._loadTraces()}
|
|
||||||
></ha-icon-button>
|
|
||||||
<ha-icon-button
|
|
||||||
.disabled=${!this._runId}
|
|
||||||
label="Download Trace"
|
|
||||||
icon="hass:download"
|
|
||||||
@click=${this._downloadTrace}
|
|
||||||
></ha-icon-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
${this._traces === undefined
|
${this._traces === undefined
|
||||||
@ -173,6 +185,7 @@ export class HaAutomationTrace extends LitElement {
|
|||||||
? html`
|
? html`
|
||||||
<ha-automation-trace-path-details
|
<ha-automation-trace-path-details
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.narrow=${this.narrow}
|
||||||
.trace=${this._trace}
|
.trace=${this._trace}
|
||||||
.selected=${this._selected}
|
.selected=${this._selected}
|
||||||
.logbookEntries=${this._logbookEntries}
|
.logbookEntries=${this._logbookEntries}
|
||||||
@ -381,12 +394,21 @@ export class HaAutomationTrace extends LitElement {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:host([narrow]) .toolbar > * {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
height: calc(100% - 56px);
|
height: calc(100% - 56px);
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: var(--card-background-color);
|
background-color: var(--card-background-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:host([narrow]) .main {
|
||||||
|
height: auto;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
.graph {
|
.graph {
|
||||||
border-right: 1px solid var(--divider-color);
|
border-right: 1px solid var(--divider-color);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user