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
make rendering of the attribute card a bit more robust should the config.json not be entirely complete or correct
Vincenta88e69afb081
diff --git a/ui/component/or-map/src/or-map-asset-card.ts b/ui/component/or-map/src/or-map-asset-card.tsindex 6d0d27534..e9cb02aba 100644--- a/ui/component/or-map/src/or-map-asset-card.ts+++ b/ui/component/or-map/src/or-map-asset-card.ts@@ -163,11 +163,12 @@ export class OrMapAssetCard extends subscribe(manager)(LitElement) {<div id="attribute-list"><ul>${attrs.map((attr) => {- const descriptors = AssetModelUtil.getAttributeAndValueDescriptors(this.asset!.type, attr.name, attr);- const label = Util.getAttributeLabel(attr, descriptors[0], this.asset!.type, true);- const value = Util.getAttributeValueAsString(attr, descriptors[0], this.asset!.type, false, "-");- const classes = {highlighted: attr.name === this.markerconfig![this.asset!.type!][0].attributeName};- return html`<li class="${classMap(classes)}"><span class="attribute-name">${label}</span><span class="attribute-value">${value}</span></li>`;+ if (!this.asset || !this.asset.type) { return }+ const descriptors = AssetModelUtil.getAttributeAndValueDescriptors(this.asset.type, attr.name, attr);+ const label = Util.getAttributeLabel(attr, descriptors[0], this.asset.type, true);+ const value = Util.getAttributeValueAsString(attr, descriptors[0], this.asset.type, false, "-");+ const classes = {highlighted: (this.markerconfig![this.asset.type][0] && attr.name === this.markerconfig![this.asset.type][0].attributeName)};+ return html`<li class="${classMap(classes)}"><span class="attribute-name">${label}</span><span class="attribute-value">${value}</span></li>`;})}</ul></div>