chore(pr-review): squash merge #35

Merged by strict manual review cycle 20260303T215220Z.
This commit is contained in:
Davi Figueiredo
2026-03-03 19:08:14 -03:00
committed by GitHub
parent 38a7873897
commit c53d28de39
3 changed files with 68 additions and 1 deletions

View File

@@ -83,4 +83,53 @@ describe("ConnectionsList", () => {
// person group has 1 node
expect(screen.getByText("1")).toBeInTheDocument();
});
it("falls back to document id when label is empty", () => {
const withBlankLabel: GraphNode[] = [
...nodes,
{
id: "n4",
label: " ",
type: "contract",
document_id: "CTR-001",
properties: {},
sources: [],
},
];
render(
<ConnectionsList
nodes={withBlankLabel}
centerId="center"
selectedNodeId={null}
onSelectNode={vi.fn()}
/>,
);
expect(screen.getByText("CTR-001")).toBeInTheDocument();
});
it("falls back to type and id when label and document id are empty", () => {
const withNoName: GraphNode[] = [
...nodes,
{
id: "graph:node:42",
label: "",
type: "contract",
properties: {},
sources: [],
},
];
render(
<ConnectionsList
nodes={withNoName}
centerId="center"
selectedNodeId={null}
onSelectNode={vi.fn()}
/>,
);
expect(screen.getByText(/#42$/)).toBeInTheDocument();
});
});

View File

@@ -27,6 +27,20 @@ function ConnectionsListInner({
const { t } = useTranslation();
const listRef = useRef<HTMLDivElement>(null);
const getDisplayName = useCallback(
(node: GraphNode): string => {
const label = node.label.trim();
if (label) return label;
const documentId = node.document_id?.trim();
if (documentId) return documentId;
const shortId = node.id.substring(node.id.lastIndexOf(":") + 1) || node.id;
return `${t(`entity.${node.type}`, node.type)} #${shortId}`;
},
[t],
);
const grouped = useMemo(() => {
const groups = new Map<string, GraphNode[]>();
for (const node of nodes) {
@@ -114,7 +128,7 @@ function ConnectionsListInner({
className={styles.itemDot}
style={{ backgroundColor: color }}
/>
<span className={styles.itemName}>{node.label}</span>
<span className={styles.itemName}>{getDisplayName(node)}</span>
<span className={styles.itemSource}>
{node.sources[0]?.database ?? ""}
</span>

View File

@@ -118,6 +118,10 @@ CREATE (c10:Contract {
value: 350000.0, contracting_org: 'PREFEITURA SAO PAULO', date: '2024-10-01'
});
// Set contract names programmatically
MATCH (c:Contract)
SET c.name = c.contract_id + ' - ' + c.object;
// ── Amendment (for self-dealing pattern) ──────────────────
CREATE (a1:Amendment {
amendment_id: 'EMD-001', type: 'Individual', function: 'Urbanismo',