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 update: Bug fix for unit display in attribute label
Rich Turner5eae75123ced
diff --git a/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java b/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.javaindex 455910a04..89c431699 100644--- a/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java+++ b/manager/src/main/java/org/openremote/manager/setup/builtin/ManagerDemoSetup.java@@ -108,11 +108,9 @@ public class ManagerDemoSetup extends AbstractManagerSetup {energyManagement.getAttributes().addOrReplace(new Attribute<>("powerTotalProducers", NUMBER).addOrReplaceMeta(- new MetaItem<>(LABEL, "Combined power of all producers"),new MetaItem<>(UNITS, Constants.units(Constants.UNITS_KILO, Constants.UNITS_WATT)),new MetaItem<>(READ_ONLY, true)),new Attribute<>("powerTotalConsumers", NUMBER).addOrReplaceMeta(- new MetaItem<>(LABEL, "Combined power use of all consumers"),new MetaItem<>(UNITS, Constants.units(Constants.UNITS_KILO, Constants.UNITS_WATT)),new MetaItem<>(READ_ONLY, true)));@@ -130,7 +128,6 @@ public class ManagerDemoSetup extends AbstractManagerSetup {new Attribute<>(BuildingAsset.COUNTRY, "Netherlands"),new Attribute<>(Asset.LOCATION, new GeoJSONPoint(4.488324, 51.906577)),new Attribute<>("powerBalance", NUMBER).addMeta(- new MetaItem<>(LABEL, "Balance of power production and use"),new MetaItem<>(UNITS, Constants.units(Constants.UNITS_KILO, Constants.UNITS_WATT)),new MetaItem<>(READ_ONLY)));@@ -343,7 +340,6 @@ public class ManagerDemoSetup extends AbstractManagerSetup {new Attribute<>(Asset.LOCATION, new GeoJSONPoint(4.47945, 51.92301)),new Attribute<>("allChargersInUse", BOOLEAN).addMeta(- new MetaItem<>(LABEL, "All chargers in use"),new MetaItem<>(READ_ONLY)));building3Asset.setId(UniqueIdentifierGenerator.generateId(building3Asset.getName() + "building"));@@ -907,7 +903,6 @@ public class ManagerDemoSetup extends AbstractManagerSetup {parkingGroupAsset.getAttributes().addOrReplace(new Attribute<>("totalOccupancy", POSITIVE_INTEGER).addMeta(- new MetaItem<>(LABEL, "Percentage of total parking spaces in use"),new MetaItem<>(UNITS, Constants.units(Constants.UNITS_PERCENTAGE)),new MetaItem<>(CONSTRAINTS, ValueConstraint.constraints(new ValueConstraint.Min(0), new ValueConstraint.Max(100))),new MetaItem<>(READ_ONLY)));diff --git a/ui/component/core/src/util.ts b/ui/component/core/src/util.tsindex 8bc51055d..8c754b01d 100644--- a/ui/component/core/src/util.ts+++ b/ui/component/core/src/util.ts@@ -651,7 +651,7 @@ function getValueFormatConstraintOrUnits<T>(lookup: WellknownMetaItems.FORMAT |// Look in metaif (nameValueHolder && (nameValueHolder as MetaHolder).meta) {- matched = getMetaValue(WellknownMetaItems.FORMAT, nameValueHolder as Attribute<any>, descriptor) as T;+ matched = getMetaValue(lookup, nameValueHolder as Attribute<any>, descriptor) as T;if (matched) {if (lookup === WellknownMetaItems.FORMAT) {diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.tsindex 63e69b9a9..a1a2e6a9f 100644--- a/ui/component/or-asset-viewer/src/index.ts+++ b/ui/component/or-asset-viewer/src/index.ts@@ -297,9 +297,6 @@ export function getPanelContent(panelName: string, asset: Asset, attributes: { [includedProperties.forEach((prop) => {const itemConfig = infoConfig.properties && infoConfig.properties.itemConfig ? infoConfig.properties.itemConfig[prop] : {};- if (itemConfig.label === undefined) {- itemConfig.label = i18next.t(prop);- }itemConfig.priority = itemConfig.priority || 0;items.push({item: prop,@@ -309,10 +306,6 @@ export function getPanelContent(panelName: string, asset: Asset, attributes: { [includedAttributes.forEach((attribute) => {const itemConfig = infoConfig.attributes && infoConfig.attributes.itemConfig && infoConfig.attributes.itemConfig[attribute.name!] ? infoConfig.attributes.itemConfig[attribute.name!] : {};- if (itemConfig.label === undefined) {- const descriptors = AssetModelUtil.getAttributeAndValueDescriptors(asset.type!, attribute.name, attribute);- itemConfig.label = Util.getAttributeLabel(attribute, descriptors[0], asset.type, true);- }itemConfig.priority = itemConfig.priority || 0;items.push({item: attribute,