Hide configuration card if the add-on does not expose options or schema (#8131)

This commit is contained in:
Joakim Sørensen 2021-01-11 14:43:24 +01:00 committed by GitHub
parent 96f0ceeb8c
commit edcb7e87bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 18 deletions

View File

@ -26,28 +26,41 @@ class HassioAddonConfigDashboard extends LitElement {
if (!this.addon) { if (!this.addon) {
return html`<ha-circular-progress active></ha-circular-progress>`; return html`<ha-circular-progress active></ha-circular-progress>`;
} }
const hasOptions =
this.addon.options && Object.keys(this.addon.options).length;
const hasSchema =
this.addon.schema && Object.keys(this.addon.schema).length;
return html` return html`
<div class="content"> <div class="content">
<hassio-addon-config ${hasOptions || hasSchema || this.addon.network || this.addon.audio
.hass=${this.hass}
.addon=${this.addon}
></hassio-addon-config>
${this.addon.network
? html` ? html`
<hassio-addon-network ${hasOptions || hasSchema
.hass=${this.hass} ? html`
.addon=${this.addon} <hassio-addon-config
></hassio-addon-network> .hass=${this.hass}
.addon=${this.addon}
></hassio-addon-config>
`
: ""}
${this.addon.network
? html`
<hassio-addon-network
.hass=${this.hass}
.addon=${this.addon}
></hassio-addon-network>
`
: ""}
${this.addon.audio
? html`
<hassio-addon-audio
.hass=${this.hass}
.addon=${this.addon}
></hassio-addon-audio>
`
: ""}
` `
: ""} : "This add-on does not expose configuration for you to mess with.... 👋"}
${this.addon.audio
? html`
<hassio-addon-audio
.hass=${this.hass}
.addon=${this.addon}
></hassio-addon-audio>
`
: ""}
</div> </div>
`; `;
} }

View File

@ -61,6 +61,7 @@ export interface HassioAddonDetails extends HassioAddonInfo {
privileged: any; privileged: any;
protected: boolean; protected: boolean;
rating: "1-6"; rating: "1-6";
schema: Record<string, any>;
services_role: string[]; services_role: string[];
slug: string; slug: string;
startup: "initialize" | "system" | "services" | "application" | "once"; startup: "initialize" | "system" | "services" | "application" | "once";