fix instance label

This commit is contained in:
ValueOn AG 2026-04-12 18:34:00 +02:00
parent 88b581ac83
commit 2fd4bd3a68

View file

@ -131,12 +131,15 @@ function _groupCorporateByInstance(items: DataLayerItem[]): _CorporateInstanceGr
let group = map.get(iid); let group = map.get(iid);
if (!group) { if (!group) {
const code = item.featureCode || item.connectorType || ''; const code = item.featureCode || item.connectorType || '';
const instLabel = item.instanceLabel || code; const instLabel = (item.instanceLabel || '').trim();
group = { instanceId: iid, instanceLabel: instLabel, featureCode: code, systems: [] }; group = { instanceId: iid, instanceLabel: instLabel, featureCode: code, systems: [] };
map.set(iid, group); map.set(iid, group);
} }
if (item.instanceLabel && !group.instanceLabel) { if (item.instanceLabel && (!group.instanceLabel || group.instanceLabel === group.featureCode)) {
group.instanceLabel = item.instanceLabel; group.instanceLabel = item.instanceLabel.trim();
}
if (item.featureCode && !group.featureCode) {
group.featureCode = item.featureCode;
} }
const sysLabel = (item.displayLabel || item.label || item.connectorType || item.id).trim(); const sysLabel = (item.displayLabel || item.label || item.connectorType || item.id).trim();
group.systems.push({ key: `${item.kind}-${item.id}`, label: sysLabel }); group.systems.push({ key: `${item.kind}-${item.id}`, label: sysLabel });