diff --git a/modules/routes/routeSystem.py b/modules/routes/routeSystem.py index 7c3e17a3..6638caec 100644 --- a/modules/routes/routeSystem.py +++ b/modules/routes/routeSystem.py @@ -672,6 +672,20 @@ def _buildIntegrationsOverviewPayload(userId: str, user=None) -> Dict[str, Any]: logger.error(f"integrations-overview connections: {e}") out["errors"].append(f"connections: {e}") + # --- instance label lookup (shared by DataSource & Trustee blocks) --- + _instLabelCache: Dict[str, str] = {} + def _getInstanceLabel(iid: str) -> str: + if iid in _instLabelCache: + return _instLabelCache[iid] + try: + _fi = getFeatureInterface(root.db) + inst = _fi.getFeatureInstance(iid) + lbl = getattr(inst, "label", None) or getattr(inst, "uiLabel", None) or "" + _instLabelCache[iid] = lbl + except Exception: + _instLabelCache[iid] = "" + return _instLabelCache[iid] + # --- DataSource & FeatureDataSource --- try: from modules.datamodels.datamodelDataSource import DataSource @@ -720,6 +734,7 @@ def _buildIntegrationsOverviewPayload(userId: str, user=None) -> Dict[str, Any]: if not rid or rid in seen_fds: continue seen_fds.add(rid) + fds_iid = row.get("featureInstanceId") or "" out["dataLayerItems"].append( { "kind": "featureDataSource", @@ -727,8 +742,9 @@ def _buildIntegrationsOverviewPayload(userId: str, user=None) -> Dict[str, Any]: "label": row.get("label") or rid, "featureCode": row.get("featureCode") or "", "tableName": row.get("tableName") or "", - "featureInstanceId": row.get("featureInstanceId"), + "featureInstanceId": fds_iid, "mandateId": row.get("mandateId"), + "instanceLabel": _getInstanceLabel(fds_iid) if fds_iid else "", } ) @@ -745,8 +761,9 @@ def _buildIntegrationsOverviewPayload(userId: str, user=None) -> Dict[str, Any]: "label": row.get("label") or rid, "featureCode": row.get("featureCode") or "", "tableName": row.get("tableName") or "", - "featureInstanceId": row.get("featureInstanceId"), + "featureInstanceId": iid, "mandateId": row.get("mandateId"), + "instanceLabel": _getInstanceLabel(iid), } ) except Exception as e: