Skip to content
Snippets Groups Projects
Commit c1597ca1 authored by Marcos Pieras's avatar Marcos Pieras
Browse files

fix: schema pill stats

parent d427d4e9
No related branches found
No related tags found
1 merge request!240fix: schema pill stats
Pipeline #138980 failed
...@@ -14,7 +14,6 @@ export const SchemaEntityPill = React.memo(({ id, selected, data }: NodeProps<Sc ...@@ -14,7 +14,6 @@ export const SchemaEntityPill = React.memo(({ id, selected, data }: NodeProps<Sc
const viewport = useViewport(); const viewport = useViewport();
const schemaStats = useSchemaStats(); const schemaStats = useSchemaStats();
const ref = useRef<HTMLDivElement>(null); const ref = useRef<HTMLDivElement>(null);
/** /**
* adds drag functionality in order to be able to drag the entityNode to the schema * adds drag functionality in order to be able to drag the entityNode to the schema
...@@ -39,13 +38,13 @@ export const SchemaEntityPill = React.memo(({ id, selected, data }: NodeProps<Sc ...@@ -39,13 +38,13 @@ export const SchemaEntityPill = React.memo(({ id, selected, data }: NodeProps<Sc
const tooltipX = useMemo(() => { const tooltipX = useMemo(() => {
if (ref.current == null || openPopupLocation == null) return -1; if (ref.current == null || openPopupLocation == null) return -1;
const rect = ref.current.getBoundingClientRect(); const rect = ref.current.getBoundingClientRect();
return rect.x - openPopupLocation.x + (rect.width / 2); return rect.x - openPopupLocation.x + rect.width / 2;
}, [viewport.x, openPopupLocation]); }, [viewport.x, openPopupLocation]);
const tooltipY = useMemo(() => { const tooltipY = useMemo(() => {
if (ref.current == null || openPopupLocation == null) return -1; if (ref.current == null || openPopupLocation == null) return -1;
const rect = ref.current.getBoundingClientRect(); const rect = ref.current.getBoundingClientRect();
return rect.y - openPopupLocation.y + (rect.height / 2); return rect.y - openPopupLocation.y + rect.height / 2;
}, [viewport.y, openPopupLocation]); }, [viewport.y, openPopupLocation]);
return ( return (
...@@ -83,7 +82,7 @@ export const SchemaEntityPill = React.memo(({ id, selected, data }: NodeProps<Sc ...@@ -83,7 +82,7 @@ export const SchemaEntityPill = React.memo(({ id, selected, data }: NodeProps<Sc
}, },
{} as Record<string, string>, {} as Record<string, string>,
)} )}
numberOfElements={schemaStats.nodeStats[data.name]?.count} numberOfElements={schemaStats.nodes.stats[data.name]?.count}
/> />
</VisualizationTooltip> </VisualizationTooltip>
</div> </div>
......
...@@ -94,7 +94,7 @@ export const SchemaRelationPill = React.memo(({ id, selected, data, ...props }: ...@@ -94,7 +94,7 @@ export const SchemaRelationPill = React.memo(({ id, selected, data, ...props }:
: {} : {}
} }
connections={{ from: data.from, to: data.to }} connections={{ from: data.from, to: data.to }}
numberOfElements={schemaStats.edgeStats[data.collection]?.count} numberOfElements={schemaStats.edges.stats[data.collection]?.count}
/> />
</VisualizationTooltip> </VisualizationTooltip>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment