Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI updates: bug fix for or-asset-viewer (fixes #318, fixes #319)

Rich Turnerd02e5508544b
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index 7d3af91e8..e67add78c 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -297,6 +297,9 @@ 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,
@@ -306,6 +309,11 @@ 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) {
+ // Get label here so we can sort the attributes
+ 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,