mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-16 13:56:35 +00:00
Alert user when auto update is enabled instead of hiding the button (#22187)
This commit is contained in:
parent
faf872bfb8
commit
adbcdc62eb
@ -18,6 +18,7 @@ import {
|
|||||||
updateReleaseNotes,
|
updateReleaseNotes,
|
||||||
} from "../../../data/update";
|
} from "../../../data/update";
|
||||||
import type { HomeAssistant } from "../../../types";
|
import type { HomeAssistant } from "../../../types";
|
||||||
|
import { showAlertDialog } from "../../generic/show-dialog-box";
|
||||||
|
|
||||||
@customElement("more-info-update")
|
@customElement("more-info-update")
|
||||||
class MoreInfoUpdate extends LitElement {
|
class MoreInfoUpdate extends LitElement {
|
||||||
@ -127,29 +128,27 @@ class MoreInfoUpdate extends LitElement {
|
|||||||
</ha-formfield> `
|
</ha-formfield> `
|
||||||
: ""}
|
: ""}
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
${this.stateObj.attributes.auto_update
|
${this.stateObj.state === BINARY_STATE_OFF &&
|
||||||
? ""
|
this.stateObj.attributes.skipped_version
|
||||||
: this.stateObj.state === BINARY_STATE_OFF &&
|
? html`
|
||||||
this.stateObj.attributes.skipped_version
|
<mwc-button @click=${this._handleClearSkipped}>
|
||||||
? html`
|
${this.hass.localize(
|
||||||
<mwc-button @click=${this._handleClearSkipped}>
|
"ui.dialogs.more_info_control.update.clear_skipped"
|
||||||
${this.hass.localize(
|
)}
|
||||||
"ui.dialogs.more_info_control.update.clear_skipped"
|
</mwc-button>
|
||||||
)}
|
`
|
||||||
</mwc-button>
|
: html`
|
||||||
`
|
<mwc-button
|
||||||
: html`
|
@click=${this._handleSkip}
|
||||||
<mwc-button
|
.disabled=${skippedVersion ||
|
||||||
@click=${this._handleSkip}
|
this.stateObj.state === BINARY_STATE_OFF ||
|
||||||
.disabled=${skippedVersion ||
|
updateIsInstalling(this.stateObj)}
|
||||||
this.stateObj.state === BINARY_STATE_OFF ||
|
>
|
||||||
updateIsInstalling(this.stateObj)}
|
${this.hass.localize(
|
||||||
>
|
"ui.dialogs.more_info_control.update.skip"
|
||||||
${this.hass.localize(
|
)}
|
||||||
"ui.dialogs.more_info_control.update.skip"
|
</mwc-button>
|
||||||
)}
|
`}
|
||||||
</mwc-button>
|
|
||||||
`}
|
|
||||||
${supportsFeature(this.stateObj, UpdateEntityFeature.INSTALL)
|
${supportsFeature(this.stateObj, UpdateEntityFeature.INSTALL)
|
||||||
? html`
|
? html`
|
||||||
<mwc-button
|
<mwc-button
|
||||||
@ -211,6 +210,17 @@ class MoreInfoUpdate extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _handleSkip(): void {
|
private _handleSkip(): void {
|
||||||
|
if (this.stateObj!.attributes.auto_update) {
|
||||||
|
showAlertDialog(this, {
|
||||||
|
title: this.hass.localize(
|
||||||
|
"ui.dialogs.more_info_control.update.auto_update_enabled_title"
|
||||||
|
),
|
||||||
|
text: this.hass.localize(
|
||||||
|
"ui.dialogs.more_info_control.update.auto_update_enabled_text"
|
||||||
|
),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.hass.callService("update", "skip", {
|
this.hass.callService("update", "skip", {
|
||||||
entity_id: this.stateObj!.entity_id,
|
entity_id: this.stateObj!.entity_id,
|
||||||
});
|
});
|
||||||
|
@ -1191,7 +1191,9 @@
|
|||||||
"skip": "Skip",
|
"skip": "Skip",
|
||||||
"clear_skipped": "Clear skipped",
|
"clear_skipped": "Clear skipped",
|
||||||
"install": "Install",
|
"install": "Install",
|
||||||
"create_backup": "Create backup before updating"
|
"create_backup": "Create backup before updating",
|
||||||
|
"auto_update_enabled_title": "Can not skip version",
|
||||||
|
"auto_update_enabled_text": "Automatic updates for this item have been enabled; skipping it is, therefore, unavailable. You can either install this update now or wait for Home Assistant to do it automatically."
|
||||||
},
|
},
|
||||||
"updater": {
|
"updater": {
|
||||||
"title": "Update instructions"
|
"title": "Update instructions"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user