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
UI updates: bug fix for ClientRoles
Rich Turner56b1dc0e259d
diff --git a/agent/src/main/java/org/openremote/agent/protocol/event/ClientEventAgent.java b/agent/src/main/java/org/openremote/agent/protocol/event/ClientEventAgent.javaindex c94e535ea..5d1308023 100644--- a/agent/src/main/java/org/openremote/agent/protocol/event/ClientEventAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/event/ClientEventAgent.java@@ -33,7 +33,7 @@ import java.util.Optional;@Entitypublic class ClientEventAgent extends Agent<ClientEventAgent, ClientEventProtocol, AgentLink.Default> {- public static final ValueDescriptor<ClientRole> VALUE_CLIENT_ROLE = new ValueDescriptor<>("Client role", ClientRole.class);+ public static final ValueDescriptor<ClientRole> VALUE_CLIENT_ROLE = new ValueDescriptor<>("clientRole", ClientRole.class);public static final AttributeDescriptor<String> CLIENT_SECRET = new AttributeDescriptor<>("clientSecret", ValueType.TEXT);public static final AttributeDescriptor<ClientRole[]> CLIENT_ROLES = new AttributeDescriptor<>("clientRoles", VALUE_CLIENT_ROLE.asArray());diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientAgent.java b/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientAgent.javaindex 2bdc8ebb3..e6724d358 100644--- a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientAgent.java@@ -125,7 +125,7 @@ public class HttpClientAgent extends Agent<HttpClientAgent, HttpClientProtocol,}}- public static final ValueDescriptor<HttpMethod> VALUE_HTTP_METHOD = new ValueDescriptor<>("HTTP method", HttpMethod.class);+ public static final ValueDescriptor<HttpMethod> VALUE_HTTP_METHOD = new ValueDescriptor<>("HTTPMethod", HttpMethod.class);public static final AttributeDescriptor<String> BASE_URI = new AttributeDescriptor<>("baseURI", ValueType.TEXT);public static final AttributeDescriptor<Boolean> FOLLOW_REDIRECTS = new AttributeDescriptor<>("followRedirects", ValueType.BOOLEAN);diff --git a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXAgent.java b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXAgent.javaindex cc12dcbd6..6602d5667 100644--- a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXAgent.java@@ -85,7 +85,7 @@ public class KNXAgent extends Agent<KNXAgent, KNXProtocol, KNXAgent.KNXAgentLink}@Pattern(regexp = "^\\d\\.\\d\\.\\d$")- public static final ValueDescriptor<String> SOURCE_ADDRESS_VALUE = new ValueDescriptor<>("KNX message source address", String.class);+ public static final ValueDescriptor<String> SOURCE_ADDRESS_VALUE = new ValueDescriptor<>("kNXMessageSourceAddress", String.class);public static final AttributeDescriptor<Boolean> NAT_MODE = new AttributeDescriptor<>("nATMode", ValueType.BOOLEAN);public static final AttributeDescriptor<Boolean> ROUTING_MODE = new AttributeDescriptor<>("routingMode", ValueType.BOOLEAN);diff --git a/agent/src/main/java/org/openremote/agent/protocol/macro/MacroAgent.java b/agent/src/main/java/org/openremote/agent/protocol/macro/MacroAgent.javaindex 77e9eccd8..fc3c2f27b 100644--- a/agent/src/main/java/org/openremote/agent/protocol/macro/MacroAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/macro/MacroAgent.java@@ -56,7 +56,7 @@ public class MacroAgent extends Agent<MacroAgent, MacroProtocol, MacroAgent.Macr}}- public static final ValueDescriptor<MacroAction> MACRO_ACTION_VALUE = new ValueDescriptor<>("Macro action", MacroAction.class);+ public static final ValueDescriptor<MacroAction> MACRO_ACTION_VALUE = new ValueDescriptor<>("macroAction", MacroAction.class);public static final AttributeDescriptor<MacroAction[]> MACRO_ACTIONS = new AttributeDescriptor<>("macroActions", MACRO_ACTION_VALUE.asArray());diff --git a/agent/src/main/java/org/openremote/agent/protocol/timer/TimerAgent.java b/agent/src/main/java/org/openremote/agent/protocol/timer/TimerAgent.javaindex 7369d2376..ef881dd23 100644--- a/agent/src/main/java/org/openremote/agent/protocol/timer/TimerAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/timer/TimerAgent.java@@ -54,11 +54,11 @@ public class TimerAgent extends Agent<TimerAgent, TimerProtocol, TimerAgent.Time}}- public static final ValueDescriptor<CronExpressionParser> TIMER_CRON_EXPRESSION_DESCRIPTOR = new ValueDescriptor<>("Timer cron expression", CronExpressionParser.class);+ public static final ValueDescriptor<CronExpressionParser> TIMER_CRON_EXPRESSION_DESCRIPTOR = new ValueDescriptor<>("cRONExpression", CronExpressionParser.class);public static final AttributeDescriptor<AttributeState> TIMER_ACTION = new AttributeDescriptor<>("timerAction", ValueType.ATTRIBUTE_STATE);- public static final AttributeDescriptor<CronExpressionParser> TIMER_CRON_EXPRESSION = new AttributeDescriptor<>("timerCronExpression", TIMER_CRON_EXPRESSION_DESCRIPTOR);+ public static final AttributeDescriptor<CronExpressionParser> TIMER_CRON_EXPRESSION = new AttributeDescriptor<>("timerCRONExpression", TIMER_CRON_EXPRESSION_DESCRIPTOR);public static final AttributeDescriptor<Boolean> TIMER_ACTIVE = new AttributeDescriptor<>("timerActive", ValueType.BOOLEAN);diff --git a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientAgent.java b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientAgent.javaindex be074bf39..52e2c3f25 100644--- a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientAgent.java+++ b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketClientAgent.java@@ -55,7 +55,7 @@ public class WebsocketClientAgent extends IoAgent<WebsocketClientAgent, Websocke}}- public static final ValueDescriptor<WebsocketSubscription> WEBSOCKET_SUBSCRIPTION_VALUE_DESCRIPTOR = new ValueDescriptor<>("Websocket subscription", WebsocketSubscription.class);+ public static final ValueDescriptor<WebsocketSubscription> WEBSOCKET_SUBSCRIPTION_VALUE_DESCRIPTOR = new ValueDescriptor<>("websocketSubscription", WebsocketSubscription.class);/*** Websocket connect endpoint URIdiff --git a/build.gradle b/build.gradleindex cbcc25105..e14cc6833 100644--- a/build.gradle+++ b/build.gradle@@ -1,3 +1,13 @@allprojects {apply from: "${findProject(":openremote") != null ? project(":openremote").projectDir : rootDir}/project.gradle"}++task deleteNodeModules {+ doFirst {+ delete "node_modules"+ }+}++task clean {+ dependsOn deleteNodeModules+}diff --git a/manager/src/web/shared/locales/en/or.json b/manager/src/web/shared/locales/en/or.jsonindex 015e56ee3..056e34ec1 100644--- a/manager/src/web/shared/locales/en/or.json+++ b/manager/src/web/shared/locales/en/or.json@@ -339,36 +339,6 @@"attributeOverrides": {"label": {}},- "metaItemTypes": {- "urn:openremote:asset:meta:label": "Label",- "urn:openremote:asset:meta:description": "Description",- "urn:openremote:asset:meta:storeDataPoints": "Store data points",- "urn:openremote:asset:meta:agentLink": "Agent link",- "urn:openremote:asset:meta:attributeLink": "Attribute link",- "urn:openremote:asset:meta:showOnDashboard": "Show on dashboard",- "urn:openremote:asset:meta:format": "Format",- "urn:openremote:asset:meta:about": "About",- "urn:openremote:asset:meta:readOnly": "Readonly",- "urn:openremote:asset:meta:accessRestrictedRead": "Restricted read",- "urn:openremote:asset:meta:accessRestrictedWrite": "Restricted write",- "urn:openremote:asset:meta:accessPublicRead": "Public read",- "urn:openremote:asset:meta:accessPublicWrite": "Public write",- "urn:openremote:asset:meta:rangeMin": "Value min",- "urn:openremote:asset:meta:rangeMax": "Value max",- "urn:openremote:asset:meta:step": "Value step",- "urn:openremote:asset:meta:pattern": "Value regex",- "urn:openremote:asset:meta:multiline": "Value multiline",- "urn:openremote:asset:meta:dataPointsMaxAgeDays": "Data points max age (days)",- "urn:openremote:asset:meta:disabled": "Disabled",- "urn:openremote:asset:meta:executable": "Executable",- "urn:openremote:asset:meta:allowedValues": "Allowed values",- "urn:openremote:asset:meta:unitType": "Units",- "urn:openremote:asset:meta:hasPredictedDatapoints": "Has predicted datapoints",- "urn:openremote:asset:meta:secret": "Secret",- "urn:openremote:asset:meta:ruleState": "Rule state",- "urn:openremote:asset:meta:ruleEvent": "Rule event",- "urn:openremote:asset:meta:ruleEventExpires": "Rule event expires"- },"addMetaItems": "Add configuration items","loseChanges": "Discard changes?","confirmContinueAssetModified": "Asset has been modified, discard changes?",diff --git a/model/src/main/java/org/openremote/model/security/ClientRole.java b/model/src/main/java/org/openremote/model/security/ClientRole.javaindex e4583da8c..1629438ab 100644--- a/model/src/main/java/org/openremote/model/security/ClientRole.java+++ b/model/src/main/java/org/openremote/model/security/ClientRole.java@@ -19,6 +19,7 @@*/package org.openremote.model.security;+import com.fasterxml.jackson.annotation.JsonValue;import org.keycloak.representations.idm.RoleRepresentation;import org.openremote.model.Constants;@@ -98,6 +99,7 @@ public enum ClientRole {this.composites = null;}+ @JsonValuepublic String getValue() {return value;}diff --git a/model/src/main/java/org/openremote/model/value/ValueConstraint.java b/model/src/main/java/org/openremote/model/value/ValueConstraint.javaindex 67f9af94f..4d856beba 100644--- a/model/src/main/java/org/openremote/model/value/ValueConstraint.java+++ b/model/src/main/java/org/openremote/model/value/ValueConstraint.java@@ -20,10 +20,16 @@package org.openremote.model.value;import com.fasterxml.jackson.annotation.*;+import com.fasterxml.jackson.databind.BeanDescription;+import com.fasterxml.jackson.databind.JavaType;+import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;+import com.fasterxml.jackson.databind.util.EnumValues;import java.io.Serializable;import java.util.Arrays;+import java.util.List;import java.util.Optional;+import java.util.function.Function;/*** Represents a constraint to apply to a value; these are based on JSR-380 validation.@@ -154,8 +160,8 @@ public abstract class ValueConstraint implements Serializable {return allowedValueNames;}- public static AllowedValues fromEnum(Class<? extends Enum<?>> enumClass) {- Object[] allowedValues = Arrays.stream(enumClass.getEnumConstants()).map(Enum::toString).toArray(String[]::new);+ public static AllowedValues fromEnum(Class<Enum<?>> enumClass) {+ Object[] allowedValues = Arrays.stream(enumClass.getEnumConstants()).map(enm -> Values.getStringCoerced(enm).orElse(null)).toArray(String[]::new);return new AllowedValues(allowedValues);}}diff --git a/model/src/main/java/org/openremote/model/value/ValueDescriptor.java b/model/src/main/java/org/openremote/model/value/ValueDescriptor.javaindex 68a4d69be..fd394088b 100644--- a/model/src/main/java/org/openremote/model/value/ValueDescriptor.java+++ b/model/src/main/java/org/openremote/model/value/ValueDescriptor.java@@ -151,7 +151,7 @@ public class ValueDescriptor<T> implements NameHolder, Serializable {this.name = name;this.type = type;if (type.isEnum() && (constraints == null || Arrays.stream(constraints).noneMatch(c -> c instanceof ValueConstraint.AllowedValues))) {- ValueConstraint.AllowedValues allowedValues = ValueConstraint.AllowedValues.fromEnum((Class<? extends Enum<?>>) type);+ ValueConstraint.AllowedValues allowedValues = ValueConstraint.AllowedValues.fromEnum((Class<Enum<?>>) type);if (constraints != null) {constraints = Arrays.copyOf(constraints, constraints.length+1);constraints[constraints.length-1] = allowedValues;diff --git a/model/src/main/java/org/openremote/model/value/ValueType.java b/model/src/main/java/org/openremote/model/value/ValueType.javaindex 91a025775..a4ad8fe51 100644--- a/model/src/main/java/org/openremote/model/value/ValueType.java+++ b/model/src/main/java/org/openremote/model/value/ValueType.java@@ -184,7 +184,7 @@ public final class ValueType {public static final ValueDescriptor<ValueConstraint> VALUE_CONSTRAINT = new ValueDescriptor<>("valueConstraint", ValueConstraint.class);- public static final ValueDescriptor<AgentLink> VALUE_AGENT_LINK = new ValueDescriptor<>("Agent link", AgentLink.class);+ public static final ValueDescriptor<AgentLink> VALUE_AGENT_LINK = new ValueDescriptor<>("agentLink", AgentLink.class);protected ValueType() {}diff --git a/ui/build.gradle b/ui/build.gradleindex 314388e85..020c52ddb 100644--- a/ui/build.gradle+++ b/ui/build.gradle@@ -1,4 +1,3 @@-import java.nio.file.Pathimport java.nio.file.PathsafterEvaluate {@@ -38,19 +37,6 @@ afterEvaluate {}}-task deleteNodeModules {- doFirst {- delete "${project(':openremote').projectDir}/node_modules"- }-}--task clean {- // Do this as it will conflict with root project node_modules- if (isCustomProject() && parent == rootProject) {- dependsOn deleteNodeModules- }-}-task modelWatch {dependsOn resolveTask(":ui:component:model:build"), resolveTask(":ui:component:rest:build")}diff --git a/ui/component/core/src/util.ts b/ui/component/core/src/util.tsindex 8ec3c5909..2b8918f4f 100644--- a/ui/component/core/src/util.ts+++ b/ui/component/core/src/util.ts@@ -418,7 +418,7 @@ export function getAllowedValueLabel(allowedValue: string, fallback?: string): sreturn;}- return i18next.t("label.allowedValue." + allowedValue, {defaultValue: fallback || camelCaseToSentenceCase(allowedValue || "")});+ return i18next.t("label.allowedValue." + allowedValue, {defaultValue: fallback || camelCaseToSentenceCase(allowedValue || ""), nsSeparator: false});}export function getMetaItemNameValueHolder(metaNameOrDescriptor: MetaItemDescriptor | string, value: any): NameValueHolder<any> {