Fix gauge editor (#6783)

This commit is contained in:
Bram Kragten 2020-09-04 15:18:01 +02:00 committed by GitHub
parent b7845c318e
commit faee2c3e1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,14 +4,16 @@ import {
CSSResult,
customElement,
html,
internalProperty,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { assert, number, object, optional, string } from "superstruct";
import { fireEvent } from "../../../../common/dom/fire_event";
import "../../../../components/ha-switch";
import { computeRTLDirection } from "../../../../common/util/compute_rtl";
import "../../../../components/ha-formfield";
import "../../../../components/ha-switch";
import { HomeAssistant } from "../../../../types";
import { GaugeCardConfig, SeverityConfig } from "../../cards/types";
import "../../components/hui-entity-editor";
@ -19,8 +21,6 @@ import "../../components/hui-theme-select-editor";
import { LovelaceCardEditor } from "../../types";
import { EditorTarget, EntitiesEditorEvent } from "../types";
import { configElementStyle } from "./config-elements-style";
import { computeRTLDirection } from "../../../../common/util/compute_rtl";
import { assert, object, string, optional, number } from "superstruct";
const cardConfigStruct = object({
type: string(),
@ -222,12 +222,16 @@ export class HuiGaugeCardEditor extends LitElement
}
if ((ev.target as EditorTarget).checked) {
this._config.severity = {
green: 0,
yellow: 0,
red: 0,
this._config = {
...this._config,
severity: {
green: 0,
yellow: 0,
red: 0,
},
};
} else {
this._config = { ...this._config };
delete this._config.severity;
}
fireEvent(this, "config-changed", { config: this._config });