Show options if no options and schema (#8408)

This commit is contained in:
Joakim Sørensen 2021-02-16 21:25:59 +01:00 committed by GitHub
parent 0ec58007c9
commit c01c0528a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -29,13 +29,13 @@ class HassioAddonConfigDashboard extends LitElement {
const hasOptions =
this.addon.options && Object.keys(this.addon.options).length;
const hasSchema =
this.addon.schema && Object.keys(this.addon.schema).length;
hasOptions && this.addon.schema && Object.keys(this.addon.schema).length;
return html`
<div class="content">
${(hasOptions && hasSchema) || this.addon.network || this.addon.audio
${hasOptions || hasSchema || this.addon.network || this.addon.audio
? html`
${hasOptions && hasSchema
${hasOptions || hasSchema
? html`
<hassio-addon-config
.hass=${this.hass}

View File

@ -108,10 +108,12 @@ class HassioAddonConfig extends LitElement {
protected firstUpdated(changedProps) {
super.firstUpdated(changedProps);
this._canShowSchema = !this.addon.schema!.find(
// @ts-ignore
(entry) => !SUPPORTED_UI_TYPES.includes(entry.type) || entry.multiple
);
this._canShowSchema =
Object.keys(this.addon.options).length !== 0 &&
!this.addon.schema!.find(
// @ts-ignore
(entry) => !SUPPORTED_UI_TYPES.includes(entry.type) || entry.multiple
);
this._yamlMode = !this._canShowSchema;
}