Skip to content

armgit / core

Public Imported from GitHub
0

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

Add wip for push notification in rules editor

Robin Dekkersca89e36337da
diff --git a/profile/dev-testing.yml b/profile/dev-testing.yml
index ddfc28371..437ad4cf6 100644
--- a/profile/dev-testing.yml
+++ b/profile/dev-testing.yml
@@ -16,7 +16,7 @@ services:
file: deploy.yml
service: keycloak
volumes:
- - ../ui/keycloak/themes:/deployment/keycloak/themes
+ - ../../deployment/build/keycloak/themes:/deployment/keycloak/themes
# Access directly if needed on localhost
ports:
- "8081:8080"
diff --git a/ui/component/or-mwc-components/src/or-mwc-dialog.ts b/ui/component/or-mwc-components/src/or-mwc-dialog.ts
index c77f90318..a53038095 100644
--- a/ui/component/or-mwc-components/src/or-mwc-dialog.ts
+++ b/ui/component/or-mwc-components/src/or-mwc-dialog.ts
@@ -119,7 +119,7 @@ export class OrMwcDialog extends LitElement {
<div class="mdc-dialog__surface">
<h2 class="mdc-dialog__title" id="dialog-title"><or-translate value="${this.dialogTitle}"></or-translate></h2>
<div class="dialog-container mdc-dialog__content" id="dialog-content">
- ${this.dialogContent ? this.dialogContent : html`<div></div>`}
+ ${this.dialogContent ? this.dialogContent : html`<slot></slot>`}
</div>
<footer class="mdc-dialog__actions">
${this.dialogActions ? this.dialogActions.map((action) => {
diff --git a/ui/component/or-rules/package.json b/ui/component/or-rules/package.json
index 4f75a3da0..22d023530 100644
--- a/ui/component/or-rules/package.json
+++ b/ui/component/or-rules/package.json
@@ -14,6 +14,7 @@
"dependencies": {
"@openremote/core": "^1.1.0",
"@openremote/model": "^1.1.0",
+ "@openremote/or-map": "^1.1.0",
"@openremote/or-asset-viewer": "^1.1.0",
"@openremote/or-attribute-input": "^1.1.0",
"@openremote/or-icon": "^1.1.0",
diff --git a/ui/component/or-rules/src/json-viewer/forms/or-rule-form-message.ts b/ui/component/or-rules/src/json-viewer/forms/or-rule-form-message.ts
new file mode 100644
index 000000000..699fe049e
--- /dev/null
+++ b/ui/component/or-rules/src/json-viewer/forms/or-rule-form-message.ts
@@ -0,0 +1,51 @@
+import {customElement, html, LitElement, css, property} from "lit-element";
+import "@openremote/or-input";
+import i18next from "i18next";
+import {translate} from "@openremote/or-translate";
+import "@openremote/or-input";
+import {InputType, OrInputChangedEvent} from "@openremote/or-input";import {
+ RuleActionNotification,
+ EmailNotificationMessageRecipient,
+ EmailNotificationMessage,
+ PushNotificationMessage,
+ AbstractNotificationMessageUnion
+} from "@openremote/model";
+import { OrRulesJsonRuleChangedEvent } from "../or-rule-json-viewer";
+
+@customElement("or-rule-form-message")
+export class OrRuleFormMessage extends translate(i18next)(LitElement) {
+
+ @property({type: Object, attribute: false})
+ public action!: RuleActionNotification;
+
+
+ static get styles() {
+ return css`
+ or-input {
+ margin-bottom: 20px;
+ }
+ `
+ }
+
+ protected render() {
+ const message:EmailNotificationMessage | undefined = this.action.notification!.message;
+
+ return html`
+ <div style="display:grid">
+ <or-input value="${message && message.subject ? message.subject : ""}" @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "subject")}" .label="${i18next.t("title")}" type="${InputType.TEXT}" required placeholder=" "></or-input>
+ <or-input value="${message && message.html ? message.html : ""}" @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "html")}" .label="${i18next.t("message")}" type="${InputType.TEXTAREA}" required placeholder=" " ></or-input>
+ </div>
+ `
+ }
+
+ protected setActionNotificationName(value: string | undefined, key?: string) {
+ if(key && this.action.notification && this.action.notification.message){
+ const message:any = this.action.notification.message;
+ message[key] = value;
+ this.action.notification.message = {...message};
+ }
+
+ this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
+ this.requestUpdate();
+ }
+}
\ No newline at end of file
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.ts
new file mode 100644
index 000000000..3be772dfd
--- /dev/null
+++ b/ui/component/or-rules/src/json-viewer/forms/or-rule-form-push-notification.ts
@@ -0,0 +1,95 @@
+import {customElement, html, LitElement, css, property} from "lit-element";
+import "@openremote/or-input";
+import i18next from "i18next";
+import {translate} from "@openremote/or-translate";
+import "@openremote/or-input";
+import {InputType, OrInputChangedEvent} from "@openremote/or-input";
+import {
+ RuleActionNotification,
+ PushNotificationMessage
+} from "@openremote/model";
+import { OrRulesJsonRuleChangedEvent } from "../or-rule-json-viewer";
+import set from "lodash-es/set";
+
+@customElement("or-rule-form-push-notification")
+export class OrRuleFormPushNotification extends translate(i18next)(LitElement) {
+
+ @property({type: Object, attribute: false})
+ public action!: RuleActionNotification;
+
+
+ static get styles() {
+ return css`
+ or-input {
+ margin-bottom: 20px;
+ }
+ `
+ }
+
+ protected render() {
+ const message:PushNotificationMessage | undefined = this.action.notification!.message;
+ 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 buttons = message && message.buttons ? message.buttons : [];
+
+ return html`
+ <div style="display:grid">
+ <or-input value="${title}"
+ @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "title")}"
+ .label="${i18next.t("title")}"
+ type="${InputType.TEXT}"
+ required
+ placeholder=" "></or-input>
+
+ <or-input value="${body}"
+ @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "body")}"
+ .label="${i18next.t("message")}"
+ type="${InputType.TEXT}"
+ required
+ placeholder=" " ></or-input>
+
+ <or-input value="${actionUrl}"
+ @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "action.url")}"
+ .label="${i18next.t("Te openen website adres")}"
+ type="${InputType.TEXT}"
+ required
+ placeholder=" "></or-input>
+
+ <or-input value="${buttons && buttons[0] && buttons[0].action?.openInBrowser ? buttons[0].action?.openInBrowser : ""}"
+ @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "buttons.0.action.openInBrowser")}"
+ .label="${i18next.t("Open in externe website")}"
+ type="${InputType.SWITCH}"
+ required
+ placeholder=" "></or-input>
+
+ <or-input value="${buttons && buttons[0] && buttons[0].title ? buttons[0].title : ""}"
+ @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "buttons.0.title")}"
+ .label="${i18next.t("Tekst voor actie knop")}"
+ type="${InputType.TEXT}"
+ required
+ placeholder=" "></or-input>
+ <or-input value="${buttons && buttons[1] && buttons[1].title ? buttons[1].title : ""}"
+ @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value, "buttons.1.title")}"
+ .label="${i18next.t("Tekst voor negeerknop")}"
+ type="${InputType.TEXT}"
+ required
+ placeholder=" "></or-input>
+ </div>
+ `
+ }
+
+
+
+ protected setActionNotificationName(value: string | undefined, key?: string) {
+ if(key && this.action.notification && this.action.notification.message){
+ let message:any = this.action.notification.message;
+ message = set(message, key, value);
+ this.action.notification.message = {...message};
+ }
+
+ this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
+ this.requestUpdate();
+ }
+}
\ No newline at end of file
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.ts
new file mode 100644
index 000000000..900f6132a
--- /dev/null
+++ b/ui/component/or-rules/src/json-viewer/modals/or-rule-notification-modal.ts
@@ -0,0 +1,95 @@
+import {css, customElement, html, LitElement, property, PropertyValues} from "lit-element";
+import {
+ Asset,
+ AssetDescriptor,
+ AssetQueryMatch,
+ AssetQueryOperator as AQO,
+ RuleActionNotification,
+ AssetQuery,
+ RadialGeofencePredicate
+} from "@openremote/model";
+import {
+ AssetQueryOperator,
+ AssetTypeAttributeName,
+ getAssetIdsFromQuery,
+ getAssetTypeFromQuery,
+ RulesConfig
+} from "../../index";
+import {OrSelectChangedEvent} from "@openremote/or-select";
+import "@openremote/or-input";
+import {InputType, OrInputChangedEvent} from "@openremote/or-input";
+import {getAttributeValueTemplate} from "@openremote/or-attribute-input";
+import manager, {AssetModelUtil, Util} from "@openremote/core";
+import i18next from "i18next";
+import {OrRulesJsonRuleChangedEvent} from "../or-rule-json-viewer";
+import {translate} from "@openremote/or-translate";
+
+import {DialogAction, OrMwcDialog, OrMwcDialogOpenedEvent} from "@openremote/or-mwc-components/dist/or-mwc-dialog";
+import {OrMap, OrMapClickedEvent} from '@openremote/or-map';
+import '@openremote/or-map/dist/markers/or-map-marker';
+
+@customElement("or-rule-notification-modal")
+export class OrRuleNotificationModal extends translate(i18next)(LitElement) {
+
+ @property({type: Object, attribute: false})
+ public action!: RuleActionNotification;
+
+
+ @property({type: Object})
+ public query?: AssetQuery;
+
+ constructor() {
+ super();
+ this.addEventListener(OrMwcDialogOpenedEvent.NAME, this.initDialog)
+ }
+
+ initDialog() {
+ const modal = this.shadowRoot!.getElementById('notification-modal');
+ if(!modal) return;
+ }
+
+ renderDialogHTML(action:RuleActionNotification) {
+ const dialog: OrMwcDialog = this.shadowRoot!.getElementById("notification-modal") as OrMwcDialog;
+ const slot = this.shadowRoot?.getElementById('notification-form-slot');
+ if (dialog) {
+ dialog.dialogContent = html`${slot}`;
+ }
+ }
+
+ protected render() {
+ if(!this.action) return html``;
+
+
+ const notificationPickerModalActions: DialogAction[] = [
+ {
+ actionName: "ok",
+ default: true,
+ content: html`<or-input class="button" .type="${InputType.BUTTON}" .label="${i18next.t("ok")}"></or-input>`,
+ action: () => {
+ }
+ },
+ {
+ actionName: "cancel",
+ content: html`<or-input class="button" .type="${InputType.BUTTON}" .label="${i18next.t("cancel")}"></or-input>`,
+ action: () => {
+ // Nothing to do here
+ }
+ },
+ ];
+
+
+ const notificationPickerModalOpen = () => {
+ const dialog: OrMwcDialog = this.shadowRoot!.getElementById("notification-modal") as OrMwcDialog;
+ if (dialog) {
+ dialog.open();
+ }
+ };
+
+ return html`
+ <or-input .type="${InputType.BUTTON}" .label="${i18next.t("message")}" @click="${notificationPickerModalOpen}"></or-input>
+ <or-mwc-dialog id="notification-modal" dialogTitle="message" .dialogActions="${notificationPickerModalActions}">
+ <slot id="notification-form-slot"></slot>
+ </or-mwc-dialog>
+ `
+ }
+}
\ No newline at end of file
diff --git a/ui/component/or-rules/src/json-viewer/modals/or-rule-radial-modal.ts b/ui/component/or-rules/src/json-viewer/modals/or-rule-radial-modal.ts
new file mode 100644
index 000000000..ea3d32c5a
--- /dev/null
+++ b/ui/component/or-rules/src/json-viewer/modals/or-rule-radial-modal.ts
@@ -0,0 +1,174 @@
+import {css, customElement, html, LitElement, property, PropertyValues} from "lit-element";
+import {
+ Asset,
+ AssetDescriptor,
+ AssetQueryMatch,
+ AssetQueryOperator as AQO,
+ AssetQueryOrderBy$Property,
+ Attribute,
+ AttributeDescriptor,
+ AttributePredicate,
+ AttributeValueDescriptor,
+ AttributeValueType,
+ LogicGroup,
+ LogicGroupOperator,
+ MetaItemType,
+ RuleCondition,
+ ValuePredicateUnion,
+ ValueType,
+ AssetQuery,
+ RadialGeofencePredicate
+} from "@openremote/model";
+import {
+ AssetQueryOperator,
+ AssetTypeAttributeName,
+ getAssetIdsFromQuery,
+ getAssetTypeFromQuery,
+ RulesConfig
+} from "../../index";
+import {OrSelectChangedEvent} from "@openremote/or-select";
+import "@openremote/or-input";
+import {InputType, OrInputChangedEvent} from "@openremote/or-input";
+import {getAttributeValueTemplate} from "@openremote/or-attribute-input";
+import manager, {AssetModelUtil, Util} from "@openremote/core";
+import i18next from "i18next";
+import {OrRulesJsonRuleChangedEvent} from "../or-rule-json-viewer";
+import {translate} from "@openremote/or-translate";
+
+import {DialogAction, OrMwcDialog, OrMwcDialogOpenedEvent} from "@openremote/or-mwc-components/dist/or-mwc-dialog";
+import {OrMap, OrMapClickedEvent} from '@openremote/or-map';
+import '@openremote/or-map/dist/markers/or-map-marker';
+
+@customElement("or-rule-radial-modal")
+export class OrRuleRadialModal extends translate(i18next)(LitElement) {
+
+ @property({type: Object})
+ public assetDescriptor?: AssetDescriptor;
+
+ @property({type: Object})
+ public attributePredicate?: AttributePredicate;
+
+
+ @property({type: Object})
+ public query?: AssetQuery;
+
+ constructor() {
+ super();
+ this.addEventListener(OrMwcDialogOpenedEvent.NAME, this.initRadialMap)
+ }
+
+ initRadialMap() {
+ const modal = this.shadowRoot!.getElementById('radial-modal');
+ if(!modal) return;
+
+ const map = modal.shadowRoot!.querySelector('.or-map') as OrMap;
+ if(map){
+ map.addEventListener(OrMapClickedEvent.NAME, (evt: CustomEvent) => {
+ const lngLat:any = evt.detail.lngLat;
+ const latElement = (<HTMLInputElement>modal.shadowRoot!.querySelector('.location-lat'));
+ const lngElement = (<HTMLInputElement>modal.shadowRoot!.querySelector('.location-lng'));
+ latElement.value = lngLat.lat;
+ lngElement.value = lngLat.lng;
+
+ const event = new Event('change');
+ latElement.dispatchEvent(event);
+ lngElement.dispatchEvent(event);
+ this.setValuePredicateProperty('lat', lngLat.lat);
+ this.setValuePredicateProperty('lng', lngLat.lng);
+ });
+ }
+ }
+
+ protected getAttributeName(attributePredicate: AttributePredicate): string | undefined {
+ return attributePredicate && attributePredicate.name ? attributePredicate.name.value : undefined;
+ }
+
+ protected setValuePredicateProperty(propertyName: string, value: any) {
+ if(!this.attributePredicate) return;
+ if(!this.attributePredicate.value) return;
+
+ const valuePredicate = this.attributePredicate.value;
+
+ (valuePredicate as any)[propertyName] = value;
+ this.attributePredicate = {...this.attributePredicate};
+ this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
+ this.requestUpdate();
+ }
+
+ renderDialogHTML(value:RadialGeofencePredicate) {
+ const dialog: OrMwcDialog = this.shadowRoot!.getElementById("radial-modal") as OrMwcDialog;
+ if (dialog) {
+ dialog.dialogContent = html`
+ <div style="display:grid">
+ <or-map class="or-map" type="VECTOR" style="border: 1px solid #d5d5d5; height: 400px; min-width: 300px;">
+ <or-map-marker active color="#FF0000" icon="information" lat="${value.lat}" lng="${value.lng}" radius="${value.radius}"></or-map-marker>
+ </or-map>
+
+ <div class="layout horizontal">
+ <div style="margin-right: 10px;" class="layout vertical flex-grow">
+ <label>Breedtegraad</label>
+ <input class="location-lng" required placeholder=" " type="text" .value="${value && value.lng ? value.lng : null}" />
+ </div>
+
+ <div style="margin-left: 10px;" class="layout vertical flex-grow">
+ <label>Lengtegraad</label>
+ <input class="location-lat" required placeholder=" " type="text" .value="${value && value.lat ? value.lat : null}" />
+ </div>
+ </div>
+
+
+ <label>Straal (minimaal 100m)</label>
+ <input @change="${(e:any) => this.setValuePredicateProperty("radius", parseInt(e.target.value))}" style="max-width: calc(50% - 30px);" required placeholder=" " min="50" type="number" .value="${value && value.radius ? value.radius : null}" />
+
+ </div>`;
+ }
+ }
+
+ protected render() {
+ if(!this.attributePredicate) return html``;
+ if(!this.query) return html``;
+
+ const valuePredicate = this.attributePredicate.value;
+ if (!this.assetDescriptor || !valuePredicate) {
+ return html``;
+ }
+
+ const attributeName = this.getAttributeName(this.attributePredicate);
+ const assetType = getAssetTypeFromQuery(this.query);
+ // @ts-ignore
+ const value:RadialGeofencePredicate = valuePredicate ? valuePredicate : undefined;
+
+ const radiusPickerModalActions: DialogAction[] = [
+ {
+ actionName: "ok",
+ default: true,
+ content: html`<or-input class="button" .type="${InputType.BUTTON}" .label="${i18next.t("ok")}"></or-input>`,
+ action: () => {
+ }
+ },
+ {
+ actionName: "cancel",
+ content: html`<or-input class="button" .type="${InputType.BUTTON}" .label="${i18next.t("cancel")}"></or-input>`,
+ action: () => {
+ // Nothing to do here
+ }
+ },
+ ];
+
+
+ const radialPickerModalOpen = () => {
+ const dialog: OrMwcDialog = this.shadowRoot!.getElementById("radial-modal") as OrMwcDialog;
+ if (dialog) {
+ dialog.open();
+ this.renderDialogHTML(value);
+ }
+ };
+
+ this.renderDialogHTML(value);
+
+ return html`
+ <or-input .type="${InputType.BUTTON}" .label="${i18next.t("area")}" @click="${radialPickerModalOpen}"></or-input>
+ <or-mwc-dialog id="radial-modal" dialogTitle="area" .dialogActions="${radiusPickerModalActions}"></or-mwc-dialog>
+ `
+ }
+}
\ No newline at end of file
diff --git a/ui/component/or-rules/src/json-viewer/or-rule-action-notification.ts b/ui/component/or-rules/src/json-viewer/or-rule-action-notification.ts
index c0c0e2674..da4e14a3a 100644
--- a/ui/component/or-rules/src/json-viewer/or-rule-action-notification.ts
+++ b/ui/component/or-rules/src/json-viewer/or-rule-action-notification.ts
@@ -1,12 +1,19 @@
-import {customElement, html, LitElement, property, css} from "lit-element";
+import {customElement, html, LitElement, property, css, TemplateResult} from "lit-element";
import {RulesConfig} from "../index";
import {
RuleActionNotification,
EmailNotificationMessageRecipient,
- EmailNotificationMessage
+ EmailNotificationMessage,
+ PushNotificationMessageTargetType,
+ PushNotificationMessage,
+ AbstractNotificationMessageUnion
} from "@openremote/model";
import {InputType, OrInputChangedEvent} from "@openremote/or-input";
import {OrRulesJsonRuleChangedEvent} from "./or-rule-json-viewer";
+import "./modals/or-rule-notification-modal";
+import "./forms/or-rule-form-message";
+import "./forms/or-rule-form-push-notification";
+import { i18next } from "@openremote/or-translate";
// language=CSS
const style = css`
@@ -19,7 +26,8 @@ const style = css`
margin-right: 10px;
}
`;
-
+const NOTIFICATION_OPTIONS = [["email", "Email"], ["push-notification", "Push notification"]];
+const PUSH_NOTIFICATION_OPTIONS = [[PushNotificationMessageTargetType.DEVICE, "Device"], [PushNotificationMessageTargetType.TOPIC, "Topic"], [PushNotificationMessageTargetType.CONDITION, "Condition"]];
@customElement("or-rule-action-notification")
export class OrRuleActionNotification extends LitElement {
@@ -38,30 +46,78 @@ export class OrRuleActionNotification extends LitElement {
protected render() {
let value: string = "";
- if(this.action.notification && this.action.notification.message ){
- const message:EmailNotificationMessage = this.action.notification.message;
- if(message.to) {
- value = message.to.map(t => t.address).join(';');
+ const message = this.action.notification && this.action.notification.message ? this.action.notification.message : undefined;
+ const type = message && message.type ? message.type : undefined;
+
+ const typeSelector = html`
+ <or-input .type="${InputType.SELECT}"
+ .options="${NOTIFICATION_OPTIONS}"
+ label="${i18next.t("type")}"
+ value="${type}"
+ @or-input-changed="${(e: OrInputChangedEvent) => this.setNotificationType(e.detail.value)}"
+ ?readonly="${this.readonly}"></or-input>
+ `;
+ let typeTemplate;
+
+ if(message) {
+ if(type === "push-notification") {
+ typeTemplate = html`
+ <or-input type="${InputType.SELECT}"
+ .options="${PUSH_NOTIFICATION_OPTIONS}"
+ @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value)}"
+ ?readonly="${this.readonly}"></or-input>
+
+ <or-rule-notification-modal .action="${this.action}">
+ <or-rule-form-push-notification .action="${this.action}"></or-rule-form-push-notification>
+ </or-rule-notification-modal>
+ `;
+ }
+
+ if(type === "email") {
+ const emailMessage:EmailNotificationMessage = message;
+ value = message && emailMessage.to ? emailMessage.to.map(t => t.address).join(';') : "";
+ typeTemplate = html`
+ <or-input .type="${InputType.TEXT}" @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value)}" ?readonly="${this.readonly}" .value="${value}" ></or-input>
+
+ <or-rule-notification-modal .action="${this.action}">
+ <or-rule-form-message .action="${this.action}"></or-rule-form-message>
+ </or-rule-notification-modal>
+ `;
}
}
return html`
- <or-input .type="${InputType.TEXT}" @or-input-changed="${(e: OrInputChangedEvent) => this.setActionNotificationName(e.detail.value)}" ?readonly="${this.readonly}" .value="${value}" ></or-input>
+ ${typeSelector}
+ ${typeTemplate}
`;
-
-
}
+ protected setNotificationType(type: string | undefined) {
+ switch (type) {
+ case "email":
+ this.action.notification = {
+ message: {
+ type: "email",
+ subject: "%RULESET_NAME%",
+ html: "%TRIGGER_ASSETS%",
+ from: {address:"[email protected]"},
+ to: []
+ }
+ };
+ break;
+ case "push-notification":
+ this.action.notification = {
+ message: {
+ type: "push-notification"
+ }
+ };
+ break;
+ }
+ this.requestUpdate();
+ }
+
protected setActionNotificationName(emails: string | undefined) {
- this.action.notification = {
- message: {
- type: "email",
- subject: "%RULESET_NAME%",
- html: "%TRIGGER_ASSETS%",
- from: {address:"[email protected]"},
- to: []
- }
- };
+
if(emails && this.action.notification && this.action.notification.message){
diff --git a/ui/component/or-rules/src/json-viewer/or-rule-asset-query.ts b/ui/component/or-rules/src/json-viewer/or-rule-asset-query.ts
index 85e8a0f58..ad4775ec1 100644
--- a/ui/component/or-rules/src/json-viewer/or-rule-asset-query.ts
+++ b/ui/component/or-rules/src/json-viewer/or-rule-asset-query.ts
@@ -32,8 +32,12 @@ import manager, {AssetModelUtil, Util} from "@openremote/core";
import i18next from "i18next";
import {buttonStyle} from "../style";
import {OrRulesJsonRuleChangedEvent} from "./or-rule-json-viewer";
+import "./or-rule-radial-modal";
import {translate} from "@openremote/or-translate";
+import {DialogAction, OrMwcDialog, OrMwcDialogOpenedEvent} from "@openremote/or-mwc-components/dist/or-mwc-dialog";
+import {OrMap, OrMapClickedEvent} from '@openremote/or-map';
+
// language=CSS
const style = css`
@@ -55,6 +59,7 @@ const style = css`
}
`;
+
@customElement("or-rule-asset-query")
export class OrRuleAssetQuery extends translate(i18next)(LitElement) {
@@ -183,7 +188,6 @@ export class OrRuleAssetQuery extends translate(i18next)(LitElement) {
const assetType = getAssetTypeFromQuery(this.query);
// @ts-ignore
const value = valuePredicate ? valuePredicate.value : undefined;
-
switch (valuePredicate.predicateType) {
case "string":
return getAttributeValueTemplate(assetType, { name: attributeName!, type: AttributeValueType.STRING }, this.readonly || false, false, (v: any) => this.setValuePredicateProperty(valuePredicate, "value", v), this.config ? this.config.inputProvider : undefined, undefined, i18next.t("string"))(value);
@@ -205,7 +209,8 @@ export class OrRuleAssetQuery extends translate(i18next)(LitElement) {
case "string-array":
return html `<span>NOT IMPLEMENTED</span>`;
case "radial":
- return html `<span>NOT IMPLEMENTED</span>`;
+
+ return html`<or-rule-radial-modal .query="${this.query}" .assetDescriptor="${assetDescriptor}" .attributePredicate="${attributePredicate}"></or-rule-radial-modal>`;
case "rect":
return html `<span>NOT IMPLEMENTED</span>`;
case "object-value-key":
diff --git a/ui/component/or-rules/tsconfig.json b/ui/component/or-rules/tsconfig.json
index 62a355b75..6304800cf 100644
--- a/ui/component/or-rules/tsconfig.json
+++ b/ui/component/or-rules/tsconfig.json
@@ -6,12 +6,14 @@
"rootDir": "src"
},
"include": [
- "./src"
+ "./src",
+ "../or-map/@types"
],
"references": [
{ "path": "../core" },
{ "path": "../or-translate" },
{ "path": "../or-input" },
+ { "path": "../or-map" },
{ "path": "../or-attribute-input" },
{ "path": "../or-icon" },
{ "path": "../or-panel" },