@@ -12,7 +12,6 @@ import { useEffect, useRef, useState } from 'react';
1212import { GraphType , GraphViewModalProps } from '../types' ;
1313import { InteractiveNvlWrapper } from '@neo4j-nvl/react' ;
1414import NVL , { NvlOptions } from '@neo4j-nvl/core' ;
15- // import { driver } from '../utils/Driver';
1615import type { Node , Relationship } from '@neo4j-nvl/core' ;
1716
1817import {
@@ -109,27 +108,27 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
109108 graphType . length === 3
110109 ? queryMap . DocChunkEntities
111110 : graphType . includes ( 'Entities' ) && graphType . includes ( 'Chunks' )
112- ? queryMap . ChunksEntities
113- : graphType . includes ( 'Entities' ) && graphType . includes ( 'Document' )
114- ? queryMap . DocEntities
115- : graphType . includes ( 'Document' ) && graphType . includes ( 'Chunks' )
116- ? queryMap . DocChunks
117- : graphType . includes ( 'Entities' ) && graphType . length === 1
118- ? queryMap . Entities
119- : graphType . includes ( 'Chunks' ) && graphType . length === 1
120- ? queryMap . Chunks
121- : queryMap . Document ;
111+ ? queryMap . ChunksEntities
112+ : graphType . includes ( 'Entities' ) && graphType . includes ( 'Document' )
113+ ? queryMap . DocEntities
114+ : graphType . includes ( 'Document' ) && graphType . includes ( 'Chunks' )
115+ ? queryMap . DocChunks
116+ : graphType . includes ( 'Entities' ) && graphType . length === 1
117+ ? queryMap . Entities
118+ : graphType . includes ( 'Chunks' ) && graphType . length === 1
119+ ? queryMap . Chunks
120+ : queryMap . Document ;
122121 if ( viewPoint === 'showGraphView' ) {
123122 queryToRun = constructQuery ( newCheck , documentNo ) ;
124- console . log ( 'inside If QueryToRun ' , queryToRun ) ;
123+ console . log ( 'showGraph ' , queryToRun ) ;
125124 } else {
126125 queryToRun = constructDocQuery ( newCheck ) ;
127- console . log ( 'outside QueryToRun ' , queryToRun ) ;
126+ console . log ( 'table ' , queryToRun ) ;
128127 }
129128 const session = driver ?. session ( ) ;
130129 setLoading ( true ) ;
131130 session
132- ?. run ( queryToRun , { ' document_name' : inspectedName } )
131+ ?. run ( queryToRun , { document_name : inspectedName } )
133132 . then ( ( results ) => {
134133 if ( results . records && results . records . length > 0 ) {
135134 // @ts -ignore
@@ -159,7 +158,7 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
159158 iconAlign : 'bottom' ,
160159 captionHtml : < b > Test</ b > ,
161160 caption : `${ g . labels } : ${ getNodeCaption ( g ) } ` ,
162- color : scheme [ g . labels ] ,
161+ color : scheme [ g . labels [ 0 ] ] ,
163162 icon : getIcon ( g ) ,
164163 } ;
165164 } ) ;
@@ -239,11 +238,11 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
239238 nvlRef . current ?. setZoom ( nvlRef . current . getScale ( ) * 0.7 ) ;
240239 } ;
241240
242- const onClose = ( ) => {
241+ const onClose = ( ) => {
243242 setStatus ( 'unknown' ) ;
244243 setStatusMessage ( '' ) ;
245- setGraphViewOpen ( false )
246- }
244+ setGraphViewOpen ( false ) ;
245+ } ;
247246
248247 return (
249248 < >
@@ -316,16 +315,10 @@ const GraphViewModal: React.FunctionComponent<GraphViewModalProps> = ({
316315 </ div >
317316 ) : (
318317 < >
319- < Flex
320- flexDirection = 'row'
321- justifyContent = 'space-between'
322- style = { { height : '100%' , padding : '20px' } }
323-
324- >
325- < div style = { { display : 'flex' , flex : '0.2' , flexWrap : 'wrap' , padding : '15px' , gap : '8px' , backgroundColor : 'white' , height : 'max-content' } } >
318+ < Flex flexDirection = 'row' justifyContent = 'space-between' style = { { height : '100%' , padding : '20px' } } >
319+ < div className = 'legend_div' >
326320 { Object . keys ( scheme ) . map ( ( key ) => (
327321 < div className = 'legend' key = { scheme . key } style = { { backgroundColor : `${ scheme [ key ] } ` } } >
328- { scheme . key }
329322 { key }
330323 </ div >
331324 ) ) }
0 commit comments