Small edits on config menu (#12440)

This commit is contained in:
Zack Barett 2022-04-26 23:07:53 -05:00 committed by GitHub
parent 8da73d49d7
commit 28f5611df5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 81 additions and 77 deletions

View File

@ -56,6 +56,9 @@ class HaNavigationList extends LitElement {
} }
static styles: CSSResultGroup = css` static styles: CSSResultGroup = css`
:host {
--mdc-list-vertical-padding: 0;
}
a { a {
text-decoration: none; text-decoration: none;
color: var(--primary-text-color); color: var(--primary-text-color);

View File

@ -262,7 +262,7 @@ class HaConfigSectionUpdates extends LitElement {
margin: 0 auto; margin: 0 auto;
} }
ha-card { ha-card {
max-width: 500px; max-width: 600px;
margin: 0 auto; margin: 0 auto;
height: 100%; height: 100%;
justify-content: space-between; justify-content: space-between;
@ -272,7 +272,6 @@ class HaConfigSectionUpdates extends LitElement {
} }
.card-actions { .card-actions {
height: 48px; height: 48px;
border-top: none;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
@ -282,7 +281,7 @@ class HaConfigSectionUpdates extends LitElement {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-direction: column; flex-direction: column;
padding: 16px 16px 0 16px; padding: 16px;
} }
`; `;
} }

View File

@ -64,9 +64,6 @@ class HaConfigSystemNavigation extends LitElement {
return [ return [
haStyle, haStyle,
css` css`
ha-card {
margin-bottom: env(safe-area-inset-bottom);
}
:host(:not([narrow])) ha-card { :host(:not([narrow])) ha-card {
margin-bottom: max(24px, env(safe-area-inset-bottom)); margin-bottom: max(24px, env(safe-area-inset-bottom));
} }
@ -79,6 +76,8 @@ class HaConfigSystemNavigation extends LitElement {
ha-card { ha-card {
overflow: hidden; overflow: hidden;
margin-bottom: 24px;
margin-bottom: max(24px, env(safe-area-inset-bottom));
} }
ha-card a { ha-card a {

View File

@ -1,6 +1,6 @@
import "@material/mwc-button/mwc-button"; import "@material/mwc-button/mwc-button";
import "@polymer/paper-item/paper-icon-item"; import "@material/mwc-list/mwc-list";
import "@polymer/paper-item/paper-item-body"; import "@material/mwc-list/mwc-list-item";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { fireEvent } from "../../../common/dom/fire_event"; import { fireEvent } from "../../../common/dom/fire_event";
@ -8,7 +8,7 @@ import "../../../components/entity/state-badge";
import "../../../components/ha-alert"; import "../../../components/ha-alert";
import "../../../components/ha-icon-next"; import "../../../components/ha-icon-next";
import type { UpdateEntity } from "../../../data/update"; import type { UpdateEntity } from "../../../data/update";
import { HomeAssistant } from "../../../types"; import type { HomeAssistant } from "../../../types";
@customElement("ha-config-updates") @customElement("ha-config-updates")
class HaConfigUpdates extends LitElement { class HaConfigUpdates extends LitElement {
@ -35,39 +35,44 @@ class HaConfigUpdates extends LitElement {
count: this.total || this.updateEntities.length, count: this.total || this.updateEntities.length,
})} })}
</div> </div>
${updates.map( <mwc-list>
(entity) => html` ${updates.map(
<paper-icon-item (entity) => html`
@click=${this._openMoreInfo} <mwc-list-item
.entity_id=${entity.entity_id} twoline
class=${entity.attributes.skipped_version ? "skipped" : ""} graphic="avatar"
> class=${entity.attributes.skipped_version ? "skipped" : ""}
<span slot="item-icon" class="icon"> .entity_id=${entity.entity_id}
.hasMeta=${!this.narrow}
@click=${this._openMoreInfo}
>
<state-badge <state-badge
slot="graphic"
.title=${entity.attributes.title || .title=${entity.attributes.title ||
entity.attributes.friendly_name} entity.attributes.friendly_name}
.stateObj=${entity} .stateObj=${entity}
slot="item-icon"
></state-badge> ></state-badge>
</span> <span
<paper-item-body two-line> >${entity.attributes.title ||
${entity.attributes.title || entity.attributes.friendly_name} entity.attributes.friendly_name}</span
<div secondary> >
<span slot="secondary">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.updates.version_available", "ui.panel.config.updates.version_available",
{ {
version_available: entity.attributes.latest_version, version_available: entity.attributes.latest_version,
} }
)} )}${entity.attributes.skipped_version
${entity.attributes.skipped_version
? `(${this.hass.localize("ui.panel.config.updates.skipped")})` ? `(${this.hass.localize("ui.panel.config.updates.skipped")})`
: ""} : ""}
</div> </span>
</paper-item-body> ${!this.narrow
${!this.narrow ? html`<ha-icon-next></ha-icon-next>` : ""} ? html`<ha-icon-next slot="meta"></ha-icon-next>`
</paper-icon-item> : ""}
` </mwc-list-item>
)} `
)}
</mwc-list>
`; `;
} }
@ -80,6 +85,9 @@ class HaConfigUpdates extends LitElement {
static get styles(): CSSResultGroup[] { static get styles(): CSSResultGroup[] {
return [ return [
css` css`
:host {
--mdc-list-vertical-padding: 0;
}
.title { .title {
font-size: 16px; font-size: 16px;
padding: 16px; padding: 16px;
@ -88,11 +96,6 @@ class HaConfigUpdates extends LitElement {
.skipped { .skipped {
background: var(--secondary-background-color); background: var(--secondary-background-color);
} }
.icon {
display: inline-flex;
height: 100%;
align-items: center;
}
ha-icon-next { ha-icon-next {
color: var(--secondary-text-color); color: var(--secondary-text-color);
height: 24px; height: 24px;
@ -114,8 +117,9 @@ class HaConfigUpdates extends LitElement {
outline: none; outline: none;
text-decoration: underline; text-decoration: underline;
} }
paper-icon-item { mwc-list-item {
cursor: pointer; cursor: pointer;
font-size: 16px;
} }
`, `,
]; ];

View File

@ -218,7 +218,7 @@ class HaConfigHardware extends LitElement {
margin: 0 auto; margin: 0 auto;
} }
ha-card { ha-card {
max-width: 500px; max-width: 600px;
margin: 0 auto; margin: 0 auto;
height: 100%; height: 100%;
justify-content: space-between; justify-content: space-between;
@ -237,7 +237,6 @@ class HaConfigHardware extends LitElement {
} }
.card-actions { .card-actions {
height: 48px; height: 48px;
border-top: none;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;

View File

@ -28,6 +28,7 @@ class HaConfigSectionNetwork extends LitElement {
${isComponentLoaded(this.hass, "hassio") ${isComponentLoaded(this.hass, "hassio")
? html`<supervisor-hostname ? html`<supervisor-hostname
.hass=${this.hass} .hass=${this.hass}
.narrow=${this.narrow}
></supervisor-hostname> ></supervisor-hostname>
<supervisor-network .hass=${this.hass}></supervisor-network>` <supervisor-network .hass=${this.hass}></supervisor-network>`
: ""} : ""}

View File

@ -14,6 +14,7 @@ import "../../../components/ha-header-bar";
import "../../../components/ha-icon-button"; import "../../../components/ha-icon-button";
import "../../../components/ha-radio"; import "../../../components/ha-radio";
import "../../../components/ha-related-items"; import "../../../components/ha-related-items";
import "../../../components/ha-settings-row";
import "../../../components/ha-textfield"; import "../../../components/ha-textfield";
import { extractApiErrorMessage } from "../../../data/hassio/common"; import { extractApiErrorMessage } from "../../../data/hassio/common";
import { import {
@ -22,12 +23,13 @@ import {
} from "../../../data/hassio/host"; } from "../../../data/hassio/host";
import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box";
import type { HomeAssistant } from "../../../types"; import type { HomeAssistant } from "../../../types";
import "../../../components/ha-settings-row";
@customElement("supervisor-hostname") @customElement("supervisor-hostname")
export class HassioHostname extends LitElement { export class HassioHostname extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant; @property({ attribute: false }) public hass!: HomeAssistant;
@property({ type: Boolean }) narrow!: boolean;
@state() private _processing = false; @state() private _processing = false;
@state() private _hostname?: string; @state() private _hostname?: string;
@ -48,11 +50,12 @@ export class HassioHostname extends LitElement {
return html` return html`
<ha-card <ha-card
class="no-padding"
outlined outlined
.header=${this.hass.localize("ui.panel.config.network.hostname.title")} .header=${this.hass.localize("ui.panel.config.network.hostname.title")}
> >
<div class="card-content"> <div>
<ha-settings-row> <ha-settings-row .narrow=${this.narrow}>
<span slot="heading">Hostname</span> <span slot="heading">Hostname</span>
<span slot="description" <span slot="description"
>The name your instance will have on your network</span >The name your instance will have on your network</span
@ -98,21 +101,17 @@ export class HassioHostname extends LitElement {
} }
} }
static get styles(): CSSResultGroup { static styles: CSSResultGroup = css`
return [ ha-textfield {
css` width: 100%;
ha-textfield { }
width: 100%; .card-actions {
} display: flex;
.card-actions { flex-direction: row-reverse;
display: flex; justify-content: space-between;
flex-direction: row-reverse; align-items: center;
justify-content: space-between; }
align-items: center; `;
}
`,
];
}
} }
declare global { declare global {

View File

@ -1,3 +1,4 @@
import { mdiDotsVertical } from "@mdi/js";
import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; import { css, html, LitElement, PropertyValues, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { isComponentLoaded } from "../../../common/config/is_component_loaded";
@ -40,6 +41,22 @@ class HaConfigSectionStorage extends LitElement {
.narrow=${this.narrow} .narrow=${this.narrow}
.header=${this.hass.localize("ui.panel.config.storage.caption")} .header=${this.hass.localize("ui.panel.config.storage.caption")}
> >
${this._hostInfo
? html`
<ha-button-menu corner="BOTTOM_START" slot="toolbar-icon">
<ha-icon-button
slot="trigger"
.label=${this.hass.localize("ui.common.overflow")}
.path=${mdiDotsVertical}
></ha-icon-button>
<mwc-list-item @click=${this._moveDatadisk}>
${this.hass.localize(
"ui.panel.config.storage.datadisk.title"
)}
</mwc-list-item>
</ha-button-menu>
`
: ""}
<div class="content"> <div class="content">
${this._error ${this._error
? html` ? html`
@ -79,13 +96,6 @@ class HaConfigSectionStorage extends LitElement {
` `
: ""} : ""}
</div> </div>
<div class="card-actions">
<mwc-button @click=${this._moveDatadisk}>
${this.hass.localize(
"ui.panel.config.storage.datadisk.title"
)}
</mwc-button>
</div>
</ha-card> </ha-card>
` `
: ""} : ""}
@ -118,26 +128,16 @@ class HaConfigSectionStorage extends LitElement {
margin: 0 auto; margin: 0 auto;
} }
ha-card { ha-card {
max-width: 500px; max-width: 600px;
margin: 0 auto; margin: 0 auto;
height: 100%;
justify-content: space-between; justify-content: space-between;
flex-direction: column; flex-direction: column;
display: flex; display: flex;
} }
.card-actions {
height: 48px;
border-top: none;
display: flex;
justify-content: space-between;
align-items: center;
}
.card-content { .card-content {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-direction: column; flex-direction: column;
padding: 16px 16px 0 16px;
} }
`; `;
} }

View File

@ -452,7 +452,7 @@ class HaConfigSystemHealth extends SubscribeMixin(LitElement) {
} }
ha-card { ha-card {
display: block; display: block;
max-width: 500px; max-width: 600px;
margin: 0 auto; margin: 0 auto;
padding-bottom: 16px; padding-bottom: 16px;
margin-bottom: max(24px, env(safe-area-inset-bottom)); margin-bottom: max(24px, env(safe-area-inset-bottom));

View File

@ -3212,8 +3212,8 @@
}, },
"system_health": { "system_health": {
"caption": "System Health", "caption": "System Health",
"cpu_usage": "CPU Usage", "cpu_usage": "Process Usage",
"ram_usage": "RAM Usage", "ram_usage": "Memory Usage",
"core_stats": "Core Stats", "core_stats": "Core Stats",
"supervisor_stats": "Supervisor Stats" "supervisor_stats": "Supervisor Stats"
} }