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
Fix for setting correct redirect Separated geofence rules
Michael Rademakerca029e64a4c7
diff --git a/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java b/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.javaindex f45048c37..241b5786d 100644--- a/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java+++ b/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java@@ -60,10 +60,26 @@ public class RulesDemoSetup extends AbstractManagerSetup {// }// SmartCity geofences- try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/DemoGeofences.json")) {+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/DemoGeofence.json")) {String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);Ruleset ruleset = new TenantRuleset(- keycloakDemoSetup.tenantCity.getRealm(), "Demo Geofences", Ruleset.Lang.JSON, rules+ keycloakDemoSetup.tenantCity.getRealm(), "De Kuip", Ruleset.Lang.JSON, rules+ ).setAccessPublicRead(true).addMeta("showOnMap", Values.create(true)).addMeta("showOnList", Values.create(true));+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();+ }++ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/DemoGeofence2.json")) {+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);+ Ruleset ruleset = new TenantRuleset(+ keycloakDemoSetup.tenantCity.getRealm(), "Euromast", Ruleset.Lang.JSON, rules+ ).setAccessPublicRead(true).addMeta("showOnMap", Values.create(true)).addMeta("showOnList", Values.create(true));+ tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();+ }++ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/DemoGeofence3.json")) {+ String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);+ Ruleset ruleset = new TenantRuleset(+ keycloakDemoSetup.tenantCity.getRealm(), "Markthal", Ruleset.Lang.JSON, rules).setAccessPublicRead(true).addMeta("showOnMap", Values.create(true)).addMeta("showOnList", Values.create(true));tenantSmartCityRulesetId = rulesetStorageService.merge(ruleset).getId();}diff --git a/manager/src/main/java/org/openremote/manager/setup/builtin/RulesTestSetup.java b/manager/src/main/java/org/openremote/manager/setup/builtin/RulesTestSetup.javaindex a0c5d22d3..e129df48a 100644--- a/manager/src/main/java/org/openremote/manager/setup/builtin/RulesTestSetup.java+++ b/manager/src/main/java/org/openremote/manager/setup/builtin/RulesTestSetup.java@@ -120,7 +120,7 @@ public class RulesTestSetup extends AbstractManagerSetup {}// SmartCity geofences- try (InputStream inputStream = RulesTestSetup.class.getResourceAsStream("/demo/rules/DemoGeofences.json")) {+ try (InputStream inputStream = RulesTestSetup.class.getResourceAsStream("/demo/rules/DemoGeofence.json")) {String rules = IOUtils.toString(inputStream, StandardCharsets.UTF_8);Ruleset ruleset = new TenantRuleset(keycloakTestSetup.tenantCity.getRealm(), "Demo Geofences", Ruleset.Lang.JSON, rulesdiff --git a/manager/src/main/resources/demo/rules/DemoGeofence.json b/manager/src/main/resources/demo/rules/DemoGeofence.jsonnew file mode 100644index 000000000..52004c75f--- /dev/null+++ b/manager/src/main/resources/demo/rules/DemoGeofence.json@@ -0,0 +1,83 @@+{+ "rules": [+ {+ "name": "De Kuip",+ "when": {+ "operator": "OR",+ "groups": [+ {+ "operator": "AND",+ "items": [+ {+ "assets": {+ "types": [+ {+ "predicateType": "string",+ "match": "EXACT",+ "value": "urn:openremote:asset:console"+ }+ ],+ "attributes": {+ "items": [+ {+ "name": {+ "predicateType": "string",+ "match": "EXACT",+ "value": "location"+ },+ "value": {+ "predicateType": "radial",+ "negated": false,+ "radius": 100,+ "lat": 51.8938569,+ "lng": 4.5219983+ }+ }+ ]+ }+ }+ }+ ]+ }+ ]+ },+ "then": [+ {+ "action": "notification",+ "target": {+ "useAssetsFromWhen": true+ },+ "notification": {+ "name": "De Kuip",+ "message": {+ "type": "push",+ "title": "De Kuip",+ "body": "De thuis van Feyenoord",+ "action": {+ "url": "https://www.feyenoord.nl"+ },+ "buttons": [+ {+ "title": "Open in app",+ "action": {+ "url": "https://www.feyenoord.nl"+ }+ },+ {+ "title": "Open in browser",+ "action": {+ "url": "https://www.feyenoord.nl",+ "openInBrowser": true+ }+ }+ ]+ }+ }+ }+ ],+ "reset": {+ "timer": "1m"+ }+ }+ ]+}diff --git a/manager/src/main/resources/demo/rules/DemoGeofence2.json b/manager/src/main/resources/demo/rules/DemoGeofence2.jsonnew file mode 100644index 000000000..26534d751--- /dev/null+++ b/manager/src/main/resources/demo/rules/DemoGeofence2.json@@ -0,0 +1,83 @@+{+ "rules": [+ {+ "name": "Euromast",+ "when": {+ "operator": "OR",+ "groups": [+ {+ "operator": "AND",+ "items": [+ {+ "assets": {+ "types": [+ {+ "predicateType": "string",+ "match": "EXACT",+ "value": "urn:openremote:asset:console"+ }+ ],+ "attributes": {+ "items": [+ {+ "name": {+ "predicateType": "string",+ "match": "EXACT",+ "value": "location"+ },+ "value": {+ "predicateType": "radial",+ "negated": false,+ "radius": 100,+ "lat": 51.9069373,+ "lng": 4.4633775+ }+ }+ ]+ }+ }+ }+ ]+ }+ ]+ },+ "then": [+ {+ "action": "notification",+ "target": {+ "useAssetsFromWhen": true+ },+ "notification": {+ "name": "Euromast",+ "message": {+ "type": "push",+ "title": "Euromast",+ "body": "Euromast, sinds 1960",+ "action": {+ "url": "https://euromast.nl"+ },+ "buttons": [+ {+ "title": "Open in app",+ "action": {+ "url": "https://euromast.nl"+ }+ },+ {+ "title": "Open in browser",+ "action": {+ "url": "https://euromast.nl",+ "openInBrowser": true+ }+ }+ ]+ }+ }+ }+ ],+ "reset": {+ "timer": "1m"+ }+ }+ ]+}diff --git a/manager/src/main/resources/demo/rules/DemoGeofence3.json b/manager/src/main/resources/demo/rules/DemoGeofence3.jsonnew file mode 100644index 000000000..4cd31fa45--- /dev/null+++ b/manager/src/main/resources/demo/rules/DemoGeofence3.json@@ -0,0 +1,83 @@+{+ "rules": [+ {+ "name": "Markthal",+ "when": {+ "operator": "OR",+ "groups": [+ {+ "operator": "AND",+ "items": [+ {+ "assets": {+ "types": [+ {+ "predicateType": "string",+ "match": "EXACT",+ "value": "urn:openremote:asset:console"+ }+ ],+ "attributes": {+ "items": [+ {+ "name": {+ "predicateType": "string",+ "match": "EXACT",+ "value": "location"+ },+ "value": {+ "predicateType": "radial",+ "negated": false,+ "radius": 100,+ "lat": 51.9202494,+ "lng": 4.4851372+ }+ }+ ]+ }+ }+ }+ ]+ }+ ]+ },+ "then": [+ {+ "action": "notification",+ "target": {+ "useAssetsFromWhen": true+ },+ "notification": {+ "name": "Markthal",+ "message": {+ "type": "push",+ "title": "Markthal",+ "body": "Happy Food Shopping",+ "action": {+ "url": "https://www.markthal.nl"+ },+ "buttons": [+ {+ "title": "Open in app",+ "action": {+ "url": "https://www.markthal.nl"+ }+ },+ {+ "title": "Open in browser",+ "action": {+ "url": "https://www.markthal.nl",+ "openInBrowser": true+ }+ }+ ]+ }+ }+ }+ ],+ "reset": {+ "timer": "1m"+ }+ }+ ]+}diff --git a/manager/src/main/resources/demo/rules/DemoGeofences.json b/manager/src/main/resources/demo/rules/DemoGeofences.jsondeleted file mode 100644index 5dd2a290a..000000000--- a/manager/src/main/resources/demo/rules/DemoGeofences.json+++ /dev/null@@ -1,238 +0,0 @@-{- "rules": [- {- "name": "De Kuip",- "when": {- "items": [- {- "datetime": {- "predicateType": "datetime",- "value": "2020-07-01T00:00:00+02:00",- "rangeValue": "2020-09-01T00:00:00+02:00",- "operator": "BETWEEN"- },- "assets": {- "types": [- {- "predicateType": "string",- "match": "EXACT",- "value": "urn:openremote:asset:console"- }- ],- "attributes": {- "items": [- {- "name": {- "predicateType": "string",- "match": "EXACT",- "value": "location"- },- "value": {- "predicateType": "radial",- "radius": 100,- "lat": 51.8938569,- "lng": 4.5219983- }- }- ]- }- }- }- ]- },- "then": [- {- "action": "notification",- "target": {- "useAssetsFromWhen": true- },- "notification": {- "name": "De Kuip",- "message": {- "type": "push",- "title": "De Kuip",- "body": "De thuis van Feyenoord",- "action": {- "url": "https://www.feyenoord.nl"- },- "buttons": [- {- "title": "Open in app",- "action": {- "url": "https://www.feyenoord.nl"- }- },- {- "title": "Open in browser",- "action": {- "url": "https://www.feyenoord.nl",- "openInBrowser": true- }- }- ]- }- }- }- ],- "reset": {- "timer": "1m"- }- },- {- "name": "Euromast",- "when": {- "items": [- {- "datetime": {- "predicateType": "datetime",- "value": "2020-07-01T00:00:00+02:00",- "rangeValue": "2020-09-01T00:00:00+02:00",- "operator": "BETWEEN"- },- "assets": {- "types": [- {- "predicateType": "string",- "match": "EXACT",- "value": "urn:openremote:asset:console"- }- ],- "attributes": {- "items": [- {- "name": {- "predicateType": "string",- "match": "EXACT",- "value": "location"- },- "value": {- "predicateType": "radial",- "radius": 100,- "lat": 51.9069373,- "lng": 4.4633775- }- }- ]- }- }- }- ]- },- "then": [- {- "action": "notification",- "target": {- "useAssetsFromWhen": true- },- "notification": {- "name": "Euromast",- "message": {- "type": "push",- "title": "Euromast",- "body": "Euromast, sinds 1960",- "action": {- "url": "https://euromast.nl"- },- "buttons": [- {- "title": "Open in app",- "action": {- "url": "https://euromast.nl"- }- },- {- "title": "Open in browser",- "action": {- "url": "https://euromast.nl",- "openInBrowser": true- }- }- ]- }- }- }- ],- "reset": {- "timer": "1m"- }- },- {- "name": "Markthal",- "when": {- "items": [- {- "datetime": {- "predicateType": "datetime",- "value": "2020-07-01T00:00:00+02:00",- "rangeValue": "2020-09-01T00:00:00+02:00",- "operator": "BETWEEN"- },- "assets": {- "types": [- {- "predicateType": "string",- "match": "EXACT",- "value": "urn:openremote:asset:console"- }- ],- "attributes": {- "items": [- {- "name": {- "predicateType": "string",- "match": "EXACT",- "value": "location"- },- "value": {- "predicateType": "radial",- "radius": 100,- "lat": 51.9202494,- "lng": 4.4851372- }- }- ]- }- }- }- ]- },- "then": [- {- "action": "notification",- "target": {- "useAssetsFromWhen": true- },- "notification": {- "name": "Markthal",- "message": {- "type": "push",- "title": "Markthal",- "body": "Happy Food Shopping",- "action": {- "url": "https://www.markthal.nl"- },- "buttons": [- {- "title": "Open in app",- "action": {- "url": "https://www.markthal.nl"- }- },- {- "title": "Open in browser",- "action": {- "url": "https://www.markthal.nl",- "openInBrowser": true- }- }- ]- }- }- }- ],- "reset": {- "timer": "1m"- }- }- ]-}\ No newline at end of filediff --git a/ui/app/mobile/src/index.ts b/ui/app/mobile/src/index.tsindex f45e263d0..84ef91cc7 100644--- a/ui/app/mobile/src/index.ts+++ b/ui/app/mobile/src/index.ts@@ -51,7 +51,7 @@ const onboardingConfig:OnboardingConfig = {image: require("../images/logo-mobile.png")}],- redirect: "#!geofences?realm=smartcity&consoleProviders=geofence push storage"+ redirect: "/mobile/#!geofences?realm=smartcity&consoleProviders=geofence push storage"}const splashConfig:SplashConfig = {