@@ -49,7 +49,7 @@ export const DocumentsGraphqlTable = ({type,onRowClick,showGraphqlTab=true}) =>
4949
5050 function onRowClickCall ( row ) {
5151 if ( onRowClick ) {
52- const rowTmp = row && row . original ? { label :row . original . name , id :row . original . _id } : { }
52+ const rowTmp = row && row . original ? { label :row . original . name , id :row . original . fullID } : { }
5353 onRowClick ( rowTmp )
5454 }
5555 }
@@ -60,6 +60,18 @@ export const DocumentsGraphqlTable = ({type,onRowClick,showGraphqlTab=true}) =>
6060
6161 let extractedResults = documentResults ? extractDocuments ( documentResults [ type ] ) : [ ]
6262
63+ function cleanIdValue ( keyName , keyValue ) {
64+ if ( keyValue === "null" ) return ""
65+ if ( keyName !== "_id" ) return keyValue
66+ try {
67+ const regexp = / (?: \/ + .* ?\/ ) ( .* $ ) / g
68+ const array01 = [ ...keyValue . matchAll ( regexp ) ] ;
69+ return array01 [ 0 ] [ 1 ]
70+ } catch ( err ) {
71+ return keyValue
72+ }
73+ }
74+
6375 function extractDocuments ( documentResultsArr ) {
6476 if ( ! documentResultsArr ) {
6577 //alert(JSON.stringify(documentResultsArr))
@@ -80,11 +92,15 @@ export const DocumentsGraphqlTable = ({type,onRowClick,showGraphqlTab=true}) =>
8092 //key
8193 const objectKey = Object . keys ( item [ key ] )
8294 objectKey . forEach ( element => {
83- newJson [ `${ key } ---${ element } ` ] = `${ item [ key ] [ element ] } `
95+ const columnName = element === "_id" ? `${ key } ---id` : `${ key } ---${ element } `
96+ newJson [ columnName ] = cleanIdValue ( element , item [ key ] [ element ] )
8497 } ) ;
8598 }
8699 else {
87- newJson [ key ] = `${ item [ key ] } `
100+ if ( key === "_id" ) {
101+ newJson [ "fullID" ] = `${ item [ key ] } `
102+ }
103+ newJson [ key ] = cleanIdValue ( key , `${ item [ key ] } ` )
88104 }
89105 }
90106 extractedResults . push ( newJson )
0 commit comments