mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +00:00
parent
ba79633758
commit
848dd7e071
@ -100,10 +100,7 @@ class HaScriptEditor extends LocalizeMixin(NavigateMixin(PolymerElement)) {
|
|||||||
<ha-paper-icon-button-arrow-prev
|
<ha-paper-icon-button-arrow-prev
|
||||||
on-click="backTapped"
|
on-click="backTapped"
|
||||||
></ha-paper-icon-button-arrow-prev>
|
></ha-paper-icon-button-arrow-prev>
|
||||||
<div main-title>
|
<div main-title>[[computeHeader(script)]]</div>
|
||||||
[[localize('ui.panel.config.script.caption'), 'name',
|
|
||||||
computeName(script)]]
|
|
||||||
</div>
|
|
||||||
<template is="dom-if" if="[[!creatingNew]]">
|
<template is="dom-if" if="[[!creatingNew]]">
|
||||||
<paper-icon-button
|
<paper-icon-button
|
||||||
icon="hass:delete"
|
icon="hass:delete"
|
||||||
@ -261,7 +258,9 @@ class HaScriptEditor extends LocalizeMixin(NavigateMixin(PolymerElement)) {
|
|||||||
if (
|
if (
|
||||||
this.dirty &&
|
this.dirty &&
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
!confirm(this.hass.localize("ui.panel.config.common.editor.confirm_unsaved"))
|
!confirm(
|
||||||
|
this.hass.localize("ui.panel.config.common.editor.confirm_unsaved")
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -318,8 +317,14 @@ class HaScriptEditor extends LocalizeMixin(NavigateMixin(PolymerElement)) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
computeName(script) {
|
computeHeader(script) {
|
||||||
return script && computeStateName(script);
|
return script
|
||||||
|
? this.hass.localize(
|
||||||
|
"ui.panel.config.script.editor.header",
|
||||||
|
"name",
|
||||||
|
computeStateName(script)
|
||||||
|
)
|
||||||
|
: this.hass.localize("ui.panel.config.script.editor.default_name");
|
||||||
}
|
}
|
||||||
|
|
||||||
_computeRTL(hass) {
|
_computeRTL(hass) {
|
||||||
|
@ -113,11 +113,11 @@ class HaScriptPicker extends LitElement {
|
|||||||
const script = ev.currentTarget.script as HassEntity;
|
const script = ev.currentTarget.script as HassEntity;
|
||||||
await triggerScript(this.hass, script.entity_id);
|
await triggerScript(this.hass, script.entity_id);
|
||||||
showToast(this, {
|
showToast(this, {
|
||||||
message: `${this.hass.localize(
|
message: this.hass.localize(
|
||||||
"ui.dialogs.notification_toast.triggered",
|
"ui.notification_toast.triggered",
|
||||||
"name",
|
"name",
|
||||||
computeStateName(script)
|
computeStateName(script)
|
||||||
)}`,
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,7 +905,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"script": {
|
"script": {
|
||||||
"caption": "Script {name}",
|
"caption": "Script",
|
||||||
"description": "Create and edit scripts",
|
"description": "Create and edit scripts",
|
||||||
"picker": {
|
"picker": {
|
||||||
"header": "Script Editor",
|
"header": "Script Editor",
|
||||||
@ -916,6 +916,7 @@
|
|||||||
"add_script": "Add script"
|
"add_script": "Add script"
|
||||||
},
|
},
|
||||||
"editor": {
|
"editor": {
|
||||||
|
"header": "Script: {name}",
|
||||||
"default_name": "New Script",
|
"default_name": "New Script",
|
||||||
"load_error_not_editable": "Only scripts inside scripts.yaml are editable.",
|
"load_error_not_editable": "Only scripts inside scripts.yaml are editable.",
|
||||||
"delete_confirm": "Are you sure you want to delete this script?"
|
"delete_confirm": "Are you sure you want to delete this script?"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user