Skip to content

armgit / core

Public Imported from GitHub
0

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

Add flyTo radial modal

Robin Dekkers8e536825259b
diff --git a/deployment/manager/shared/locales/nl/or.json b/deployment/manager/shared/locales/nl/or.json
index a7d472a05..68177f615 100644
--- a/deployment/manager/shared/locales/nl/or.json
+++ b/deployment/manager/shared/locales/nl/or.json
@@ -78,7 +78,7 @@
"lang": "Taal",
"status": "Status",
"name": "Naam",
- "deleteAssetsConfirm": "Remove asset(s) and all descendant assets?",
+ "deleteAssetsConfirm": "Verwijder alle asset(s) en onderliggende assets?",
"ok": "OK",
"cancel": "Annuleren",
"createdOn": "Aangemaakt op",
diff --git a/test/src/test/resources/org/openremote/test/rules/BasicJsonRules.json b/test/src/test/resources/org/openremote/test/rules/BasicJsonRules.json
index 8dc3d8157..e21bc8a31 100644
--- a/test/src/test/resources/org/openremote/test/rules/BasicJsonRules.json
+++ b/test/src/test/resources/org/openremote/test/rules/BasicJsonRules.json
@@ -27,7 +27,7 @@
},
"value": {
"predicateType": "radial",
- "radius": 50,
+ "radius": 100,
"lat": 51.446308,
"lng": 5.454027,
"negated": true
diff --git a/ui/component/or-rules/src/index.ts b/ui/component/or-rules/src/index.ts
index 1f478f6f0..00152f8d3 100644
--- a/ui/component/or-rules/src/index.ts
+++ b/ui/component/or-rules/src/index.ts
@@ -661,7 +661,7 @@ export class OrRules extends translate(i18next)(LitElement) {
delete ruleset.status;
delete ruleset.error;
delete ruleset.id;
-
+ ruleset.name = ruleset.name + " copy";
if (this.config && this.config.rulesetCopyHandler && !this.config.rulesetCopyHandler(ruleset)) {
return;
}
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
index 31d6a6ab1..0e6097697 100644
--- 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
@@ -18,6 +18,9 @@ import {DialogAction, OrMwcDialog, OrMwcDialogOpenedEvent} from "@openremote/or-
import {OrMap, OrMapClickedEvent} from '@openremote/or-map';
import '@openremote/or-map/dist/markers/or-map-marker';
+import {LatLngLike} from "mapbox.js";
+import {LngLatLike} from "mapbox-gl";
+
@customElement("or-rule-radial-modal")
export class OrRuleRadialModal extends translate(i18next)(LitElement) {
@@ -55,6 +58,16 @@ export class OrRuleRadialModal extends translate(i18next)(LitElement) {
this.setValuePredicateProperty('lat', lngLat.lat);
this.setValuePredicateProperty('lng', lngLat.lng);
});
+ if(map){
+ const latElement = (<HTMLInputElement>modal.shadowRoot!.querySelector('.location-lat'));
+ const lngElement = (<HTMLInputElement>modal.shadowRoot!.querySelector('.location-lng'));
+ if(lngElement.value && latElement.value) {
+ const LngLat:LngLatLike = [parseFloat(lngElement.value), parseFloat(latElement.value)];
+ map.flyTo(LngLat, 15)
+ } else {
+ map.flyTo();
+ }
+ }
}
}
@@ -75,7 +88,9 @@ export class OrRuleRadialModal extends translate(i18next)(LitElement) {
}
renderDialogHTML(value:RadialGeofencePredicate) {
- const dialog: OrMwcDialog = this.shadowRoot!.getElementById("radial-modal") as OrMwcDialog;
+ const dialog: OrMwcDialog = this.shadowRoot!.getElementById("radial-modal") as OrMwcDialog;
+
+
if (dialog) {
dialog.dialogContent = html`
<div style="display:grid">
@@ -90,8 +105,9 @@ export class OrRuleRadialModal extends translate(i18next)(LitElement) {
<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="100" type="number" .value="${value && value.radius ? value.radius : null}" />
+ <input @change="${(e:any) => this.setValuePredicateProperty("radius", parseInt(e.target.value))}" style="max-width: calc(50% - 30px);" required placeholder=" " min="100" type="number" .value="${value && value.radius ? value.radius : 100}" />
</div>`;
+
}
}
@@ -132,6 +148,7 @@ export class OrRuleRadialModal extends translate(i18next)(LitElement) {
if (dialog) {
dialog.open();
this.renderDialogHTML(value);
+
}
};