mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-14 13:31:10 +00:00
Correct types for script automation editors (#9184)
This commit is contained in:
@@ -61,7 +61,7 @@ import { configSections } from "../ha-panel-config";
|
||||
export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@property() public scriptEntityId!: string;
|
||||
@property() public scriptEntityId: string | null = null;
|
||||
|
||||
@property() public route!: Route;
|
||||
|
||||
@@ -161,12 +161,12 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
aria-label=${this.hass.localize(
|
||||
"ui.panel.config.script.editor.delete_script"
|
||||
)}
|
||||
class=${classMap({ warning: this.scriptEntityId })}
|
||||
class=${classMap({ warning: Boolean(this.scriptEntityId) })}
|
||||
graphic="icon"
|
||||
>
|
||||
${this.hass.localize("ui.panel.config.script.editor.delete_script")}
|
||||
<ha-svg-icon
|
||||
class=${classMap({ warning: this.scriptEntityId })}
|
||||
class=${classMap({ warning: Boolean(this.scriptEntityId) })}
|
||||
slot="graphic"
|
||||
.path=${mdiDelete}
|
||||
>
|
||||
@@ -470,7 +470,7 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
|
||||
private async _runScript(ev) {
|
||||
ev.stopPropagation();
|
||||
await triggerScript(this.hass, this.scriptEntityId);
|
||||
await triggerScript(this.hass, this.scriptEntityId as string);
|
||||
showToast(this, {
|
||||
message: this.hass.localize(
|
||||
"ui.notification_toast.triggered",
|
||||
@@ -620,7 +620,10 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
|
||||
}
|
||||
|
||||
private async _delete() {
|
||||
await deleteScript(this.hass, computeObjectId(this.scriptEntityId));
|
||||
await deleteScript(
|
||||
this.hass,
|
||||
computeObjectId(this.scriptEntityId as string)
|
||||
);
|
||||
history.back();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user