Compare commits

...

1 Commits

Author SHA1 Message Date
Ludeeus
a6f8f0495c Do not show skip if entity support auto update 2022-03-31 16:12:48 +00:00
3 changed files with 19 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ import {
UPDATE_SUPPORT_PROGRESS, UPDATE_SUPPORT_PROGRESS,
UPDATE_SUPPORT_INSTALL, UPDATE_SUPPORT_INSTALL,
UPDATE_SUPPORT_RELEASE_NOTES, UPDATE_SUPPORT_RELEASE_NOTES,
UPDATE_SUPPORT_AUTO_UPDATE,
} from "../../../../src/data/update"; } from "../../../../src/data/update";
import "../../../../src/dialogs/more-info/more-info-content"; import "../../../../src/dialogs/more-info/more-info-content";
import { getEntity } from "../../../../src/fake_data/entity"; import { getEntity } from "../../../../src/fake_data/entity";
@@ -128,6 +129,12 @@ const ENTITIES = [
supported_features: supported_features:
base_attributes.supported_features + UPDATE_SUPPORT_RELEASE_NOTES, base_attributes.supported_features + UPDATE_SUPPORT_RELEASE_NOTES,
}), }),
getEntity("update", "update18", "on", {
...base_attributes,
friendly_name: "Update with auto update",
supported_features:
base_attributes.supported_features + UPDATE_SUPPORT_AUTO_UPDATE,
}),
]; ];
@customElement("demo-more-info-update") @customElement("demo-more-info-update")

View File

@@ -11,6 +11,7 @@ export const UPDATE_SUPPORT_SPECIFIC_VERSION = 2;
export const UPDATE_SUPPORT_PROGRESS = 4; export const UPDATE_SUPPORT_PROGRESS = 4;
export const UPDATE_SUPPORT_BACKUP = 8; export const UPDATE_SUPPORT_BACKUP = 8;
export const UPDATE_SUPPORT_RELEASE_NOTES = 16; export const UPDATE_SUPPORT_RELEASE_NOTES = 16;
export const UPDATE_SUPPORT_AUTO_UPDATE = 32;
interface UpdateEntityAttributes extends HassEntityAttributeBase { interface UpdateEntityAttributes extends HassEntityAttributeBase {
current_version: string | null; current_version: string | null;

View File

@@ -14,6 +14,7 @@ import {
UpdateEntity, UpdateEntity,
updateIsInstalling, updateIsInstalling,
updateReleaseNotes, updateReleaseNotes,
UPDATE_SUPPORT_AUTO_UPDATE,
UPDATE_SUPPORT_BACKUP, UPDATE_SUPPORT_BACKUP,
UPDATE_SUPPORT_INSTALL, UPDATE_SUPPORT_INSTALL,
UPDATE_SUPPORT_PROGRESS, UPDATE_SUPPORT_PROGRESS,
@@ -130,14 +131,16 @@ class MoreInfoUpdate extends LitElement {
: ""} : ""}
<hr /> <hr />
<div class="actions"> <div class="actions">
<mwc-button ${supportsFeature(this.stateObj, UPDATE_SUPPORT_AUTO_UPDATE)
@click=${this._handleSkip} ? ""
.disabled=${skippedVersion || : html`<mwc-button
this.stateObj.state === "off" || @click=${this._handleSkip}
updateIsInstalling(this.stateObj)} .disabled=${skippedVersion ||
> this.stateObj.state === "off" ||
${this.hass.localize("ui.dialogs.more_info_control.update.skip")} updateIsInstalling(this.stateObj)}
</mwc-button> >
${this.hass.localize("ui.dialogs.more_info_control.update.skip")}
</mwc-button>`}
${supportsFeature(this.stateObj, UPDATE_SUPPORT_INSTALL) ${supportsFeature(this.stateObj, UPDATE_SUPPORT_INSTALL)
? html` ? html`
<mwc-button <mwc-button