generated from coulomb/repo-seed
Add discovery registry review flow
This commit is contained in:
@@ -284,6 +284,8 @@ def fabric_graph_explorer_payload(
|
||||
layer = _layer_for_kind(kind)
|
||||
is_unresolved = node_id in unresolved
|
||||
attributes = node.get("attributes") if isinstance(node.get("attributes"), dict) else {}
|
||||
review_state = str(attributes.get("discovery_review_state") or "accepted")
|
||||
confidence = attributes.get("discovery_confidence")
|
||||
elements.append(
|
||||
{
|
||||
"data": {
|
||||
@@ -297,13 +299,24 @@ def fabric_graph_explorer_payload(
|
||||
"repo": str(node.get("repo", "")),
|
||||
"domain": str(node.get("domain", "")),
|
||||
"lifecycle": str(node.get("lifecycle", "")),
|
||||
"reviewState": "accepted",
|
||||
"reviewState": review_state,
|
||||
"freshnessState": "current",
|
||||
"unresolved": is_unresolved,
|
||||
"confidence": 0.45 if is_unresolved else 1.0,
|
||||
"confidence": (
|
||||
float(confidence)
|
||||
if isinstance(confidence, (int, float))
|
||||
else 0.45 if is_unresolved else 1.0
|
||||
),
|
||||
"visualSize": 34 if layer == "binding" else 46 if is_unresolved else 50,
|
||||
"ownership": str(attributes.get("owner") or "repo"),
|
||||
"ownership": str(attributes.get("owner") or attributes.get("discovery_origin") or "repo"),
|
||||
"attributes": attributes,
|
||||
"discovery": {
|
||||
"stableKey": attributes.get("discovery_stable_key", ""),
|
||||
"origin": attributes.get("discovery_origin", ""),
|
||||
"reviewState": attributes.get("discovery_review_state", ""),
|
||||
"confidence": attributes.get("discovery_confidence", ""),
|
||||
"provenance": attributes.get("discovery_provenance", []),
|
||||
},
|
||||
"displayState": "show",
|
||||
"visibilitySource": "default",
|
||||
"visibilityReason": "default",
|
||||
@@ -312,7 +325,7 @@ def fabric_graph_explorer_payload(
|
||||
},
|
||||
"classes": " ".join(
|
||||
part
|
||||
for part in (layer, kind, "unresolved" if is_unresolved else "accepted")
|
||||
for part in (layer, kind, "unresolved" if is_unresolved else review_state)
|
||||
if part
|
||||
),
|
||||
}
|
||||
@@ -733,6 +746,15 @@ def _source_references(node: dict[str, Any]) -> list[dict[str, str]]:
|
||||
for source in attributes.get("source_links", []):
|
||||
if isinstance(source, dict):
|
||||
references.append({key: str(value) for key, value in source.items()})
|
||||
for anchor in attributes.get("discovery_source_anchors", []):
|
||||
if isinstance(anchor, dict):
|
||||
reference = {
|
||||
"label": f"Discovery {anchor.get('source_kind', 'source')}",
|
||||
}
|
||||
for key in ("path", "url", "ref", "json_pointer"):
|
||||
if anchor.get(key):
|
||||
reference[key] = str(anchor[key])
|
||||
references.append(reference)
|
||||
return references
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user