Filter add-ons in the store based on advanced mode (#5486)

This commit is contained in:
Joakim Sørensen 2020-04-08 13:49:37 +02:00 committed by GitHub
parent 7ddfe3c80b
commit 2253275640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 46 deletions

View File

@ -64,52 +64,57 @@ class HassioAddonRepositoryEl extends LitElement {
<div class="card-group"> <div class="card-group">
${addons.map( ${addons.map(
(addon) => html` (addon) => html`
<paper-card ${addon.advanced && !this.hass.userData?.showAdvanced
.addon=${addon} ? ""
class=${addon.available ? "" : "not_available"} : html`
@click=${this._addonTapped} <paper-card
> .addon=${addon}
<div class="card-content"> class=${addon.available ? "" : "not_available"}
<hassio-card-content @click=${this._addonTapped}
.hass=${this.hass} >
.title=${addon.name} <div class="card-content">
.description=${addon.description} <hassio-card-content
.available=${addon.available} .hass=${this.hass}
.icon=${addon.installed && addon.installed !== addon.version .title=${addon.name}
? "hassio:arrow-up-bold-circle" .description=${addon.description}
: "hassio:puzzle"} .available=${addon.available}
.iconTitle=${addon.installed .icon=${addon.installed &&
? addon.installed !== addon.version addon.installed !== addon.version
? "New version available" ? "hassio:arrow-up-bold-circle"
: "Add-on is installed" : "hassio:puzzle"}
: addon.available .iconTitle=${addon.installed
? "Add-on is not installed" ? addon.installed !== addon.version
: "Add-on is not available on your system"} ? "New version available"
.iconClass=${addon.installed : "Add-on is installed"
? addon.installed !== addon.version : addon.available
? "update" ? "Add-on is not installed"
: "installed" : "Add-on is not available on your system"}
: !addon.available .iconClass=${addon.installed
? "not_available" ? addon.installed !== addon.version
: ""} ? "update"
.iconImage=${atLeastVersion( : "installed"
this.hass.config.version, : !addon.available
0, ? "not_available"
105 : ""}
) && addon.icon .iconImage=${atLeastVersion(
? `/api/hassio/addons/${addon.slug}/icon` this.hass.config.version,
: undefined} 0,
.showTopbar=${addon.installed || !addon.available} 105
.topbarClass=${addon.installed ) && addon.icon
? addon.installed !== addon.version ? `/api/hassio/addons/${addon.slug}/icon`
? "update" : undefined}
: "installed" .showTopbar=${addon.installed || !addon.available}
: !addon.available .topbarClass=${addon.installed
? "unavailable" ? addon.installed !== addon.version
: ""} ? "update"
></hassio-card-content> : "installed"
</div> : !addon.available
</paper-card> ? "unavailable"
: ""}
></hassio-card-content>
</div>
</paper-card>
`}
` `
)} )}
</div> </div>

View File

@ -12,6 +12,7 @@ export interface HassioAddonInfo {
detached: boolean; detached: boolean;
available: boolean; available: boolean;
build: boolean; build: boolean;
advanced: boolean;
url: string | null; url: string | null;
icon: boolean; icon: boolean;
logo: boolean; logo: boolean;