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: Rules validity and webapp improvements

Robin Dekkers80f84851123e
diff --git a/deployment/manager/shared/locales/en/or.json b/deployment/manager/shared/locales/en/or.json
index e9a22ba84..04032a5a2 100644
--- a/deployment/manager/shared/locales/en/or.json
+++ b/deployment/manager/shared/locales/en/or.json
@@ -339,5 +339,6 @@
"validityRecurrence":"Plan a repeating occurence",
"activeFromTo": "Active from {{start}} to {{end}}",
"fromTo":"From {{start}} to {{end}}",
- "fromToDays":"from {{start}} to {{days}} days later {{end}}"
+ "fromToDays":"from {{start}} to {{days}} days later {{end}}",
+ "forDays":"for {{days}} days"
}
diff --git a/ui/app/mobile/src/index.ts b/ui/app/mobile/src/index.ts
index eda441adb..15540ed96 100644
--- a/ui/app/mobile/src/index.ts
+++ b/ui/app/mobile/src/index.ts
@@ -96,5 +96,4 @@ const appConfig: AppConfig<RootState> = {
};
orApp.managerConfig = managerConfig;
orApp.appConfig = appConfig;
-
document.body.appendChild(orApp);
diff --git a/ui/app/or-app/src/index.ts b/ui/app/or-app/src/index.ts
index 55579c54e..530f38227 100644
--- a/ui/app/or-app/src/index.ts
+++ b/ui/app/or-app/src/index.ts
@@ -292,7 +292,7 @@ export class OrApp<S extends AppStateKeyed> extends LitElement {
this._store.dispatch(updatePage("default"));
})
}
-
+
router.resolve();
} else {
showErrorDialog(manager.isError ? "managerError." + manager.error : "");
@@ -381,8 +381,16 @@ export class OrApp<S extends AppStateKeyed> extends LitElement {
if (!this._initialised) {
return html`<or-mwc-dialog id="app-modal"></or-mwc-dialog>`;
}
+ let consoleStyles;
+ if(manager.consoleAppConfig) {
+ const consoleAppConfig = manager.consoleAppConfig;
+ const primary = consoleAppConfig.primaryColor;
+ const secondary = consoleAppConfig.secondaryColor;
+ consoleStyles = html`<style>:host {--or-console-primary-color:${primary};--or-console-secondary-color:${secondary};}</style>`;
+ }
return html`
${unsafeHTML(this._config.styles ? this._config.styles.strings : ``)}
+ ${consoleStyles}
${this._config.header ? html`
<or-header logo="${this._config.logo}" .logoMobile="${this._config.logoMobile}" .config="${this._config.header}"></or-header>
` : ``}
diff --git a/ui/app/or-app/src/or-header.ts b/ui/app/or-app/src/or-header.ts
index bdfbb8e41..4b57815b8 100644
--- a/ui/app/or-app/src/or-header.ts
+++ b/ui/app/or-app/src/or-header.ts
@@ -191,7 +191,9 @@ class OrHeader extends LitElement {
.menu-item[selected] {
opacity: 1;
}
-
+ #desktop-left .menu-item or-icon {
+ margin-right: 10px;
+ }
#desktop-left .menu-item {
display: none;
line-height: calc(var(--internal-or-header-height) - 4px);
diff --git a/ui/app/or-app/src/pages/page-mobile-geofences.ts b/ui/app/or-app/src/pages/page-mobile-geofences.ts
index 2728d2f14..bf8974c8e 100644
--- a/ui/app/or-app/src/pages/page-mobile-geofences.ts
+++ b/ui/app/or-app/src/pages/page-mobile-geofences.ts
@@ -31,14 +31,21 @@ class PageMobileGeofences<S extends AppStateKeyed> extends Page<S> {
static get styles() {
// language=CSS
return css`
- :host {
+ :host,
+ :host > .inner {
flex: 1;
width: 100%;
align-items: center;
justify-content: center;
- flex-direction: column;
+ flex-direction: column;
+ --internal-or-map-marker-color: var(--or-console-primary-color, --or-app-color4);
+ }
+ .inner {
+ display: none;
+ }
+ .inner[active] {
+ display: block;
}
-
.header {
position: fixed;
z-index: 99999;
@@ -72,7 +79,7 @@ class PageMobileGeofences<S extends AppStateKeyed> extends Page<S> {
text-decoration: none;
padding: 20px;
color: var(--or-app-color3);
- border-bottom: 1px solid var(--or-app-color3);;
+ border-bottom: 1px solid #22211f47;
}
h3, p {
@@ -80,13 +87,13 @@ class PageMobileGeofences<S extends AppStateKeyed> extends Page<S> {
}
h3 {
- color: var(--or-app-color4);
+ color: var(--or-console-primary-color, --or-app-color4);
}
.button {
cursor: pointer;
background-color: var(--or-app-color2);
- color: var(--or-app-color4);
+ color: var(--or-console-primary-color, --or-app-color4);
--or-icon-fill: var(--or-app-color3);
width: 42px;
height: 42px;
@@ -217,10 +224,18 @@ class PageMobileGeofences<S extends AppStateKeyed> extends Page<S> {
@property()
public config?: GeofencesConfig;
+ protected updated(changedProperties) {
+ if(changedProperties.has('view') && this.view === "map"){
+ const map = this.shadowRoot.querySelector('.or-map');
+ const vectorMap = map as OrMap;
+ vectorMap.resize()
+ }
+ }
+
protected render() {
const controls = [new NavigationControl({showCompass: false, showZoom: false})];
return html`
- ${this.view === 'map' ? html`
+ <div ?active="${this.view === 'map'}" class="inner">
<div class="header">
<div class="d-flex right">
<a class="d-flex button" @click="${() => history.back()}"><or-icon icon="close"></or-icon></a>
@@ -228,7 +243,7 @@ class PageMobileGeofences<S extends AppStateKeyed> extends Page<S> {
<a class="d-flex location-button button" @click="${this.getLocation}"><or-icon icon="crosshairs-gps"></or-icon></a>
</div>
</div>
- <or-map id="vector" class="or-map" .controls="${controls}" type="VECTOR" style="height: 100%; width: 100%;">
+ <or-map id="vector" class="or-map" .controls="${controls}" type="VECTOR" style="height: 100vh; width: 100vw">
${this.mapItems.map((marker: any) => {
return html`
<or-map-marker ?active="${JSON.stringify(this.activeItem) === JSON.stringify(marker) }" icon="information" .marker="${marker}" lat="${marker.predicate.lat}" lng="${marker.predicate.lng}"></or-map-marker>
@@ -249,31 +264,29 @@ class PageMobileGeofences<S extends AppStateKeyed> extends Page<S> {
</div>
</a>
` : ``}
- ` : ``}
-
- ${this.view === 'list' ? html`
- <div class="header">
- <div class="d-flex right">
- <a class="d-flex button" @click="${() => history.back()}"><or-icon icon="close"></or-icon></a>
- <a class="d-flex button" @click="${() => this.view = "map"}"><or-icon icon="map"></or-icon></a>
- </div>
</div>
- <div class="d-flex flex list-container">
- ${this.listItems.map((item: any) => {
- return html`
- <a class="list-item" href="${this.createUrl(item.notification.action)}">
- <div class="flex">
- <h3>${item.notification.title}</h3>
- <p>${item.notification.body}</p>
- </div>
- <div style="align-items: center; justify-content: center; display: flex;">
- <or-icon style="margin-left: 20px;" icon="chevron-right"></or-icon>
- </div>
- </a>
- `})}
+ <div ?active="${this.view === 'list'}" class="inner">
+ <div class="header">
+ <div class="d-flex right">
+ <a class="d-flex button" @click="${() => history.back()}"><or-icon icon="close"></or-icon></a>
+ <a class="d-flex button" @click="${() => this.view = "map"}"><or-icon icon="map"></or-icon></a>
+ </div>
+ </div>
+ <div class="list-container">
+ ${this.listItems.map((item: any) => {
+ return html`
+ <a class="list-item" href="${this.createUrl(item.notification.action)}">
+ <div class="flex">
+ <h3>${item.notification.title}</h3>
+ <p>${item.notification.body}</p>
+ </div>
+ <div style="align-items: center; justify-content: center; display: flex;">
+ <or-icon style="margin-left: 20px;" icon="chevron-right"></or-icon>
+ </div>
+ </a>
+ `})}
+ </div>
</div>
- ` : ``}
-
`;
}
diff --git a/ui/app/or-app/src/pages/page-mobile-onboarding.ts b/ui/app/or-app/src/pages/page-mobile-onboarding.ts
index 1915a34cd..ae113002d 100644
--- a/ui/app/or-app/src/pages/page-mobile-onboarding.ts
+++ b/ui/app/or-app/src/pages/page-mobile-onboarding.ts
@@ -75,7 +75,7 @@ class PageMobileOnboarding<S extends AppStateKeyed> extends Page<S> {
width: 42px;
height: 42px;
border-radius: 50%;
- background-color: var(--or-app-color4);
+ background-color: var(--or-console-primary-color, --or-app-color4);
justify-content: center;
align-items: center;
display: flex;
diff --git a/ui/component/or-input/src/index.ts b/ui/component/or-input/src/index.ts
index ea5edc1e0..d8fbb7bb1 100644
--- a/ui/component/or-input/src/index.ts
+++ b/ui/component/or-input/src/index.ts
@@ -151,7 +151,17 @@ const style = css`
background-color: var(--or-app-color2);
font-size: 13px;
}
-
+
+ input::-webkit-calendar-picker-indicator {
+ margin: 0;
+ }
+
+ .mdc-checkbox-list .mdc-checkbox {
+ padding: 0;
+ height: 32px;
+ width: 32px;
+ }
+
.mdc-checkbox-list input:checked + label {
color: var(--or-app-color2);
background-color: var(--mdc-theme-primary);
diff --git a/ui/component/or-map/src/index.ts b/ui/component/or-map/src/index.ts
index b044c0ea8..ef7f9773b 100644
--- a/ui/component/or-map/src/index.ts
+++ b/ui/component/or-map/src/index.ts
@@ -214,6 +214,12 @@ export class OrMap extends LitElement {
this._loaded = true;
}
+
+ public resize() {
+ if (this._map) {
+ this._map.resize();
+ }
+ }
public flyTo(coordinates?: LngLatLike, zoom?: number) {
if (this._map) {
diff --git a/ui/component/or-map/src/mapwidget.ts b/ui/component/or-map/src/mapwidget.ts
index 59e6faf84..1156d8d47 100644
--- a/ui/component/or-map/src/mapwidget.ts
+++ b/ui/component/or-map/src/mapwidget.ts
@@ -98,6 +98,23 @@ export class MapWidget {
return this;
}
+ public resize(): this {
+
+ switch (this._type) {
+ case MapType.RASTER:
+ if (this._mapJs) {
+ }
+ break;
+ case MapType.VECTOR:
+ if (this._mapGl) {
+ this._mapGl.resize()
+ }
+ break;
+ }
+
+ return this;
+ }
+
public setZoom(zoom?: number): this {
this._zoom = zoom;
diff --git a/ui/component/or-rules/src/or-rule-validity.ts b/ui/component/or-rules/src/or-rule-validity.ts
index e9738c6af..95874477d 100644
--- a/ui/component/or-rules/src/or-rule-validity.ts
+++ b/ui/component/or-rules/src/or-rule-validity.ts
@@ -15,6 +15,8 @@ import moment from "moment";
@customElement("or-rule-validity")
export class OrRuleValidity extends translate(i18next)(LitElement) {
+ @property({type: Number})
+ public rulesetId?: number | undefined;
@property({type: Object})
public ruleset?: RulesetUnion;
@@ -28,6 +30,7 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
constructor() {
super();
}
+
public static styles = css`
:host {
margin-left: 20px;
@@ -37,6 +40,11 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
protected updated(changedProps: PropertyValues) {
super.updated(changedProps);
if(changedProps.has("ruleset") && this.ruleset) {
+ if(this.ruleset.id && this.ruleset.id != this.rulesetId) {
+ const dialog: OrMwcDialog = this.shadowRoot!.getElementById("radial-modal") as OrMwcDialog;
+ if (dialog) dialog.close();
+ this.rulesetId = this.ruleset.id
+ }
if(!this.ruleset.meta) this.ruleset.meta = {};
if(!this.ruleset.meta["urn:openremote:rule:meta:validity"]) return;
@@ -66,9 +74,10 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
}
isAllDay() {
- if(this.ruleset && this.ruleset.meta && this.ruleset.meta["urn:openremote:rule:meta:validity"]) {
- if(moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).hours() === 0 && moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).minutes() === 0
- && moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).hours() === 23 && moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).minutes() === 59) {
+ if(this.ruleset && this.ruleset.meta) {
+ const validity = this.ruleset.meta["urn:openremote:rule:meta:validity"];
+ if(moment(validity.start).hours() === 0 && moment(validity.start).minutes() === 0
+ && moment(validity.end).hours() === 23 && moment(validity.end).minutes() === 59) {
return true
}
}
@@ -81,34 +90,34 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
case "all-day":
if(value) {
if(this.ruleset.meta) {
- this.ruleset.meta["urn:openremote:rule:meta:validity"].start = moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).startOf('day');
- this.ruleset.meta["urn:openremote:rule:meta:validity"].end = moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).endOf('day');
+ this.ruleset.meta["urn:openremote:rule:meta:validity"].start = moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).startOf('day');
+ this.ruleset.meta["urn:openremote:rule:meta:validity"].end = moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).endOf('day');
}
} else {
if(this.ruleset.meta) {
- this.ruleset.meta["urn:openremote:rule:meta:validity"].start = moment.utc();
- this.ruleset.meta["urn:openremote:rule:meta:validity"].end = moment.utc().add(1, 'hour');
+ this.ruleset.meta["urn:openremote:rule:meta:validity"].start = moment();
+ this.ruleset.meta["urn:openremote:rule:meta:validity"].end = moment().add(1, 'hour');
}
}
break;
case "start":
if(this.ruleset.meta)
- this.ruleset.meta["urn:openremote:rule:meta:validity"]['start'] = moment.utc(value).set({hour:0,minute:0,second:0,millisecond:0}).format();
+ this.ruleset.meta["urn:openremote:rule:meta:validity"]['start'] = moment(value).set({hour:0,minute:0,second:0,millisecond:0}).format();
if(this.getValidityType() === "validityRecurrence")
- origOptions[key] = moment.utc(value).format();
+ origOptions[key] = moment(value).format();
this.rrule = new RRule(origOptions);
break;
case "end":
if(this.ruleset.meta)
- this.ruleset.meta["urn:openremote:rule:meta:validity"]['end'] = moment.utc(value).set({hour:23,minute:59,second:0,millisecond:0}).format();
+ this.ruleset.meta["urn:openremote:rule:meta:validity"]['end'] = moment(value).set({hour:23,minute:59,second:0,millisecond:0}).format();
break;
case "never-ends":
if(value) {
delete origOptions.until
} else {
- origOptions.until = new Date(moment.utc().add(1, 'year').format());
+ origOptions.until = new Date(moment().add(1, 'year').format());
}
if(this.getValidityType() === "validityRecurrence") this.rrule = new RRule(origOptions);
break;
@@ -121,23 +130,27 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
}
if(this.getValidityType() === "validityRecurrence") this.rrule = new RRule(origOptions);
break;
- case "dtstart":
case "until":
+ if(this.rrule.options.until) {
+ const newDate = moment(value)
+ origOptions["until"] = new Date(moment(origOptions["until"]).set({year: newDate.year(), month: newDate.month(), date: newDate.date()}).format())
+ }
+ if(this.getValidityType() === "validityRecurrence") this.rrule = new RRule(origOptions);
break;
case "dtstart-time":
const timeParts = value.split(':');
- origOptions["dtstart"] = moment.utc(origOptions["dtstart"]).set({hour:timeParts[0],minute:timeParts[1],second:0,millisecond:0}).format()
+ origOptions["dtstart"] = moment(origOptions["dtstart"]).set({hour:timeParts[0],minute:timeParts[1],second:0,millisecond:0}).format()
if(this.ruleset.meta)
- this.ruleset.meta["urn:openremote:rule:meta:validity"].start = moment.utc(origOptions["dtstart"]).format();
+ this.ruleset.meta["urn:openremote:rule:meta:validity"].start = moment(origOptions["dtstart"]).format();
if(this.getValidityType() === "validityRecurrence") this.rrule = new RRule(origOptions);
break;
case "until-time":
const untilParts = value.split(':');
if(this.rrule.options.until) {
- origOptions["until"] = moment.utc(origOptions["until"]).set({hour:untilParts[0],minute:untilParts[1],second:0,millisecond:0}).format()
+ origOptions["until"] = moment(origOptions["until"]).set({hour:untilParts[0],minute:untilParts[1],second:0,millisecond:0}).format()
}
if(this.ruleset.meta)
- this.ruleset.meta["urn:openremote:rule:meta:validity"].end = moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).set({hour:untilParts[0],minute:untilParts[1],second:0,millisecond:0}).format();
+ this.ruleset.meta["urn:openremote:rule:meta:validity"].end = moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).set({hour:untilParts[0],minute:untilParts[1],second:0,millisecond:0}).format();
if(this.getValidityType() === "validityRecurrence") this.rrule = new RRule(origOptions);
break;
}
@@ -152,17 +165,17 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
const diff = moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).diff(this.ruleset.meta["urn:openremote:rule:meta:validity"].start, 'days');
let diffString = "";
if(this.isAllDay()) {
- if(diff > 0) diffString = " "+diff+ " " + i18next.t("days") + " " + i18next.t("later")+ " ";
+ if(diff > 0) diffString = " "+i18next.t('forDays', {days: diff});
return this.rrule.toText()+diffString;
} else {
- if(diff > 0) diffString = i18next.t("fromToDays", {start: moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).format("HH:mm"), end: moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).format("HH:mm"), days: diff })
- if(diff === 0) diffString = i18next.t("fromTo", {start: moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).format("HH:mm"), end: moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).format("HH:mm") })
+ if(diff > 0) diffString = i18next.t("fromToDays", {start: moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).format("HH:mm"), end: moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).format("HH:mm"), days: diff })
+ if(diff === 0) diffString = i18next.t("fromTo", {start: moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).format("HH:mm"), end: moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).format("HH:mm") })
return this.rrule.toText()+" "+diffString;
}
} else if(this.ruleset && this.ruleset.meta && this.ruleset.meta["urn:openremote:rule:meta:validity"]){
let format = "DD-MM-YYYY";
if(!this.isAllDay()) format = "DD-MM-YYYY HH:mm";
- return i18next.t("activeFromTo", {start: moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).format(format), end: moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).format(format) })
+ return i18next.t("activeFromTo", {start: moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).format(format), end: moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).format(format) })
}
}
@@ -174,14 +187,14 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
break;
case "validityPeriod":
this.ruleset.meta["urn:openremote:rule:meta:validity"] = {
- start: moment.utc().startOf('day'),
- end:moment.utc().endOf('day')
+ start: moment().startOf('day'),
+ end:moment().endOf('day')
};
break;
case "validityRecurrence":
this.ruleset.meta["urn:openremote:rule:meta:validity"] = {
- start: moment.utc().startOf('day'),
- end:moment.utc().endOf('day'),
+ start: moment().startOf('day'),
+ end:moment().endOf('day'),
recurrence: {}
};
break;
@@ -216,14 +229,16 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
</div>
${(validityType === "validityPeriod" || validityType === "validityRecurrence") ? html`
- <label style="display:block; margin-top: 10px;">Period</label>
- <div class="layout horizontal">
- <or-input value="${moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "start")}" .label="${i18next.t("from")}"></or-input>
- <or-input .disabled=${this.isAllDay()} .value="${moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).format("HH:mm")}" .type="${InputType.TIME}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "dtstart-time")}" .label="${i18next.t("from")}"></or-input>
-
- <or-input .value="${moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "end")}" .label="${i18next.t("to")}"></or-input>
-
- <or-input .disabled=${this.isAllDay()} .value="${moment.utc(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).format("HH:mm")}" .type="${InputType.TIME}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "until-time")}" .label="${i18next.t("to")}"></or-input>
+ <label style="display:block; margin-top: 20px;">Period</label>
+ <div style="display: flex; justify-content: space-between;" class="layout horizontal">
+ <div>
+ <or-input value="${moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "start")}" .label="${i18next.t("from")}"></or-input>
+ <or-input .disabled=${this.isAllDay()} .value="${moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).format("HH:mm")}" .type="${InputType.TIME}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "dtstart-time")}" .label="${i18next.t("from")}"></or-input>
+ </div>
+ <div>
+ <or-input .value="${moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "end")}" .label="${i18next.t("to")}"></or-input>
+ <or-input .disabled=${this.isAllDay()} .value="${moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).format("HH:mm")}" .type="${InputType.TIME}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "until-time")}" .label="${i18next.t("to")}"></or-input>
+ </div>
</div>
<div class="layout horizontal">
@@ -232,17 +247,17 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
` : ``}
${validityType === "validityRecurrence" ? html`
- <label style="display:block; margin-top: 10px;">Repeat occurence every</label>
+ <label style="display:block; margin-top: 20px;">Repeat occurence every</label>
<div class="layout horizontal">
<or-input .value="${selectedOptions}" .type="${InputType.CHECKBOX_LIST}" .options="${options}" .label="${i18next.t("days of the week")}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "byweekday")}" ></or-input>
</div>
- <label style="display:block; margin-top: 10px;">Repetition ends</label>
+ <label style="display:block; margin-top: 20px;">Repetition ends</label>
<div class="layout horizontal">
<or-input .value="${!this.rrule.options.until}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "never-ends")}" .type="${InputType.CHECKBOX}" .label="${i18next.t("never")}"></or-input>
</div>
<div class="layout horizontal">
- <or-input ?disabled="${!this.rrule.options.until}" .value="${this.rrule.options.until ? moment.utc(this.rrule.options.until).format("YYYY-MM-DD") : moment.utc().add(1, 'year').format('YYYY-MM-DD')}" .type="${InputType.DATE}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "until")}" .label="${i18next.t("to")}"></or-input>
+ <or-input ?disabled="${!this.rrule.options.until}" .value="${this.rrule.options.until ? moment(this.rrule.options.until).format("YYYY-MM-DD") : moment().add(1, 'year').format('YYYY-MM-DD')}" .type="${InputType.DATE}" @or-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "until")}" .label="${i18next.t("to")}"></or-input>
</div>
` : ``}
@@ -276,10 +291,11 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
this.ruleset.meta["urn:openremote:rule:meta:validity"].recurrence = this.rrule.toString().split("RRULE:")[1]
}
if(this.getValidityType() === "validityPeriod" || this.getValidityType() === "validityRecurrence") {
- this.ruleset.meta["urn:openremote:rule:meta:validity"].start = moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).valueOf()
- this.ruleset.meta["urn:openremote:rule:meta:validity"].end = moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).valueOf()
+ this.ruleset.meta["urn:openremote:rule:meta:validity"].start = moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].start).unix()*1000
+ this.ruleset.meta["urn:openremote:rule:meta:validity"].end = moment(this.ruleset.meta["urn:openremote:rule:meta:validity"].end).unix()*1000
}
this.dispatchEvent(new OrRulesRuleChangedEvent(true));
+ this.requestUpdate('ruleset')
}
}
},
@@ -291,7 +307,6 @@ export class OrRuleValidity extends translate(i18next)(LitElement) {
if (dialog) {
dialog.open();
this.renderDialogHTML();
-
}
};
diff --git a/ui/component/or-rules/src/or-rule-viewer.ts b/ui/component/or-rules/src/or-rule-viewer.ts
index ce33325ef..ac3942eea 100644
--- a/ui/component/or-rules/src/or-rule-viewer.ts
+++ b/ui/component/or-rules/src/or-rule-viewer.ts
@@ -55,7 +55,7 @@ export const style = css`
box-sizing: border-box;
min-height: var(--internal-or-rules-header-height);
height: var(--internal-or-rules-header-height);
- z-index: 2;
+ z-index: 9;
padding: 15px 20px;
--or-icon-fill: var(--internal-or-rules-panel-color);
}