100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Enforce url in push notification, update styling
Robin Dekkersaef5e1c15661
diff --git a/ui/app/or-app/src/pages/page-mobile-geofences.ts b/ui/app/or-app/src/pages/page-mobile-geofences.tsindex 5a259e049..2728d2f14 100644--- a/ui/app/or-app/src/pages/page-mobile-geofences.ts+++ b/ui/app/or-app/src/pages/page-mobile-geofences.ts@@ -61,12 +61,13 @@ class PageMobileGeofences<S extends AppStateKeyed> extends Page<S> {}.list-container {- width: 100vw;+ width: 100%;height: 100vh;}.list-item {display: flex;+ min-height: 45px;flex-direction: row;text-decoration: none;padding: 20px;diff --git a/ui/component/or-rules/src/json-viewer/forms/or-rule-form-push-notification.ts b/ui/component/or-rules/src/json-viewer/forms/or-rule-form-push-notification.tsindex 6108d49b4..158adfd23 100644--- a/ui/component/or-rules/src/json-viewer/forms/or-rule-form-push-notification.ts+++ b/ui/component/or-rules/src/json-viewer/forms/or-rule-form-push-notification.ts@@ -33,9 +33,8 @@ export class OrRuleFormPushNotification extends translate(i18next)(LitElement) {const title = message && message.title ? message.title : "";const body = message && message.body ? message.body : "";const action = message && message.action ? message.action : "";- const actionUrl = action ? action.url : "";+ const actionUrl = action && action.url ? action.url : "";const buttons = message && message.buttons ? message.buttons : [];-return html`<form style="display:grid"><or-input value="${title}"@@ -58,11 +57,10 @@ export class OrRuleFormPushNotification extends translate(i18next)(LitElement) {requiredplaceholder=" "></or-input>- <or-input .value="${action && action.openInBrowser}"+ <or-input .value="${action && typeof action.openInBrowser !== "undefined" ? (action && action.openInBrowser) : true}"@or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "action.openInBrowser")}".label="${i18next.t("openInBrowser")}"type="${InputType.SWITCH}"- requiredplaceholder=" "></or-input><or-input value="${buttons && buttons[0] && buttons[0].title ? buttons[0].title : ""}"@@ -75,7 +73,6 @@ export class OrRuleFormPushNotification extends translate(i18next)(LitElement) {@or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "buttons.1.title")}".label="${i18next.t("buttonTextDecline")}"type="${InputType.TEXT}"- requiredplaceholder=" "></or-input></form>`diff --git a/ui/component/or-rules/src/json-viewer/modals/or-rule-notification-modal.ts b/ui/component/or-rules/src/json-viewer/modals/or-rule-notification-modal.tsindex 9edd68a21..9514047bf 100644--- a/ui/component/or-rules/src/json-viewer/modals/or-rule-notification-modal.ts+++ b/ui/component/or-rules/src/json-viewer/modals/or-rule-notification-modal.ts@@ -56,6 +56,41 @@ export class OrRuleNotificationModal extends translate(i18next)(LitElement) {}}+ checkForm() {+ const dialog: OrMwcDialog = this.shadowRoot!.host as OrMwcDialog;+ if (this.shadowRoot && this.shadowRoot.querySelector('or-rule-form-push-notification')) {+ const pushNotification = this.shadowRoot.querySelector('or-rule-form-push-notification');+ if(pushNotification && pushNotification.shadowRoot) {+ const form = pushNotification.shadowRoot.querySelector('form')+ if(form) {+ const inputs = form.querySelectorAll('or-input')+ const elements = Array.prototype.slice.call(inputs);++ const valid = elements.every((element) => {+ if(element.shadowRoot) {+ const input = element.shadowRoot.querySelector('input, textarea, select') as any++ if(input && input.checkValidity()) {+ return true+ } else {+ element._mdcComponent.valid = false;+ element._mdcComponent.helperTextContent = 'required';++ return false;+ }+ } else {+ return false;+ }+ })+ if(valid) {+ dialog.close();+ }+ }++ }+ }+ }+protected render() {if(!this.action) return html``;@@ -68,42 +103,8 @@ export class OrRuleNotificationModal extends translate(i18next)(LitElement) {}},{- actionName: "none",- content: html`<or-input class="button" .type="${InputType.BUTTON}" .label="${i18next.t("ok")}"></or-input>`,- action: (dialog) => {- dialog.open()- if (dialog.shadowRoot && dialog.shadowRoot.querySelector('or-rule-form-push-notification')) {- const pushNotification = dialog.shadowRoot.querySelector('or-rule-form-push-notification');- if(pushNotification && pushNotification.shadowRoot) {- const form = pushNotification.shadowRoot.querySelector('form')- if(form) {- const inputs = form.querySelectorAll('or-input')- const elements = Array.prototype.slice.call(inputs);-- const valid = elements.every((element) => {- if(element.shadowRoot) {- const input = element.shadowRoot.querySelector('input, textarea, select') as any-- if(input && input.checkValidity()) {- return true- } else {- element._mdcComponent.valid = false;- element._mdcComponent.helperTextContent = 'required';- return false;- }- } else {- return false;- }- })- if(valid) {- dialog.close()- } else {- }- }-- }- }- }+ actionName: "",+ content: html`<or-input class="button" .type="${InputType.BUTTON}" .label="${i18next.t("ok")}" @click="${this.checkForm}"></or-input>`}];