Scripts - Fix the run button to check if the script has fields (#25156)
* Fix the run button to check if the script has fields * Used a more straightforward function to check fields instead of an async callpull/24917/head^2
parent
631bfe46ba
commit
e90967d200
|
@ -86,6 +86,7 @@ import {
|
||||||
deleteScript,
|
deleteScript,
|
||||||
fetchScriptFileConfig,
|
fetchScriptFileConfig,
|
||||||
getScriptStateConfig,
|
getScriptStateConfig,
|
||||||
|
hasScriptFields,
|
||||||
showScriptEditor,
|
showScriptEditor,
|
||||||
triggerScript,
|
triggerScript,
|
||||||
} from "../../../data/script";
|
} from "../../../data/script";
|
||||||
|
@ -1068,12 +1069,17 @@ ${rejected
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await triggerScript(this.hass, entry.unique_id);
|
|
||||||
showToast(this, {
|
if (hasScriptFields(this.hass, entry.unique_id)) {
|
||||||
message: this.hass.localize("ui.notification_toast.triggered", {
|
this._showInfo(script);
|
||||||
name: computeStateName(script),
|
} else {
|
||||||
}),
|
await triggerScript(this.hass, entry.unique_id);
|
||||||
});
|
showToast(this, {
|
||||||
|
message: this.hass.localize("ui.notification_toast.triggered", {
|
||||||
|
name: computeStateName(script),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private _showInfo(script: any) {
|
private _showInfo(script: any) {
|
||||||
|
|
Loading…
Reference in New Issue