mirror of
https://github.com/kharonsec/br-acc
synced 2026-04-25 17:15:02 +02:00
chore(pr-review): squash merge #35
Merged by strict manual review cycle 20260303T215220Z.
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user