mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 12:26:35 +00:00
Warn that only automations in automations.yaml are editable (#3200)
This commit is contained in:
parent
9309c5a1b6
commit
fe80c7fe0e
@ -147,18 +147,34 @@ class HaAutomationEditor extends LitElement {
|
||||
"GET",
|
||||
`config/automation/config/${this.automation.attributes.id}`
|
||||
)
|
||||
.then((config) => {
|
||||
// Normalize data: ensure trigger, action and condition are lists
|
||||
// Happens when people copy paste their automations into the config
|
||||
for (const key of ["trigger", "condition", "action"]) {
|
||||
const value = config[key];
|
||||
if (value && !Array.isArray(value)) {
|
||||
config[key] = [value];
|
||||
.then(
|
||||
(config) => {
|
||||
// Normalize data: ensure trigger, action and condition are lists
|
||||
// Happens when people copy paste their automations into the config
|
||||
for (const key of ["trigger", "condition", "action"]) {
|
||||
const value = config[key];
|
||||
if (value && !Array.isArray(value)) {
|
||||
config[key] = [value];
|
||||
}
|
||||
}
|
||||
this._dirty = false;
|
||||
this._config = config;
|
||||
},
|
||||
(resp) => {
|
||||
alert(
|
||||
resp.status_code === 404
|
||||
? this.hass.localize(
|
||||
"ui.panel.config.automation.editor.load_error_not_editable"
|
||||
)
|
||||
: this.hass.localize(
|
||||
"ui.panel.config.automation.editor.load_error_unknown",
|
||||
"err_no",
|
||||
resp.status_code
|
||||
)
|
||||
);
|
||||
history.back();
|
||||
}
|
||||
this._dirty = false;
|
||||
this._config = config;
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
if (changedProps.has("creatingNew") && this.creatingNew && this.hass) {
|
||||
|
@ -642,6 +642,8 @@
|
||||
"editor": {
|
||||
"introduction": "Use automations to bring your home alive",
|
||||
"default_name": "New Automation",
|
||||
"load_error_not_editable": "Only automations in automations.yaml are editable.",
|
||||
"load_error_unknown": "Error loading automation ({err_no}).",
|
||||
"save": "Save",
|
||||
"unsaved_confirm": "You have unsaved changes. Are you sure you want to leave?",
|
||||
"alias": "Name",
|
||||
|
Loading…
x
Reference in New Issue
Block a user