mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Show the reason why an add-on is not available (#8312)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
5199e946a1
commit
e06642e892
@ -19,6 +19,7 @@ import {
|
|||||||
fetchHassioAddonInfo,
|
fetchHassioAddonInfo,
|
||||||
HassioAddonDetails,
|
HassioAddonDetails,
|
||||||
} from "../../../src/data/hassio/addon";
|
} from "../../../src/data/hassio/addon";
|
||||||
|
import { Supervisor } from "../../../src/data/supervisor/supervisor";
|
||||||
import "../../../src/layouts/hass-tabs-subpage";
|
import "../../../src/layouts/hass-tabs-subpage";
|
||||||
import type { PageNavigation } from "../../../src/layouts/hass-tabs-subpage";
|
import type { PageNavigation } from "../../../src/layouts/hass-tabs-subpage";
|
||||||
import { haStyle } from "../../../src/resources/styles";
|
import { haStyle } from "../../../src/resources/styles";
|
||||||
@ -35,6 +36,8 @@ import "./log/hassio-addon-logs";
|
|||||||
class HassioAddonDashboard extends LitElement {
|
class HassioAddonDashboard extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public supervisor!: Supervisor;
|
||||||
|
|
||||||
@property({ attribute: false }) public route!: Route;
|
@property({ attribute: false }) public route!: Route;
|
||||||
|
|
||||||
@property({ attribute: false }) public addon?: HassioAddonDetails;
|
@property({ attribute: false }) public addon?: HassioAddonDetails;
|
||||||
@ -106,6 +109,7 @@ class HassioAddonDashboard extends LitElement {
|
|||||||
.route=${route}
|
.route=${route}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.supervisor=${this.supervisor}
|
||||||
.addon=${this.addon}
|
.addon=${this.addon}
|
||||||
></hassio-addon-router>
|
></hassio-addon-router>
|
||||||
</hass-tabs-subpage>
|
</hass-tabs-subpage>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { customElement, property } from "lit-element";
|
import { customElement, property } from "lit-element";
|
||||||
import { HassioAddonDetails } from "../../../src/data/hassio/addon";
|
import { HassioAddonDetails } from "../../../src/data/hassio/addon";
|
||||||
|
import { Supervisor } from "../../../src/data/supervisor/supervisor";
|
||||||
import {
|
import {
|
||||||
HassRouterPage,
|
HassRouterPage,
|
||||||
RouterOptions,
|
RouterOptions,
|
||||||
@ -17,6 +18,8 @@ class HassioAddonRouter extends HassRouterPage {
|
|||||||
|
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public supervisor!: Supervisor;
|
||||||
|
|
||||||
@property({ attribute: false }) public addon!: HassioAddonDetails;
|
@property({ attribute: false }) public addon!: HassioAddonDetails;
|
||||||
|
|
||||||
protected routerOptions: RouterOptions = {
|
protected routerOptions: RouterOptions = {
|
||||||
@ -41,6 +44,7 @@ class HassioAddonRouter extends HassRouterPage {
|
|||||||
protected updatePageEl(el) {
|
protected updatePageEl(el) {
|
||||||
el.route = this.routeTail;
|
el.route = this.routeTail;
|
||||||
el.hass = this.hass;
|
el.hass = this.hass;
|
||||||
|
el.supervisor = this.supervisor;
|
||||||
el.addon = this.addon;
|
el.addon = this.addon;
|
||||||
el.narrow = this.narrow;
|
el.narrow = this.narrow;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import "../../../../src/components/ha-circular-progress";
|
import "../../../../src/components/ha-circular-progress";
|
||||||
import { HassioAddonDetails } from "../../../../src/data/hassio/addon";
|
import { HassioAddonDetails } from "../../../../src/data/hassio/addon";
|
||||||
|
import { Supervisor } from "../../../../src/data/supervisor/supervisor";
|
||||||
import { haStyle } from "../../../../src/resources/styles";
|
import { haStyle } from "../../../../src/resources/styles";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import { HomeAssistant } from "../../../../src/types";
|
||||||
import { hassioStyle } from "../../resources/hassio-style";
|
import { hassioStyle } from "../../resources/hassio-style";
|
||||||
@ -20,6 +21,8 @@ class HassioAddonInfoDashboard extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public supervisor!: Supervisor;
|
||||||
|
|
||||||
@property({ attribute: false }) public addon?: HassioAddonDetails;
|
@property({ attribute: false }) public addon?: HassioAddonDetails;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
@ -32,6 +35,7 @@ class HassioAddonInfoDashboard extends LitElement {
|
|||||||
<hassio-addon-info
|
<hassio-addon-info
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
.supervisor=${this.supervisor}
|
||||||
.addon=${this.addon}
|
.addon=${this.addon}
|
||||||
></hassio-addon-info>
|
></hassio-addon-info>
|
||||||
</div>
|
</div>
|
||||||
|
@ -54,6 +54,7 @@ import {
|
|||||||
fetchHassioStats,
|
fetchHassioStats,
|
||||||
HassioStats,
|
HassioStats,
|
||||||
} from "../../../../src/data/hassio/common";
|
} from "../../../../src/data/hassio/common";
|
||||||
|
import { Supervisor } from "../../../../src/data/supervisor/supervisor";
|
||||||
import {
|
import {
|
||||||
showAlertDialog,
|
showAlertDialog,
|
||||||
showConfirmationDialog,
|
showConfirmationDialog,
|
||||||
@ -65,6 +66,7 @@ import "../../components/hassio-card-content";
|
|||||||
import "../../components/supervisor-metric";
|
import "../../components/supervisor-metric";
|
||||||
import { showHassioMarkdownDialog } from "../../dialogs/markdown/show-dialog-hassio-markdown";
|
import { showHassioMarkdownDialog } from "../../dialogs/markdown/show-dialog-hassio-markdown";
|
||||||
import { hassioStyle } from "../../resources/hassio-style";
|
import { hassioStyle } from "../../resources/hassio-style";
|
||||||
|
import { addonArchIsSupported } from "../../util/addon";
|
||||||
|
|
||||||
const STAGE_ICON = {
|
const STAGE_ICON = {
|
||||||
stable: mdiCheckCircle,
|
stable: mdiCheckCircle,
|
||||||
@ -137,6 +139,8 @@ class HassioAddonInfo extends LitElement {
|
|||||||
|
|
||||||
@property({ attribute: false }) public addon!: HassioAddonDetails;
|
@property({ attribute: false }) public addon!: HassioAddonDetails;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public supervisor!: Supervisor;
|
||||||
|
|
||||||
@internalProperty() private _metrics?: HassioStats;
|
@internalProperty() private _metrics?: HassioStats;
|
||||||
|
|
||||||
@internalProperty() private _error?: string;
|
@internalProperty() private _error?: string;
|
||||||
@ -170,11 +174,25 @@ class HassioAddonInfo extends LitElement {
|
|||||||
iconClass="update"
|
iconClass="update"
|
||||||
></hassio-card-content>
|
></hassio-card-content>
|
||||||
${!this.addon.available
|
${!this.addon.available
|
||||||
? html`
|
? !addonArchIsSupported(
|
||||||
<p>
|
this.supervisor.info.supported_arch,
|
||||||
This update is no longer compatible with your system.
|
this.addon.arch
|
||||||
</p>
|
)
|
||||||
`
|
? html`
|
||||||
|
<p>
|
||||||
|
This add-on is not compatible with the processor of
|
||||||
|
your device or the operating system you have installed
|
||||||
|
on your device.
|
||||||
|
</p>
|
||||||
|
`
|
||||||
|
: html`
|
||||||
|
<p>
|
||||||
|
You are running Home Assistant
|
||||||
|
${this.supervisor.core.version}, to update to this
|
||||||
|
version of the add-on you need at least version
|
||||||
|
${this.addon.homeassistant} of Home Assistant
|
||||||
|
</p>
|
||||||
|
`
|
||||||
: ""}
|
: ""}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-actions">
|
<div class="card-actions">
|
||||||
@ -534,6 +552,27 @@ class HassioAddonInfo extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
${this._error ? html` <div class="errors">${this._error}</div> ` : ""}
|
${this._error ? html` <div class="errors">${this._error}</div> ` : ""}
|
||||||
|
${!this.addon.available
|
||||||
|
? !addonArchIsSupported(
|
||||||
|
this.supervisor.info.supported_arch,
|
||||||
|
this.addon.arch
|
||||||
|
)
|
||||||
|
? html`
|
||||||
|
<p class="warning">
|
||||||
|
This add-on is not compatible with the processor of your
|
||||||
|
device or the operating system you have installed on your
|
||||||
|
device.
|
||||||
|
</p>
|
||||||
|
`
|
||||||
|
: html`
|
||||||
|
<p class="warning">
|
||||||
|
You are running Home Assistant
|
||||||
|
${this.supervisor.core.version}, to install this add-on you
|
||||||
|
need at least version ${this.addon.homeassistant} of Home
|
||||||
|
Assistant
|
||||||
|
</p>
|
||||||
|
`
|
||||||
|
: ""}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-actions">
|
<div class="card-actions">
|
||||||
<div>
|
<div>
|
||||||
@ -561,13 +600,6 @@ class HassioAddonInfo extends LitElement {
|
|||||||
</ha-progress-button>
|
</ha-progress-button>
|
||||||
`
|
`
|
||||||
: html`
|
: html`
|
||||||
${!this.addon.available
|
|
||||||
? html`
|
|
||||||
<p class="warning">
|
|
||||||
This add-on is not available on your system.
|
|
||||||
</p>
|
|
||||||
`
|
|
||||||
: ""}
|
|
||||||
<ha-progress-button
|
<ha-progress-button
|
||||||
.disabled=${!this.addon.available}
|
.disabled=${!this.addon.available}
|
||||||
@click=${this._installClicked}
|
@click=${this._installClicked}
|
||||||
|
7
hassio/src/util/addon.ts
Normal file
7
hassio/src/util/addon.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import memoizeOne from "memoize-one";
|
||||||
|
import { SupervisorArch } from "../../../src/data/supervisor/supervisor";
|
||||||
|
|
||||||
|
export const addonArchIsSupported = memoizeOne(
|
||||||
|
(supported_archs: SupervisorArch[], addon_archs: SupervisorArch[]) =>
|
||||||
|
addon_archs.some((arch) => supported_archs.includes(arch))
|
||||||
|
);
|
@ -1,5 +1,6 @@
|
|||||||
import { HaFormSchema } from "../../components/ha-form/ha-form";
|
import { HaFormSchema } from "../../components/ha-form/ha-form";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
|
import { SupervisorArch } from "../supervisor/supervisor";
|
||||||
import { hassioApiResultExtractor, HassioResponse } from "./common";
|
import { hassioApiResultExtractor, HassioResponse } from "./common";
|
||||||
|
|
||||||
export interface HassioAddonInfo {
|
export interface HassioAddonInfo {
|
||||||
@ -24,7 +25,7 @@ export interface HassioAddonInfo {
|
|||||||
|
|
||||||
export interface HassioAddonDetails extends HassioAddonInfo {
|
export interface HassioAddonDetails extends HassioAddonInfo {
|
||||||
apparmor: "disable" | "default" | "profile";
|
apparmor: "disable" | "default" | "profile";
|
||||||
arch: "armhf" | "aarch64" | "i386" | "amd64";
|
arch: SupervisorArch[];
|
||||||
audio_input: null | string;
|
audio_input: null | string;
|
||||||
audio_output: null | string;
|
audio_output: null | string;
|
||||||
audio: boolean;
|
audio: boolean;
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { HomeAssistant, PanelInfo } from "../../types";
|
import { HomeAssistant, PanelInfo } from "../../types";
|
||||||
|
import { SupervisorArch } from "../supervisor/supervisor";
|
||||||
import { HassioAddonInfo, HassioAddonRepository } from "./addon";
|
import { HassioAddonInfo, HassioAddonRepository } from "./addon";
|
||||||
import { hassioApiResultExtractor, HassioResponse } from "./common";
|
import { hassioApiResultExtractor, HassioResponse } from "./common";
|
||||||
|
|
||||||
export type HassioHomeAssistantInfo = {
|
export type HassioHomeAssistantInfo = {
|
||||||
arch: string;
|
arch: SupervisorArch;
|
||||||
audio_input: string | null;
|
audio_input: string | null;
|
||||||
audio_output: string | null;
|
audio_output: string | null;
|
||||||
boot: boolean;
|
boot: boolean;
|
||||||
@ -22,7 +23,7 @@ export type HassioHomeAssistantInfo = {
|
|||||||
export type HassioSupervisorInfo = {
|
export type HassioSupervisorInfo = {
|
||||||
addons: HassioAddonInfo[];
|
addons: HassioAddonInfo[];
|
||||||
addons_repositories: HassioAddonRepository[];
|
addons_repositories: HassioAddonRepository[];
|
||||||
arch: string;
|
arch: SupervisorArch;
|
||||||
channel: string;
|
channel: string;
|
||||||
debug: boolean;
|
debug: boolean;
|
||||||
debug_block: boolean;
|
debug_block: boolean;
|
||||||
@ -39,7 +40,7 @@ export type HassioSupervisorInfo = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type HassioInfo = {
|
export type HassioInfo = {
|
||||||
arch: string;
|
arch: SupervisorArch;
|
||||||
channel: string;
|
channel: string;
|
||||||
docker: string;
|
docker: string;
|
||||||
features: string[];
|
features: string[];
|
||||||
@ -51,7 +52,7 @@ export type HassioInfo = {
|
|||||||
operating_system: string;
|
operating_system: string;
|
||||||
supervisor: string;
|
supervisor: string;
|
||||||
supported: boolean;
|
supported: boolean;
|
||||||
supported_arch: string[];
|
supported_arch: SupervisorArch[];
|
||||||
timezone: string;
|
timezone: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ import {
|
|||||||
HassioSupervisorInfo,
|
HassioSupervisorInfo,
|
||||||
} from "../hassio/supervisor";
|
} from "../hassio/supervisor";
|
||||||
|
|
||||||
|
export type SupervisorArch = "armhf" | "armv7" | "aarch64" | "i386" | "amd64";
|
||||||
|
|
||||||
export interface Supervisor {
|
export interface Supervisor {
|
||||||
host: HassioHostInfo;
|
host: HassioHostInfo;
|
||||||
supervisor: HassioSupervisorInfo;
|
supervisor: HassioSupervisorInfo;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user