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 the asset card on map page more robust to missing information in manager_config
Vincent10cb5b948f56
diff --git a/ui/component/or-map/src/or-map-asset-card.ts b/ui/component/or-map/src/or-map-asset-card.tsindex e9cb02aba..d475239c9 100644--- a/ui/component/or-map/src/or-map-asset-card.ts+++ b/ui/component/or-map/src/or-map-asset-card.ts@@ -165,10 +165,12 @@ export class OrMapAssetCard extends subscribe(manager)(LitElement) {${attrs.map((attr) => {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>`;+ if (descriptors && descriptors.length) {+ 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] && 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>