diff --git a/hassio/src/system/hassio-supervisor-info.ts b/hassio/src/system/hassio-supervisor-info.ts
index 560a04e534..6d0bf96efe 100644
--- a/hassio/src/system/hassio-supervisor-info.ts
+++ b/hassio/src/system/hassio-supervisor-info.ts
@@ -1,4 +1,3 @@
-import "@material/mwc-button";
import {
css,
CSSResult,
@@ -8,6 +7,7 @@ import {
property,
TemplateResult,
} from "lit-element";
+import "../../../src/components/buttons/ha-progress-button";
import "../../../src/components/ha-card";
import "../../../src/components/ha-settings-row";
import "../../../src/components/ha-switch";
@@ -56,12 +56,12 @@ class HassioSupervisorInfo extends LitElement {
${this.supervisorInfo.version !== this.supervisorInfo.version_latest
? html`
-
-
+ Update
+
`
: ""}
@@ -74,21 +74,21 @@ class HassioSupervisorInfo extends LitElement {
${this.supervisorInfo.channel === "beta"
? html`
-
-
+ Leave beta channel
+
`
: this.supervisorInfo.channel === "stable"
? html`
-
-
+ Join beta channel
+
`
: ""}
@@ -131,55 +131,21 @@ class HassioSupervisorInfo extends LitElement {
`}
-
-
+ Reload
+
`;
}
- static get styles(): CSSResult[] {
- return [
- haStyle,
- hassioStyle,
- css`
- ha-card {
- height: 100%;
- justify-content: space-between;
- flex-direction: column;
- display: flex;
- }
- .card-actions {
- height: 48px;
- border-top: none;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- button.link {
- color: var(--primary-color);
- }
- ha-settings-row {
- padding: 0;
- height: 54px;
- width: 100%;
- }
- ha-settings-row[three-line] {
- height: 74px;
- }
- ha-settings-row > span[slot="description"] {
- white-space: normal;
- color: var(--secondary-text-color);
- }
- `,
- ];
- }
+ private async _toggleBeta(ev: CustomEvent): Promise {
+ const button = ev.target as any;
+ button.progress = true;
- private async _toggleBeta(): Promise {
if (this.supervisorInfo.channel === "stable") {
const confirmed = await showConfirmationDialog(this, {
title: "WARNING",
@@ -202,6 +168,7 @@ class HassioSupervisorInfo extends LitElement {
});
if (!confirmed) {
+ button.progress = false;
return;
}
}
@@ -219,9 +186,13 @@ class HassioSupervisorInfo extends LitElement {
typeof err === "object" ? err.body?.message || "Unkown error" : err,
});
}
+ button.progress = false;
}
- private async _supervisorReload(): Promise {
+ private async _supervisorReload(ev: CustomEvent): Promise {
+ const button = ev.target as any;
+ button.progress = true;
+
try {
await reloadSupervisor(this.hass);
} catch (err) {
@@ -231,9 +202,25 @@ class HassioSupervisorInfo extends LitElement {
typeof err === "object" ? err.body?.message || "Unkown error" : err,
});
}
+ button.progress = false;
}
- private async _supervisorUpdate(): Promise {
+ private async _supervisorUpdate(ev: CustomEvent): Promise {
+ const button = ev.target as any;
+ button.progress = true;
+
+ const confirmed = await showConfirmationDialog(this, {
+ title: "Update supervisor",
+ text: `Are you sure you want to upgrade supervisor to version ${this.supervisorInfo.version_latest}?`,
+ confirmText: "update",
+ dismissText: "cancel",
+ });
+
+ if (!confirmed) {
+ button.progress = false;
+ return;
+ }
+
try {
await updateSupervisor(this.hass);
} catch (err) {
@@ -243,6 +230,7 @@ class HassioSupervisorInfo extends LitElement {
typeof err === "object" ? err.body.message || "Unkown error" : err,
});
}
+ button.progress = false;
}
private async _diagnosticsInformationDialog(): Promise {
@@ -274,6 +262,43 @@ class HassioSupervisorInfo extends LitElement {
});
}
}
+
+ static get styles(): CSSResult[] {
+ return [
+ haStyle,
+ hassioStyle,
+ css`
+ ha-card {
+ height: 100%;
+ justify-content: space-between;
+ flex-direction: column;
+ display: flex;
+ }
+ .card-actions {
+ height: 48px;
+ border-top: none;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+ button.link {
+ color: var(--primary-color);
+ }
+ ha-settings-row {
+ padding: 0;
+ height: 54px;
+ width: 100%;
+ }
+ ha-settings-row[three-line] {
+ height: 74px;
+ }
+ ha-settings-row > div[slot="description"] {
+ white-space: normal;
+ color: var(--secondary-text-color);
+ }
+ `,
+ ];
+ }
}
declare global {