mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Use ha-progress-button for update cards (#6725)
This commit is contained in:
parent
db0a010d7c
commit
dc5b92030f
@ -10,7 +10,7 @@ import {
|
|||||||
internalProperty,
|
internalProperty,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import "../../../src/components/buttons/ha-call-api-button";
|
import "../../../src/components/buttons/ha-progress-button";
|
||||||
import "../../../src/components/ha-card";
|
import "../../../src/components/ha-card";
|
||||||
import "../../../src/components/ha-svg-icon";
|
import "../../../src/components/ha-svg-icon";
|
||||||
import { HassioHassOSInfo } from "../../../src/data/hassio/host";
|
import { HassioHassOSInfo } from "../../../src/data/hassio/host";
|
||||||
@ -131,13 +131,14 @@ export class HassioUpdate extends LitElement {
|
|||||||
<a href="${releaseNotesUrl}" target="_blank" rel="noreferrer">
|
<a href="${releaseNotesUrl}" target="_blank" rel="noreferrer">
|
||||||
<mwc-button>Release notes</mwc-button>
|
<mwc-button>Release notes</mwc-button>
|
||||||
</a>
|
</a>
|
||||||
<mwc-button
|
<ha-progress-button
|
||||||
label="Update"
|
|
||||||
.apiPath=${apiPath}
|
.apiPath=${apiPath}
|
||||||
.name=${name}
|
.name=${name}
|
||||||
.version=${lastVersion}
|
.version=${lastVersion}
|
||||||
@click=${this._confirmUpdate}
|
@click=${this._confirmUpdate}
|
||||||
></mwc-button>
|
>
|
||||||
|
Update
|
||||||
|
</ha-progress-button>
|
||||||
</div>
|
</div>
|
||||||
</ha-card>
|
</ha-card>
|
||||||
`;
|
`;
|
||||||
@ -145,6 +146,7 @@ export class HassioUpdate extends LitElement {
|
|||||||
|
|
||||||
private async _confirmUpdate(ev): Promise<void> {
|
private async _confirmUpdate(ev): Promise<void> {
|
||||||
const item = ev.target;
|
const item = ev.target;
|
||||||
|
item.progress = true;
|
||||||
const confirmed = await showConfirmationDialog(this, {
|
const confirmed = await showConfirmationDialog(this, {
|
||||||
title: `Update ${item.name}`,
|
title: `Update ${item.name}`,
|
||||||
text: `Are you sure you want to upgrade ${item.name} to version ${item.version}?`,
|
text: `Are you sure you want to upgrade ${item.name} to version ${item.version}?`,
|
||||||
@ -153,6 +155,7 @@ export class HassioUpdate extends LitElement {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!confirmed) {
|
if (!confirmed) {
|
||||||
|
item.progress = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -164,6 +167,7 @@ export class HassioUpdate extends LitElement {
|
|||||||
typeof err === "object" ? err.body?.message || "Unkown error" : err,
|
typeof err === "object" ? err.body?.message || "Unkown error" : err,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
item.progress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResult[] {
|
static get styles(): CSSResult[] {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user