This commit is contained in:
Ludeeus 2021-06-02 16:09:28 +00:00
parent 830136b874
commit f8d97735b8
3 changed files with 37 additions and 4 deletions

View File

@ -18,6 +18,23 @@ class HassioAddons extends LitElement {
@property({ attribute: false }) public supervisor!: Supervisor; @property({ attribute: false }) public supervisor!: Supervisor;
protected render(): TemplateResult { protected render(): TemplateResult {
return html`<ha-card
.header=${this.supervisor.localize("dashboard.addons")}
>
<div class="addons">
${this.supervisor.supervisor.addons.map(
(addon) => html`<div class="addon">
<div class="icon">
${addon.icon && atLeastVersion(this.hass.config.version, 0, 105)
? html`<img src="/api/hassio/addons/${addon.slug}/icon" />`
: html`<ha-svg-icon .path=${mdiPuzzle}></ha-svg-icon>`}
<div class="overlay"></div>
</div>
<div class="name">${addon.name}</div>
</div>`
)}
</div>
</ha-card>`;
return html` return html`
<div class="content"> <div class="content">
<h1>${this.supervisor.localize("dashboard.addons")}</h1> <h1>${this.supervisor.localize("dashboard.addons")}</h1>
@ -88,8 +105,21 @@ class HassioAddons extends LitElement {
haStyle, haStyle,
hassioStyle, hassioStyle,
css` css`
ha-card { :root {
cursor: pointer; display: block;
max-width: 400px;
}
.addon {
text-align: center;
max-width: 100px;
}
.icon > *:not(.overlay) {
position: relative;
max-height: 60px;
max-width: 60px;
margin: auto;
--mdc-icon-size: 60px;
display: flex;
} }
`, `,
]; ];

View File

@ -54,12 +54,14 @@ class HassioDashboard extends LitElement {
hassioStyle, hassioStyle,
css` css`
.content { .content {
margin: 4px;
display: flex; display: flex;
max-width: 1500px; max-width: 1500px;
} }
.content > * { .content > * {
display: block; display: block;
min-width: 500px; min-width: 500px;
margin: 4px;
} }
`, `,
]; ];

View File

@ -47,7 +47,8 @@ export class HassioUpdate extends LitElement {
Object.keys(supervisor).filter( Object.keys(supervisor).filter(
(value) => supervisor[value].update_available (value) => supervisor[value].update_available
).length + ).length +
supervisor.addon.addons.filter((addon) => addon.update_available).length supervisor.supervisor.addons.filter((addon) => addon.update_available)
.length
); );
protected render(): TemplateResult { protected render(): TemplateResult {
@ -134,7 +135,7 @@ export class HassioUpdate extends LitElement {
return html`<div class="update-row"> return html`<div class="update-row">
<paper-icon-item> <paper-icon-item>
<div class="icon" slot="item-icon"> <div class="icon" slot="item-icon">
${options.image ${options.image && atLeastVersion(this.hass.config.version, 0, 104)
? html`<img src="${options.image}" />` ? html`<img src="${options.image}" />`
: options.icon : options.icon
? html`<ha-svg-icon .path=${options.icon}></ha-svg-icon>` ? html`<ha-svg-icon .path=${options.icon}></ha-svg-icon>`