mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-02 05:57:54 +00:00
Disable ZHA device binding buttons when a device to bind isn't selected (#4407)
* only enable buttons when a device is selected * review comments
This commit is contained in:
parent
1b0d8bba29
commit
711d51c022
@ -32,7 +32,7 @@ export class ZHABindingControl extends LitElement {
|
|||||||
@property() private _showHelp: boolean = false;
|
@property() private _showHelp: boolean = false;
|
||||||
@property() private _bindTargetIndex: number = -1;
|
@property() private _bindTargetIndex: number = -1;
|
||||||
@property() private bindableDevices: ZHADevice[] = [];
|
@property() private bindableDevices: ZHADevice[] = [];
|
||||||
private _deviceToBind?: ZHADevice;
|
@property() private _deviceToBind?: ZHADevice;
|
||||||
|
|
||||||
protected updated(changedProperties: PropertyValues): void {
|
protected updated(changedProperties: PropertyValues): void {
|
||||||
if (changedProperties.has("selectedDevice")) {
|
if (changedProperties.has("selectedDevice")) {
|
||||||
@ -83,7 +83,11 @@ export class ZHABindingControl extends LitElement {
|
|||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
<div class="card-actions">
|
<div class="card-actions">
|
||||||
<mwc-button @click="${this._onBindDevicesClick}">Bind</mwc-button>
|
<mwc-button
|
||||||
|
@click="${this._onBindDevicesClick}"
|
||||||
|
.disabled="${!(this._deviceToBind && this.selectedDevice)}"
|
||||||
|
>Bind</mwc-button
|
||||||
|
>
|
||||||
${this._showHelp
|
${this._showHelp
|
||||||
? html`
|
? html`
|
||||||
<div class="helpText">
|
<div class="helpText">
|
||||||
@ -91,7 +95,9 @@ export class ZHABindingControl extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
<mwc-button @click="${this._onUnbindDevicesClick}"
|
<mwc-button
|
||||||
|
@click="${this._onUnbindDevicesClick}"
|
||||||
|
.disabled="${!(this._deviceToBind && this.selectedDevice)}"
|
||||||
>Unbind</mwc-button
|
>Unbind</mwc-button
|
||||||
>
|
>
|
||||||
${this._showHelp
|
${this._showHelp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user