mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-23 17:57:14 +00:00
Show script fields in Script more info dialog (#19879)
* Show script fields in more info dialog * Apply suggestions from code review Co-authored-by: Bram Kragten <mail@bramkragten.nl> * Guard for state obj changes * Update src/components/ha-service-control.ts Co-authored-by: Marc Geurts <geurtsmarc@hotmail.com> --------- Co-authored-by: Bram Kragten <mail@bramkragten.nl> Co-authored-by: Marc Geurts <geurtsmarc@hotmail.com>
This commit is contained in:
@@ -15,6 +15,8 @@ import { hasConfigOrEntityChanged } from "../common/has-changed";
|
||||
import "../components/hui-generic-entity-row";
|
||||
import { createEntityNotFoundWarning } from "../components/hui-warning";
|
||||
import { ActionRowConfig, LovelaceRow } from "./types";
|
||||
import { computeObjectId } from "../../../common/entity/compute_object_id";
|
||||
import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info-dialog";
|
||||
|
||||
@customElement("hui-script-entity-row")
|
||||
class HuiScriptEntityRow extends LitElement implements LovelaceRow {
|
||||
@@ -92,7 +94,15 @@ class HuiScriptEntityRow extends LitElement implements LovelaceRow {
|
||||
|
||||
private _runScript(ev): void {
|
||||
ev.stopPropagation();
|
||||
this._callService("turn_on");
|
||||
|
||||
const fields =
|
||||
this.hass!.services.script[computeObjectId(this._config!.entity)]?.fields;
|
||||
|
||||
if (fields && Object.keys(fields).length > 0) {
|
||||
showMoreInfoDialog(this, { entityId: this._config!.entity });
|
||||
} else {
|
||||
this._callService("turn_on");
|
||||
}
|
||||
}
|
||||
|
||||
private _callService(service: string): void {
|
||||
|
||||
Reference in New Issue
Block a user