fix instance label
This commit is contained in:
parent
5780cc0324
commit
958449c9dd
1 changed files with 19 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue