mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-10 03:19:44 +00:00
Make unavailable elements disabled (#5386)
* Make unavailable elements disabled * Unused * Add checks for unknown * Update hui-weather-entity-row.ts
This commit is contained in:
@@ -16,6 +16,7 @@ import "../components/hui-warning";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
import { LovelaceRow, ActionRowConfig } from "./types";
|
||||
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
||||
import { UNAVAILABLE_STATES } from "../../../data/entity";
|
||||
|
||||
@customElement("hui-script-entity-row")
|
||||
class HuiScriptEntityRow extends LitElement implements LovelaceRow {
|
||||
@@ -58,12 +59,17 @@ class HuiScriptEntityRow extends LitElement implements LovelaceRow {
|
||||
${stateObj.attributes.can_cancel
|
||||
? html`
|
||||
<ha-entity-toggle
|
||||
.disabled=${UNAVAILABLE_STATES.includes(stateObj.state)}
|
||||
.hass=${this.hass}
|
||||
.stateObj=${stateObj}
|
||||
></ha-entity-toggle>
|
||||
`
|
||||
: html`
|
||||
<mwc-button @click=${this._callService} class="text-content">
|
||||
<mwc-button
|
||||
@click=${this._callService}
|
||||
.disabled=${UNAVAILABLE_STATES.includes(stateObj.state)}
|
||||
class="text-content"
|
||||
>
|
||||
${this._config.action_name ||
|
||||
this.hass!.localize("ui.card.script.execute")}
|
||||
</mwc-button>
|
||||
|
||||
Reference in New Issue
Block a user