Skip to content

Commit 5de8d07

Browse files
authored
Fix ha-buttons (#26373)
* Fix ha-button supervisor network * Fix button appearance for entity row * Fix logs button menu mobile width * Fix new logs indicator
1 parent 3a31a4a commit 5de8d07

File tree

6 files changed

+36
-24
lines changed

6 files changed

+36
-24
lines changed

landing-page/src/components/landing-page-logs.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ import { mdiArrowCollapseDown, mdiDownload } from "@mdi/js";
33
// eslint-disable-next-line import/extensions
44
import { IntersectionController } from "@lit-labs/observers/intersection-controller.js";
55
import { LitElement, type PropertyValues, css, html, nothing } from "lit";
6-
import { classMap } from "lit/directives/class-map";
76
import { customElement, property, query, state } from "lit/decorators";
7+
import { classMap } from "lit/directives/class-map";
8+
import { fireEvent } from "../../../src/common/dom/fire_event";
89
import type {
910
LandingPageKeys,
1011
LocalizeFunc,
1112
} from "../../../src/common/translations/localize";
13+
import { waitForSeconds } from "../../../src/common/util/wait";
14+
import "../../../src/components/ha-alert";
15+
import "../../../src/components/ha-ansi-to-html";
16+
import type { HaAnsiToHtml } from "../../../src/components/ha-ansi-to-html";
1217
import "../../../src/components/ha-button";
1318
import "../../../src/components/ha-icon-button";
1419
import "../../../src/components/ha-svg-icon";
15-
import "../../../src/components/ha-ansi-to-html";
16-
import "../../../src/components/ha-alert";
17-
import type { HaAnsiToHtml } from "../../../src/components/ha-ansi-to-html";
20+
import { fileDownload } from "../../../src/util/file_download";
1821
import {
1922
getObserverLogs,
2023
downloadUrl as observerLogsDownloadUrl,
2124
} from "../data/observer";
22-
import { fireEvent } from "../../../src/common/dom/fire_event";
23-
import { fileDownload } from "../../../src/util/file_download";
2425
import { getSupervisorLogs, getSupervisorLogsFollow } from "../data/supervisor";
25-
import { waitForSeconds } from "../../../src/common/util/wait";
2626
import { ASSUME_CORE_START_SECONDS } from "../ha-landing-page";
2727

2828
const ERROR_CHECK = /^[\d\s-:]+(ERROR|CRITICAL)(.*)/gm;
@@ -108,6 +108,8 @@ class LandingPageLogs extends LitElement {
108108
!this._scrolledToBottomController.value) ||
109109
false,
110110
})}"
111+
size="small"
112+
appearance="filled"
111113
@click=${this._scrollToBottom}
112114
>
113115
<ha-svg-icon .path=${mdiArrowCollapseDown} slot="start"></ha-svg-icon>
@@ -309,21 +311,14 @@ class LandingPageLogs extends LitElement {
309311
}
310312
311313
.new-logs-indicator {
312-
--mdc-theme-primary: var(--text-primary-color);
313-
314314
overflow: hidden;
315315
position: absolute;
316-
bottom: 0;
317-
left: 0;
318-
right: 0;
316+
bottom: 4px;
317+
left: 4px;
319318
height: 0;
320-
background-color: var(--primary-color);
321-
border-radius: 8px;
322319
323320
transition: height 0.4s ease-out;
324321
display: flex;
325-
justify-content: space-between;
326-
align-items: center;
327322
}
328323
329324
.new-logs-indicator.visible {

src/panels/config/logs/error-log-card.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ class ErrorLogCard extends LitElement {
825825
overflow: hidden;
826826
position: absolute;
827827
bottom: 4px;
828+
left: 4px;
828829
height: 0;
829830
transition: height 0.4s ease-out;
830831
}

src/panels/config/logs/ha-config-logs.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,21 @@ export class HaConfigLogs extends LitElement {
250250
.content {
251251
direction: ltr;
252252
}
253+
@media all and (max-width: 870px) {
254+
ha-button-menu {
255+
max-width: 50%;
256+
}
257+
ha-button {
258+
max-width: 100%;
259+
}
260+
ha-button::part(label) {
261+
overflow: hidden;
262+
white-space: nowrap;
263+
}
264+
}
265+
ha-list-item[selected] {
266+
color: var(--primary-color);
267+
}
253268
`,
254269
];
255270
}

src/panels/config/network/supervisor-network.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,16 +260,16 @@ export class HassioNetwork extends LitElement {
260260
: nothing}
261261
</div>
262262
<div class="card-actions">
263-
<ha-button appearance="plain" @click=${this._clear}>
264-
${this.hass.localize("ui.panel.config.network.supervisor.reset")}
265-
</ha-button>
266263
<ha-button
267264
.loading=${this._processing}
268265
@click=${this._updateNetwork}
269266
.disabled=${!this._dirty}
270267
>
271268
${this.hass.localize("ui.common.save")}
272269
</ha-button>
270+
<ha-button variant="danger" appearance="plain" @click=${this._clear}>
271+
${this.hass.localize("ui.panel.config.network.supervisor.reset")}
272+
</ha-button>
273273
</div>`;
274274
}
275275

src/panels/lovelace/entity-rows/hui-scene-entity-row.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class HuiSceneEntityRow extends LitElement implements LovelaceRow {
4747
return html`
4848
<hui-generic-entity-row .hass=${this.hass} .config=${this._config}>
4949
<ha-button
50-
appearance="filled"
50+
appearance="plain"
5151
size="small"
5252
@click=${this._callService}
5353
.disabled=${stateObj.state === UNAVAILABLE}

src/panels/lovelace/entity-rows/hui-script-entity-row.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ class HuiScriptEntityRow extends LitElement implements LovelaceRow {
4949
<hui-generic-entity-row .hass=${this.hass} .config=${this._config}>
5050
${stateObj.state === "on"
5151
? html`<ha-button
52-
appearance="filled"
52+
appearance="plain"
5353
size="small"
54+
variant="danger"
5455
@click=${this._cancelScript}
5556
>
5657
${stateObj.attributes.mode !== "single" &&
@@ -61,10 +62,10 @@ class HuiScriptEntityRow extends LitElement implements LovelaceRow {
6162
})
6263
: this.hass.localize("ui.card.script.cancel")}
6364
</ha-button>`
64-
: ""}
65+
: nothing}
6566
${stateObj.state === "off" || stateObj.attributes.max
6667
? html`<ha-button
67-
appearance="filled"
68+
appearance="plain"
6869
size="small"
6970
@click=${this._runScript}
7071
.disabled=${isUnavailableState(stateObj.state) ||
@@ -73,7 +74,7 @@ class HuiScriptEntityRow extends LitElement implements LovelaceRow {
7374
${this._config.action_name ||
7475
this.hass!.localize("ui.card.script.run")}
7576
</ha-button>`
76-
: ""}
77+
: nothing}
7778
</hui-generic-entity-row>
7879
`;
7980
}

0 commit comments

Comments
 (0)