diff --git a/hassio/src/system/hassio-supervisor-info.ts b/hassio/src/system/hassio-supervisor-info.ts index 4aaf394d5e..74585bbec2 100644 --- a/hassio/src/system/hassio-supervisor-info.ts +++ b/hassio/src/system/hassio-supervisor-info.ts @@ -39,6 +39,7 @@ import "../components/supervisor-metric"; import { hassioStyle } from "../resources/hassio-style"; const UNSUPPORTED_REASON_URL = { + apparmor: "/more-info/unsupported/apparmor", container: "/more-info/unsupported/container", dbus: "/more-info/unsupported/dbus", docker_configuration: "/more-info/unsupported/docker_configuration", diff --git a/setup.py b/setup.py index 25742ee198..f06a4c5c9a 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="home-assistant-frontend", - version="20210406.0", + version="20210407.0", description="The Home Assistant frontend", url="https://github.com/home-assistant/home-assistant-polymer", author="The Home Assistant Authors", diff --git a/src/components/ha-analytics-learn-more.ts b/src/components/ha-analytics-learn-more.ts new file mode 100644 index 0000000000..8b7c756efa --- /dev/null +++ b/src/components/ha-analytics-learn-more.ts @@ -0,0 +1,10 @@ +import { html } from "lit-element"; +import { HomeAssistant } from "../types"; +import { documentationUrl } from "../util/documentation-url"; + +export const analyticsLearnMore = (hass: HomeAssistant) => html`${hass.localize("ui.panel.config.core.section.core.analytics.learn_more")}`; diff --git a/src/components/ha-analytics.ts b/src/components/ha-analytics.ts index bbc4682e27..6cf9d37b07 100644 --- a/src/components/ha-analytics.ts +++ b/src/components/ha-analytics.ts @@ -13,7 +13,6 @@ import { fireEvent } from "../common/dom/fire_event"; import { Analytics, AnalyticsPreferences } from "../data/analytics"; import { haStyle } from "../resources/styles"; import { HomeAssistant } from "../types"; -import { documentationUrl } from "../util/documentation-url"; import "./ha-checkbox"; import type { HaCheckbox } from "./ha-checkbox"; import "./ha-settings-row"; @@ -30,38 +29,30 @@ declare global { export class HaAnalytics extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property({ attribute: false }) public analytics!: Analytics; + @property({ attribute: false }) public analytics?: Analytics; protected render(): TemplateResult { - if (!this.analytics.huuid) { - return html``; - } - - const enabled = this.analytics.preferences.base; + const loading = this.analytics === undefined; + const baseEnabled = !loading && this.analytics!.preferences.base; return html` -
- ${this.hass.localize( - "ui.panel.config.core.section.core.analytics.instance_id", - "huuid", - this.analytics.huuid - )} -
- - ${this.hass.localize( - "ui.panel.config.core.section.core.analytics.learn_more" - )} - -
`; } + protected updated(changedProps) { + super.updated(changedProps); + + this.shadowRoot!.querySelectorAll("*[data-for]").forEach((el) => { + const forEl = (el as HTMLElement).dataset.for; + delete (el as HTMLElement).dataset.for; + + el.addEventListener("click", () => { + const toFocus = this.shadowRoot!.querySelector( + `*[name=${forEl}]` + ) as HTMLElement | null; + + if (toFocus) { + toFocus.focus(); + toFocus.click(); + } + }); + }); + } + private _handleRowCheckboxClick(ev: Event) { const checkbox = ev.currentTarget as HaCheckbox; const preference = (checkbox as any).preference; - const preferences = { ...this.analytics.preferences }; + const preferences = this.analytics ? { ...this.analytics.preferences } : {}; - if (checkbox.checked) { - if (preferences[preference]) { - return; - } - preferences[preference] = true; - } else { - preferences[preference] = false; + if (preferences[preference] === checkbox.checked) { + return; + } + + preferences[preference] = checkbox.checked; + + if (ADDITIONAL_PREFERENCES.includes(preference) && checkbox.checked) { + preferences.base = true; + } else if (preference === "base" && !checkbox.checked) { + preferences.usage = false; + preferences.statistics = false; } fireEvent(this, "analytics-preferences-changed", { preferences }); @@ -176,6 +182,11 @@ export class HaAnalytics extends LitElement { ha-settings-row { padding: 0; } + + span[slot="heading"], + span[slot="description"] { + cursor: pointer; + } `, ]; } diff --git a/src/components/trace/hat-graph-node.ts b/src/components/trace/hat-graph-node.ts index c9d6b8296f..ae0b59aa87 100644 --- a/src/components/trace/hat-graph-node.ts +++ b/src/components/trace/hat-graph-node.ts @@ -10,8 +10,6 @@ export class HatGraphNode extends LitElement { @property({ reflect: true, type: Boolean }) graphstart?: boolean; - @property({ reflect: true, type: Boolean }) spacer?: boolean; - @property({ reflect: true, type: Boolean }) nofocus?: boolean; @property({ reflect: true, type: Number }) badge?: number; @@ -22,34 +20,18 @@ export class HatGraphNode extends LitElement { this.setAttribute("tabindex", "0"); } - updated() { - const svgEl = this.shadowRoot?.querySelector("svg"); - if (!svgEl) { - return; - } - if (this.spacer) { - svgEl.setAttribute("width", "10px"); - svgEl.setAttribute("height", "41px"); - svgEl.setAttribute("viewBox", "-5 -40 10 26"); - return; - } - const bbox = svgEl.getBBox(); - const extra_height = this.graphstart ? 2 : 1; - const extra_width = SPACING; - svgEl.setAttribute("width", `${bbox.width + extra_width}px`); - svgEl.setAttribute("height", `${bbox.height + extra_height}px`); - svgEl.setAttribute( - "viewBox", - `${Math.ceil(bbox.x - extra_width / 2)} - ${Math.ceil(bbox.y - extra_height / 2)} - ${bbox.width + extra_width} - ${bbox.height + extra_height}` - ); - } - render() { + const height = NODE_SIZE + (this.graphstart ? 2 : SPACING + 1); + const width = SPACING + NODE_SIZE; return svg`