Add clear skipped to update more-info dialog (#12361)

This commit is contained in:
Joakim Sørensen 2022-04-20 15:17:56 +02:00 committed by GitHub
parent aa129aa123
commit d97763a3e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import {
UPDATE_SUPPORT_SPECIFIC_VERSION, UPDATE_SUPPORT_SPECIFIC_VERSION,
} from "../../../data/update"; } from "../../../data/update";
import type { HomeAssistant } from "../../../types"; import type { HomeAssistant } from "../../../types";
import { BINARY_STATE_OFF } from "../../../common/const";
@customElement("more-info-update") @customElement("more-info-update")
class MoreInfoUpdate extends LitElement { class MoreInfoUpdate extends LitElement {
@ -129,11 +130,20 @@ class MoreInfoUpdate extends LitElement {
<div class="actions"> <div class="actions">
${this.stateObj.attributes.auto_update ${this.stateObj.attributes.auto_update
? "" ? ""
: this.stateObj.state === BINARY_STATE_OFF &&
this.stateObj.attributes.skipped_version
? html`
<mwc-button @click=${this._handleClearSkipped}>
${this.hass.localize(
"ui.dialogs.more_info_control.update.clear_skipped"
)}
</mwc-button>
`
: html` : html`
<mwc-button <mwc-button
@click=${this._handleSkip} @click=${this._handleSkip}
.disabled=${skippedVersion || .disabled=${skippedVersion ||
this.stateObj.state === "off" || this.stateObj.state === BINARY_STATE_OFF ||
updateIsInstalling(this.stateObj)} updateIsInstalling(this.stateObj)}
> >
${this.hass.localize( ${this.hass.localize(
@ -145,7 +155,7 @@ class MoreInfoUpdate extends LitElement {
? html` ? html`
<mwc-button <mwc-button
@click=${this._handleInstall} @click=${this._handleInstall}
.disabled=${(this.stateObj.state === "off" && .disabled=${(this.stateObj.state === BINARY_STATE_OFF &&
!skippedVersion) || !skippedVersion) ||
updateIsInstalling(this.stateObj)} updateIsInstalling(this.stateObj)}
> >
@ -207,6 +217,12 @@ class MoreInfoUpdate extends LitElement {
}); });
} }
private _handleClearSkipped(): void {
this.hass.callService("update", "clear_skipped", {
entity_id: this.stateObj!.entity_id,
});
}
static get styles(): CSSResultGroup { static get styles(): CSSResultGroup {
return css` return css`
hr { hr {

View File

@ -735,6 +735,7 @@
"latest_version": "Latest version", "latest_version": "Latest version",
"release_announcement": "Read release announcement", "release_announcement": "Read release announcement",
"skip": "Skip", "skip": "Skip",
"clear_skipped": "Clear skipped",
"install": "Install", "install": "Install",
"create_backup": "Create backup before updating" "create_backup": "Create backup before updating"
}, },