From 922c58944a97f05d51f925c670c47f327d0b55f5 Mon Sep 17 00:00:00 2001 From: Ludeeus Date: Tue, 13 Oct 2020 11:09:46 +0000 Subject: [PATCH 1/6] Add dialog and links for unsupported supervisor installation --- hassio/src/system/hassio-supervisor-info.ts | 70 +++++++++++++++++---- src/data/hassio/resolution.ts | 15 +++++ 2 files changed, 73 insertions(+), 12 deletions(-) create mode 100644 src/data/hassio/resolution.ts diff --git a/hassio/src/system/hassio-supervisor-info.ts b/hassio/src/system/hassio-supervisor-info.ts index d53597699c6c..28893734a2f6 100644 --- a/hassio/src/system/hassio-supervisor-info.ts +++ b/hassio/src/system/hassio-supervisor-info.ts @@ -11,14 +11,16 @@ import "../../../src/components/buttons/ha-progress-button"; import "../../../src/components/ha-card"; import "../../../src/components/ha-settings-row"; import "../../../src/components/ha-switch"; +import { extractApiErrorMessage } from "../../../src/data/hassio/common"; import { HassioHostInfo as HassioHostInfoType } from "../../../src/data/hassio/host"; +import { fetchHassioResolution } from "../../../src/data/hassio/resolution"; import { + fetchHassioSupervisorInfo, HassioSupervisorInfo as HassioSupervisorInfoType, reloadSupervisor, setSupervisorOption, SupervisorOptions, updateSupervisor, - fetchHassioSupervisorInfo, } from "../../../src/data/hassio/supervisor"; import { showAlertDialog, @@ -26,8 +28,35 @@ import { } from "../../../src/dialogs/generic/show-dialog-box"; import { haStyle } from "../../../src/resources/styles"; import { HomeAssistant } from "../../../src/types"; +import { documentationUrl } from "../../../src/util/documentation-url"; import { hassioStyle } from "../resources/hassio-style"; -import { extractApiErrorMessage } from "../../../src/data/hassio/common"; + +const ISSUES = { + container: { + title: "Containers known to cause issues", + url: "/more-info/unsupported-container", + }, + dbus: { title: "DBUS", url: "/more-info/unsupported-dbus" }, + docker_configuration: { + title: "Docker Configuration", + url: "/more-info/unsupported-docker_configuration", + }, + docker_version: { + title: "Docker Version", + url: "/more-info/unsupported-docker_version", + }, + lxc: { title: "LXC", url: "/more-info/unsupported-lxc" }, + network_manager: { + title: "Network Manager", + url: "/more-info/unsupported-network_manager", + }, + os: { title: "Operating System", url: "/more-info/unsupported-os" }, + privileged: { + title: "Supervisor is not privileged", + url: "/more-info/unsupported-privileged", + }, + systemd: { title: "Systemd", url: "/more-info/unsupported-systemd" }, +}; @customElement("hassio-supervisor-info") class HassioSupervisorInfo extends LitElement { @@ -118,18 +147,13 @@ class HassioSupervisorInfo extends LitElement { ` : html`
You are running an unsupported installation. - - Learn More - + Learn more +
`}
@@ -249,6 +273,28 @@ class HassioSupervisorInfo extends LitElement { }); } + private async _unsupportedDialog(): Promise { + const resolution = await fetchHassioResolution(this.hass); + await showAlertDialog(this, { + title: "You are running an unsupported installation", + text: html`Below is a list of issues found with your installation, click + on the links to learn how you can resolve the issues.

+ ${resolution.unsupported.map( + (issue) => html` +
  • + + ${ISSUES[issue].title} + +
  • + ` + )}`, + }); + } + private async _toggleDiagnostics(): Promise { try { const data: SupervisorOptions = { diff --git a/src/data/hassio/resolution.ts b/src/data/hassio/resolution.ts new file mode 100644 index 000000000000..9b58cd1deded --- /dev/null +++ b/src/data/hassio/resolution.ts @@ -0,0 +1,15 @@ +import { HomeAssistant } from "../../types"; +import { hassioApiResultExtractor, HassioResponse } from "./common"; + +export interface HassioResolution { + unsupported: string[]; +} + +export const fetchHassioResolution = async (hass: HomeAssistant) => { + return hassioApiResultExtractor( + await hass.callApi>( + "GET", + "hassio/resolution" + ) + ); +}; From 87f6513db98fb13f1c3ee95eae3b28c80f7f0e7c Mon Sep 17 00:00:00 2001 From: Ludeeus Date: Tue, 13 Oct 2020 11:21:28 +0000 Subject: [PATCH 2/6] Update URLs --- hassio/src/system/hassio-supervisor-info.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hassio/src/system/hassio-supervisor-info.ts b/hassio/src/system/hassio-supervisor-info.ts index 28893734a2f6..3ab5f264ca47 100644 --- a/hassio/src/system/hassio-supervisor-info.ts +++ b/hassio/src/system/hassio-supervisor-info.ts @@ -34,28 +34,28 @@ import { hassioStyle } from "../resources/hassio-style"; const ISSUES = { container: { title: "Containers known to cause issues", - url: "/more-info/unsupported-container", + url: "/more-info/unsupported/container", }, - dbus: { title: "DBUS", url: "/more-info/unsupported-dbus" }, + dbus: { title: "DBUS", url: "/more-info/unsupported/dbus" }, docker_configuration: { title: "Docker Configuration", - url: "/more-info/unsupported-docker_configuration", + url: "/more-info/unsupported/docker_configuration", }, docker_version: { title: "Docker Version", - url: "/more-info/unsupported-docker_version", + url: "/more-info/unsupported/docker_version", }, - lxc: { title: "LXC", url: "/more-info/unsupported-lxc" }, + lxc: { title: "LXC", url: "/more-info/unsupported/lxc" }, network_manager: { title: "Network Manager", - url: "/more-info/unsupported-network_manager", + url: "/more-info/unsupported/network_manager", }, - os: { title: "Operating System", url: "/more-info/unsupported-os" }, + os: { title: "Operating System", url: "/more-info/unsupported/os" }, privileged: { title: "Supervisor is not privileged", - url: "/more-info/unsupported-privileged", + url: "/more-info/unsupported/privileged", }, - systemd: { title: "Systemd", url: "/more-info/unsupported-systemd" }, + systemd: { title: "Systemd", url: "/more-info/unsupported/systemd" }, }; @customElement("hassio-supervisor-info") From 3bf1d20f08782537f01d941aa16a45fb36562337 Mon Sep 17 00:00:00 2001 From: Ludeeus Date: Fri, 16 Oct 2020 11:00:07 +0000 Subject: [PATCH 3/6] Address review comments --- hassio/src/system/hassio-supervisor-info.ts | 30 ++++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/hassio/src/system/hassio-supervisor-info.ts b/hassio/src/system/hassio-supervisor-info.ts index 3ab5f264ca47..0277248497d3 100644 --- a/hassio/src/system/hassio-supervisor-info.ts +++ b/hassio/src/system/hassio-supervisor-info.ts @@ -279,19 +279,23 @@ class HassioSupervisorInfo extends LitElement { title: "You are running an unsupported installation", text: html`Below is a list of issues found with your installation, click on the links to learn how you can resolve the issues.

    - ${resolution.unsupported.map( - (issue) => html` -
  • - - ${ISSUES[issue].title} - -
  • - ` - )}`, + ${resolution.unsupported + .filter((issue) => issue in ISSUES) + .map( + (issue) => html` + + ` + )}`, }); } From 23ffb6367b401976667794af7c610c7245090742 Mon Sep 17 00:00:00 2001 From: Ludeeus Date: Fri, 16 Oct 2020 11:02:39 +0000 Subject: [PATCH 4/6] Change to /info endpoint --- src/data/hassio/resolution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/hassio/resolution.ts b/src/data/hassio/resolution.ts index 9b58cd1deded..8f85943de330 100644 --- a/src/data/hassio/resolution.ts +++ b/src/data/hassio/resolution.ts @@ -9,7 +9,7 @@ export const fetchHassioResolution = async (hass: HomeAssistant) => { return hassioApiResultExtractor( await hass.callApi>( "GET", - "hassio/resolution" + "hassio/resolution/info" ) ); }; From 21d2915df425227d228e3e4ea3ee887c2d8baca9 Mon Sep 17 00:00:00 2001 From: Ludeeus Date: Fri, 16 Oct 2020 11:48:40 +0000 Subject: [PATCH 5/6] Move ul --- hassio/src/system/hassio-supervisor-info.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hassio/src/system/hassio-supervisor-info.ts b/hassio/src/system/hassio-supervisor-info.ts index 0277248497d3..f59615a4012b 100644 --- a/hassio/src/system/hassio-supervisor-info.ts +++ b/hassio/src/system/hassio-supervisor-info.ts @@ -279,11 +279,11 @@ class HassioSupervisorInfo extends LitElement { title: "You are running an unsupported installation", text: html`Below is a list of issues found with your installation, click on the links to learn how you can resolve the issues.

    - ${resolution.unsupported - .filter((issue) => issue in ISSUES) - .map( - (issue) => html` - `, }); } From 2422969b3c3fd904d90363e8ea654f174bd6811d Mon Sep 17 00:00:00 2001 From: Ludeeus Date: Fri, 16 Oct 2020 15:37:20 +0000 Subject: [PATCH 6/6] Don't filter --- hassio/src/system/hassio-supervisor-info.ts | 30 ++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/hassio/src/system/hassio-supervisor-info.ts b/hassio/src/system/hassio-supervisor-info.ts index f59615a4012b..ad9fb4e41738 100644 --- a/hassio/src/system/hassio-supervisor-info.ts +++ b/hassio/src/system/hassio-supervisor-info.ts @@ -280,21 +280,21 @@ class HassioSupervisorInfo extends LitElement { text: html`Below is a list of issues found with your installation, click on the links to learn how you can resolve the issues.

    `, }); }