mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-08 18:39:40 +00:00
Run script in script editor open more info if fields (#19982)
* Run script in script editor open more info if fields * Extract function
This commit is contained in:
@@ -48,6 +48,7 @@ import {
|
||||
fetchScriptFileConfig,
|
||||
getScriptEditorInitData,
|
||||
getScriptStateConfig,
|
||||
hasScriptFields,
|
||||
isMaxMode,
|
||||
showScriptEditor,
|
||||
triggerScript,
|
||||
@@ -62,6 +63,7 @@ import { showToast } from "../../../util/toast";
|
||||
import "./blueprint-script-editor";
|
||||
import "./manual-script-editor";
|
||||
import type { HaManualScriptEditor } from "./manual-script-editor";
|
||||
import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info-dialog";
|
||||
|
||||
export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
@@ -611,6 +613,14 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
|
||||
private async _runScript(ev: CustomEvent) {
|
||||
ev.stopPropagation();
|
||||
|
||||
if (hasScriptFields(this.hass, this._entityId!)) {
|
||||
showMoreInfoDialog(this, {
|
||||
entityId: this._entityId!,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await triggerScript(this.hass, this.scriptId!);
|
||||
showToast(this, {
|
||||
message: this.hass.localize("ui.notification_toast.triggered", {
|
||||
|
||||
Reference in New Issue
Block a user