diff --git a/src/components/ha-ansi-to-html.ts b/src/components/ha-ansi-to-html.ts index ed0b3773e3..5956303ab4 100644 --- a/src/components/ha-ansi-to-html.ts +++ b/src/components/ha-ansi-to-html.ts @@ -12,6 +12,7 @@ import { query, state as litState, } from "lit/decorators"; +import { classMap } from "lit/directives/class-map"; interface State { bold: boolean; @@ -26,12 +27,15 @@ interface State { export class HaAnsiToHtml extends LitElement { @property() public content!: string; + @property({ type: Boolean, attribute: "wrap-disabled" }) public wrapDisabled = + false; + @query("pre") private _pre?: HTMLPreElement; @litState() private _filter = ""; protected render(): TemplateResult | void { - return html`
`;
+    return html`
`;
   }
 
   protected firstUpdated(_changedProperties: PropertyValues): void {
@@ -47,9 +51,11 @@ export class HaAnsiToHtml extends LitElement {
     return css`
       pre {
         overflow-x: auto;
+        margin: 0;
+      }
+      pre.wrap {
         white-space: pre-wrap;
         overflow-wrap: break-word;
-        margin: 0;
       }
       .bold {
         font-weight: bold;
diff --git a/src/panels/config/logs/error-log-card.ts b/src/panels/config/logs/error-log-card.ts
index d7d2bc430e..b89288d720 100644
--- a/src/panels/config/logs/error-log-card.ts
+++ b/src/panels/config/logs/error-log-card.ts
@@ -1,10 +1,16 @@
 import "@material/mwc-list/mwc-list-item";
+import type { ActionDetail } from "@material/mwc-list";
+
 import {
   mdiArrowCollapseDown,
+  mdiDotsVertical,
   mdiCircle,
   mdiDownload,
+  mdiFormatListNumbered,
   mdiMenuDown,
   mdiRefresh,
+  mdiWrap,
+  mdiWrapDisabled,
 } from "@mdi/js";
 import {
   css,
@@ -32,6 +38,8 @@ import "../../../components/chips/ha-assist-chip";
 import "../../../components/ha-menu";
 import "../../../components/ha-md-menu-item";
 import "../../../components/ha-md-divider";
+import "../../../components/ha-button-menu";
+import "../../../components/ha-list-item";
 
 import { getSignedPath } from "../../../data/auth";
 
@@ -114,6 +122,10 @@ class ErrorLogCard extends LitElement {
 
   @state() private _boots?: number[];
 
+  @state() private _showBootsSelect = false;
+
+  @state() private _wrapLines = true;
+
   @state() private _downloadSupported;
 
   @state() private _logsFileLink;
@@ -123,7 +135,7 @@ class ErrorLogCard extends LitElement {
       
${this._error ? html`${this._error}` - : ""} + : nothing}

@@ -131,9 +143,14 @@ class ErrorLogCard extends LitElement { this.hass.localize("ui.panel.config.logs.show_full_logs")}

- ${this._streamSupported && Array.isArray(this._boots) + ${this._streamSupported && + Array.isArray(this._boots) && + this._showBootsSelect ? html` ` : nothing} + ${!this._streamSupported || this._error ? html`` : nothing} + + + + + + ${this.hass.localize( + `ui.panel.config.logs.${this._showBootsSelect ? "hide" : "show"}_haos_boots` + )} + +
@@ -248,7 +285,9 @@ class ErrorLogCard extends LitElement { )}
` : nothing} - +
` - : ""} + : nothing} `; } @@ -653,6 +692,18 @@ class ErrorLogCard extends LitElement { } } + private _toggleLineWrap() { + this._wrapLines = !this._wrapLines; + } + + private _handleOverflowAction(ev: CustomEvent) { + switch (ev.detail.index) { + case 0: + this._showBootsSelect = !this._showBootsSelect; + break; + } + } + private _toggleBootsMenu() { if (this._bootsMenu) { this._bootsMenu.open = !this._bootsMenu.open; diff --git a/src/translations/en.json b/src/translations/en.json index 248a77bebc..5165f03d28 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2496,6 +2496,11 @@ "scroll_down_button": "New logs - Click to scroll", "provider_not_found": "Log provider not found", "provider_not_available": "Logs for ''{provider}'' are not available on your system.", + "haos_boots_title": "Logs of HAOS startup", + "show_haos_boots": "Show HAOS startups", + "hide_haos_boots": "Hide HAOS startups", + "full_width": "Full width", + "wrap_lines": "Wrap lines", "current": "Current", "previous": "Previous", "startups_ago": "{boot} startups ago",