diff --git a/hassio/src/system/hassio-supervisor-info.ts b/hassio/src/system/hassio-supervisor-info.ts
index 1843cb4058..7423da51a8 100644
--- a/hassio/src/system/hassio-supervisor-info.ts
+++ b/hassio/src/system/hassio-supervisor-info.ts
@@ -17,7 +17,12 @@ import {
setSupervisorOption,
SupervisorOptions,
} from "../../../src/data/hassio/supervisor";
-import { showConfirmationDialog } from "../../../src/dialogs/generic/show-dialog-box";
+import "../../../src/components/ha-switch";
+import {
+ showConfirmationDialog,
+ showAlertDialog,
+} from "../../../src/dialogs/generic/show-dialog-box";
+import "../../../src/components/ha-settings-row";
import { haStyle } from "../../../src/resources/styles";
import { HomeAssistant } from "../../../src/types";
import { hassioStyle } from "../resources/hassio-style";
@@ -55,6 +60,26 @@ class HassioSupervisorInfo extends LitElement {
: ""}
+
+
+
+ Share Diagnostics
+
+
+ Share crash reports and diagnostic information.
+
+
+
+
+
${this._errors
? html` Error: ${this._errors}
`
: ""}
@@ -111,7 +136,8 @@ class HassioSupervisorInfo extends LitElement {
box-sizing: border-box;
height: calc(100% - 47px);
}
- .info {
+ .info,
+ .options {
width: 100%;
}
.info td:nth-child(2) {
@@ -121,6 +147,12 @@ class HassioSupervisorInfo extends LitElement {
color: var(--error-color);
margin-top: 16px;
}
+ ha-settings-row {
+ padding: 0;
+ }
+ button.link {
+ color: var(--primary-color);
+ }
`,
];
}
@@ -181,6 +213,40 @@ class HassioSupervisorInfo extends LitElement {
this._errors = `Error joining beta channel, ${err.body?.message || err}`;
}
}
+
+ private async _diagnosticsInformationDialog() {
+ await showAlertDialog(this, {
+ title: "Help Improve Home Assistant",
+ text: html`Would you want to automatically share crash reports and
+ diagnostic information when the supervisor encounters unexpected errors?
+
+ This will allow us to fix the problems, the information is only
+ accessible to the Home Assistant Core team and will not be shared with
+ others.
+
+ The data does not include any private/sensetive information and you can
+ disable this in settings at any time you want.`,
+ });
+ }
+
+ private async _toggleDiagnostics() {
+ try {
+ const data: SupervisorOptions = {
+ diagnostics: !this.supervisorInfo?.diagnostics,
+ };
+ await setSupervisorOption(this.hass, data);
+ const eventdata = {
+ success: true,
+ response: undefined,
+ path: "option",
+ };
+ fireEvent(this, "hass-api-called", eventdata);
+ } catch (err) {
+ this._errors = `Error changing supervisor setting, ${
+ err.body?.message || err
+ }`;
+ }
+ }
}
declare global {
diff --git a/src/components/ha-settings-row.ts b/src/components/ha-settings-row.ts
new file mode 100644
index 0000000000..43c886ab99
--- /dev/null
+++ b/src/components/ha-settings-row.ts
@@ -0,0 +1,59 @@
+import {
+ css,
+ CSSResult,
+ customElement,
+ html,
+ LitElement,
+ property,
+ SVGTemplateResult,
+} from "lit-element";
+import "@polymer/paper-item/paper-item-body";
+
+@customElement("ha-settings-row")
+export class HaSettingsRow extends LitElement {
+ @property({ type: Boolean, reflect: true }) public narrow!: boolean;
+
+ @property({ type: Boolean, attribute: "three-line" })
+ public threeLine = false;
+
+ protected render(): SVGTemplateResult {
+ return html`
+
+
+
+
+
+
+ `;
+ }
+
+ static get styles(): CSSResult {
+ return css`
+ :host {
+ display: flex;
+ padding: 0 16px;
+ align-content: normal;
+ align-self: auto;
+ align-items: center;
+ }
+ :host([narrow]) {
+ align-items: normal;
+ flex-direction: column;
+ border-top: 1px solid var(--divider-color);
+ padding-bottom: 8px;
+ }
+ `;
+ }
+}
+declare global {
+ interface HTMLElementTagNameMap {
+ "ha-settings-row": HaSettingsRow;
+ }
+}
diff --git a/src/data/hassio/supervisor.ts b/src/data/hassio/supervisor.ts
index e32e13ad2f..51454ad610 100644
--- a/src/data/hassio/supervisor.ts
+++ b/src/data/hassio/supervisor.ts
@@ -31,6 +31,7 @@ export interface CreateSessionResponse {
export interface SupervisorOptions {
channel?: "beta" | "dev" | "stable";
+ diagnostics?: boolean;
addons_repositories?: string[];
}
diff --git a/src/panels/profile/ha-advanced-mode-row.ts b/src/panels/profile/ha-advanced-mode-row.ts
index a7e40b16cf..4cd23aa8df 100644
--- a/src/panels/profile/ha-advanced-mode-row.ts
+++ b/src/panels/profile/ha-advanced-mode-row.ts
@@ -14,7 +14,7 @@ import {
getOptimisticFrontendUserDataCollection,
} from "../../data/frontend";
import { HomeAssistant } from "../../types";
-import "./ha-settings-row";
+import "../../components/ha-settings-row";
@customElement("ha-advanced-mode-row")
class AdvancedModeRow extends LitElement {
diff --git a/src/panels/profile/ha-force-narrow-row.ts b/src/panels/profile/ha-force-narrow-row.ts
index edf8c5e19c..a11616ab36 100644
--- a/src/panels/profile/ha-force-narrow-row.ts
+++ b/src/panels/profile/ha-force-narrow-row.ts
@@ -9,7 +9,7 @@ import { fireEvent } from "../../common/dom/fire_event";
import "../../components/ha-switch";
import type { HaSwitch } from "../../components/ha-switch";
import type { HomeAssistant } from "../../types";
-import "./ha-settings-row";
+import "../../components/ha-settings-row";
@customElement("ha-force-narrow-row")
class HaForcedNarrowRow extends LitElement {
diff --git a/src/panels/profile/ha-long-lived-access-tokens-card.js b/src/panels/profile/ha-long-lived-access-tokens-card.js
index 4b9697de48..5943164610 100644
--- a/src/panels/profile/ha-long-lived-access-tokens-card.js
+++ b/src/panels/profile/ha-long-lived-access-tokens-card.js
@@ -13,7 +13,7 @@ import {
import { EventsMixin } from "../../mixins/events-mixin";
import LocalizeMixin from "../../mixins/localize-mixin";
import "../../styles/polymer-ha-style";
-import "./ha-settings-row";
+import "../../components/ha-settings-row";
/*
* @appliesMixin EventsMixin
diff --git a/src/panels/profile/ha-pick-dashboard-row.ts b/src/panels/profile/ha-pick-dashboard-row.ts
index 33fde87943..c8e9765b56 100644
--- a/src/panels/profile/ha-pick-dashboard-row.ts
+++ b/src/panels/profile/ha-pick-dashboard-row.ts
@@ -13,7 +13,7 @@ import "../../components/ha-paper-dropdown-menu";
import { fetchDashboards, LovelaceDashboard } from "../../data/lovelace";
import { setDefaultPanel } from "../../data/panel";
import { HomeAssistant } from "../../types";
-import "./ha-settings-row";
+import "../../components/ha-settings-row";
@customElement("ha-pick-dashboard-row")
class HaPickDashboardRow extends LitElement {
diff --git a/src/panels/profile/ha-pick-language-row.js b/src/panels/profile/ha-pick-language-row.js
index 8ec1ccd6ad..59019e027a 100644
--- a/src/panels/profile/ha-pick-language-row.js
+++ b/src/panels/profile/ha-pick-language-row.js
@@ -6,7 +6,7 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
import "../../components/ha-paper-dropdown-menu";
import { EventsMixin } from "../../mixins/events-mixin";
import LocalizeMixin from "../../mixins/localize-mixin";
-import "./ha-settings-row";
+import "../../components/ha-settings-row";
/*
* @appliesMixin LocalizeMixin
diff --git a/src/panels/profile/ha-pick-theme-row.ts b/src/panels/profile/ha-pick-theme-row.ts
index 84d5dd4992..f78b827553 100644
--- a/src/panels/profile/ha-pick-theme-row.ts
+++ b/src/panels/profile/ha-pick-theme-row.ts
@@ -12,7 +12,7 @@ import {
css,
} from "lit-element";
import { HomeAssistant } from "../../types";
-import "./ha-settings-row";
+import "../../components/ha-settings-row";
import { fireEvent } from "../../common/dom/fire_event";
import "../../components/ha-formfield";
import "../../components/ha-radio";
diff --git a/src/panels/profile/ha-push-notifications-row.js b/src/panels/profile/ha-push-notifications-row.js
index ee2019a5b4..7f0bbc0af0 100644
--- a/src/panels/profile/ha-push-notifications-row.js
+++ b/src/panels/profile/ha-push-notifications-row.js
@@ -6,7 +6,7 @@ import { PolymerElement } from "@polymer/polymer/polymer-element";
import { isComponentLoaded } from "../../common/config/is_component_loaded";
import { pushSupported } from "../../components/ha-push-notifications-toggle";
import LocalizeMixin from "../../mixins/localize-mixin";
-import "./ha-settings-row";
+import "../../components/ha-settings-row";
/*
* @appliesMixin LocalizeMixin
diff --git a/src/panels/profile/ha-refresh-tokens-card.js b/src/panels/profile/ha-refresh-tokens-card.js
index 81f83b41c5..e4f7e4f58c 100644
--- a/src/panels/profile/ha-refresh-tokens-card.js
+++ b/src/panels/profile/ha-refresh-tokens-card.js
@@ -11,7 +11,7 @@ import {
showAlertDialog,
showConfirmationDialog,
} from "../../dialogs/generic/show-dialog-box";
-import "./ha-settings-row";
+import "../../components/ha-settings-row";
/*
* @appliesMixin EventsMixin
diff --git a/src/panels/profile/ha-set-suspend-row.ts b/src/panels/profile/ha-set-suspend-row.ts
index a2ead43255..f734c7c0c7 100644
--- a/src/panels/profile/ha-set-suspend-row.ts
+++ b/src/panels/profile/ha-set-suspend-row.ts
@@ -9,7 +9,7 @@ import { fireEvent, HASSDomEvent } from "../../common/dom/fire_event";
import "../../components/ha-switch";
import type { HaSwitch } from "../../components/ha-switch";
import type { HomeAssistant } from "../../types";
-import "./ha-settings-row";
+import "../../components/ha-settings-row";
declare global {
// for fire event
diff --git a/src/panels/profile/ha-set-vibrate-row.ts b/src/panels/profile/ha-set-vibrate-row.ts
index e232c510ae..e5ae63ad88 100644
--- a/src/panels/profile/ha-set-vibrate-row.ts
+++ b/src/panels/profile/ha-set-vibrate-row.ts
@@ -10,7 +10,7 @@ import "../../components/ha-switch";
import type { HaSwitch } from "../../components/ha-switch";
import { forwardHaptic } from "../../data/haptics";
import type { HomeAssistant } from "../../types";
-import "./ha-settings-row";
+import "../../components/ha-settings-row";
@customElement("ha-set-vibrate-row")
class HaSetVibrateRow extends LitElement {
diff --git a/src/panels/profile/ha-settings-row.js b/src/panels/profile/ha-settings-row.js
deleted file mode 100644
index 15ddb6c917..0000000000
--- a/src/panels/profile/ha-settings-row.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import { html } from "@polymer/polymer/lib/utils/html-tag";
-/* eslint-plugin-disable lit */
-import { PolymerElement } from "@polymer/polymer/polymer-element";
-
-class HaSettingsRow extends PolymerElement {
- static get template() {
- return html`
-
-
-
-
-
-
- `;
- }
-
- static get properties() {
- return {
- narrow: {
- type: Boolean,
- reflectToAttribute: true,
- },
- threeLine: {
- type: Boolean,
- value: false,
- },
- };
- }
-}
-
-customElements.define("ha-settings-row", HaSettingsRow);