mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Fix alarm card editor (#4592)
This commit is contained in:
parent
db9924bd87
commit
971538e9c2
@ -155,13 +155,14 @@ export class HuiAlarmPanelCardEditor extends LitElement
|
||||
const target = ev.target! as EditorTarget;
|
||||
const index = Number(target.value);
|
||||
if (index > -1) {
|
||||
const newStates = this._states;
|
||||
const newStates = [...this._states];
|
||||
newStates.splice(index, 1);
|
||||
this._config = {
|
||||
fireEvent(this, "config-changed", {
|
||||
config: {
|
||||
...this._config,
|
||||
states: newStates,
|
||||
};
|
||||
fireEvent(this, "config-changed", { config: this._config });
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,17 +171,18 @@ export class HuiAlarmPanelCardEditor extends LitElement
|
||||
return;
|
||||
}
|
||||
const target = ev.target! as EditorTarget;
|
||||
if (!target.value || this._states.indexOf(target.value) >= 0) {
|
||||
if (!target.value || this._states.indexOf(target.value) !== -1) {
|
||||
return;
|
||||
}
|
||||
const newStates = this._states;
|
||||
const newStates = [...this._states];
|
||||
newStates.push(target.value);
|
||||
this._config = {
|
||||
target.value = "";
|
||||
fireEvent(this, "config-changed", {
|
||||
config: {
|
||||
...this._config,
|
||||
states: newStates,
|
||||
};
|
||||
target.value = "";
|
||||
fireEvent(this, "config-changed", { config: this._config });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private _valueChanged(ev: EntitiesEditorEvent): void {
|
||||
|
Loading…
x
Reference in New Issue
Block a user