Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI updates: Updated to work with Ruleset model changes (#810)

Rich Turner68141677bd7b
diff --git a/ui/component/or-rules/src/or-rule-list.ts b/ui/component/or-rules/src/or-rule-list.ts
index e036ba2cb..4380a267f 100644
--- a/ui/component/or-rules/src/or-rule-list.ts
+++ b/ui/component/or-rules/src/or-rule-list.ts
@@ -321,8 +321,8 @@ export class OrRuleList extends translate(i18next)(LitElement) {
if (ruleset.enabled) {
// Look at validity meta
- if (ruleset.meta && ruleset.meta[WellknownRulesetMetaItems.VALIDITY]) {
- const calendarEvent = ruleset.meta[WellknownRulesetMetaItems.VALIDITY] as CalendarEvent;
+ if (ruleset.meta && ruleset.meta["validity"]) {
+ const calendarEvent = ruleset.meta["validity"] as CalendarEvent;
const now = new Date().getTime();
if (calendarEvent.start) {
diff --git a/ui/component/or-rules/src/or-rule-validity.ts b/ui/component/or-rules/src/or-rule-validity.ts
index 71be59ae2..e6e48663d 100644
--- a/ui/component/or-rules/src/or-rule-validity.ts
+++ b/ui/component/or-rules/src/or-rule-validity.ts
@@ -40,7 +40,7 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
super.updated(changedProps);
if (changedProps.has("ruleset") && this.ruleset) {
- this._validity = this.ruleset.meta ? this.ruleset.meta[WellknownRulesetMetaItems.VALIDITY] as CalendarEvent : undefined;
+ this._validity = this.ruleset.meta ? this.ruleset.meta["validity"] as CalendarEvent : undefined;
if (this._validity && this._validity.recurrence) {
this._rrule = RRule.fromString(this._validity.recurrence);
@@ -192,7 +192,7 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
switch (value) {
case "validityAlways":
- delete this.ruleset.meta[WellknownRulesetMetaItems.VALIDITY];
+ delete this.ruleset.meta["validity"];
this._validity = undefined;
this._rrule = undefined;
break;
@@ -279,12 +279,12 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
action: () => {
if (this.ruleset && this.ruleset.meta) {
if (this.getValidityType() === "validityAlways") {
- delete this.ruleset.meta[WellknownRulesetMetaItems.VALIDITY];
+ delete this.ruleset.meta["validity"];
} else {
if (this.getValidityType() === "validityRecurrence") {
this._validity!.recurrence = this._rrule!.toString().split("RRULE:")[1];
}
- this.ruleset.meta[WellknownRulesetMetaItems.VALIDITY] = this._validity;
+ this.ruleset.meta["validity"] = this._validity;
}
this.dispatchEvent(new OrRulesRuleChangedEvent(true));
this._dialog = undefined;