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
|
||||
on-click="backTapped"
|
||||
></ha-paper-icon-button-arrow-prev>
|
||||
<div main-title>
|
||||
[[localize('ui.panel.config.script.caption'), 'name',
|
||||
computeName(script)]]
|
||||
</div>
|
||||
<div main-title>[[computeHeader(script)]]</div>
|
||||
<template is="dom-if" if="[[!creatingNew]]">
|
||||
<paper-icon-button
|
||||
icon="hass:delete"
|
||||
@ -261,7 +258,9 @@ class HaScriptEditor extends LocalizeMixin(NavigateMixin(PolymerElement)) {
|
||||
if (
|
||||
this.dirty &&
|
||||
// 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;
|
||||
}
|
||||
@ -318,8 +317,14 @@ class HaScriptEditor extends LocalizeMixin(NavigateMixin(PolymerElement)) {
|
||||
);
|
||||
}
|
||||
|
||||
computeName(script) {
|
||||
return script && computeStateName(script);
|
||||
computeHeader(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) {
|
||||
|
@ -113,11 +113,11 @@ class HaScriptPicker extends LitElement {
|
||||
const script = ev.currentTarget.script as HassEntity;
|
||||
await triggerScript(this.hass, script.entity_id);
|
||||
showToast(this, {
|
||||
message: `${this.hass.localize(
|
||||
"ui.dialogs.notification_toast.triggered",
|
||||
message: this.hass.localize(
|
||||
"ui.notification_toast.triggered",
|
||||
"name",
|
||||
computeStateName(script)
|
||||
)}`,
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -905,7 +905,7 @@
|
||||
}
|
||||
},
|
||||
"script": {
|
||||
"caption": "Script {name}",
|
||||
"caption": "Script",
|
||||
"description": "Create and edit scripts",
|
||||
"picker": {
|
||||
"header": "Script Editor",
|
||||
@ -916,6 +916,7 @@
|
||||
"add_script": "Add script"
|
||||
},
|
||||
"editor": {
|
||||
"header": "Script: {name}",
|
||||
"default_name": "New Script",
|
||||
"load_error_not_editable": "Only scripts inside scripts.yaml are editable.",
|
||||
"delete_confirm": "Are you sure you want to delete this script?"
|
||||
|
Loading…
x
Reference in New Issue
Block a user