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
Fixes for attributes panel in group assets. (#1281)
Martin Peetersb03d0406b9d9
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.tsindex 7db3a0264..eb6544c98 100644--- a/ui/component/or-asset-viewer/src/index.ts+++ b/ui/component/or-asset-viewer/src/index.ts@@ -720,8 +720,11 @@ function getPanelContent(id: string, assetInfo: AssetInfo, hostElement: LitElemeconst rows = childAssets.map((childAsset) => {// todo: it's only processing including selected headers here...// move this to the columnFilter option of the table- const arr = attrNames.map((attributeName) => {- return childAsset.attributes![attributeName] ? childAsset.attributes![attributeName].value! as string : "";+ const arr = attrNames.map((attrName) => {+ const descriptor = AssetModelUtil.getAttributeDescriptor(attrName, childAssetType);+ return childAsset.attributes![attrName]+ ? Util.getAttributeValueAsString(childAsset.attributes![attrName], descriptor, asset.type, false)+ : "";});arr.unshift(childAsset.name!);return arr;@@ -739,12 +742,14 @@ function getPanelContent(id: string, assetInfo: AssetInfo, hostElement: LitElemeshowOkCancelDialog(i18next.t("addRemoveAttributes"),html`- <div style="display: grid">- ${availableAttributes.sort().map((attribute) =>- html`<div style="grid-column: 1 / -1;">- <or-mwc-input .type="${InputType.CHECKBOX}" .label="${i18next.t(Util.camelCaseToSentenceCase(attribute))}" .value="${!!selectedAttributes.find((selected) => selected === attribute)}"- @or-mwc-input-changed="${(evt: OrInputChangedEvent) => evt.detail.value ? newlySelectedAttributes.push(attribute) : newlySelectedAttributes.splice(newlySelectedAttributes.findIndex((s) => s === attribute), 1)}"></or-mwc-input>- </div>`)}+ <div style="display: flex; flex-direction: column;">+ ${availableAttributes.sort().map((attribute) => html`+ <or-mwc-input .type="${InputType.CHECKBOX}" .label="${i18next.t(Util.camelCaseToSentenceCase(attribute))}" style="display: inline-flex;"+ .value="${!!selectedAttributes.find((selected) => selected === attribute)}"+ @or-mwc-input-changed="${(evt: OrInputChangedEvent) =>+ evt.detail.value ? newlySelectedAttributes.push(attribute) : newlySelectedAttributes.splice(newlySelectedAttributes.findIndex((s) => s === attribute), 1)}"+ ></or-mwc-input>+ `)}</div>`).then((ok) => {