@@ -83,13 +83,11 @@ const ViewRows = ({
83
83
const getGridHeadings = ( _columns , _relationships ) => {
84
84
const _gridHeadings = [ ] ;
85
85
86
- if ( ! isView ) {
87
- _gridHeadings . push ( {
88
- Header : '' ,
89
- accessor : 'actions' ,
90
- id : 'actions' ,
91
- } ) ;
92
- }
86
+ _gridHeadings . push ( {
87
+ Header : '' ,
88
+ accessor : 'actions' ,
89
+ id : 'actions' ,
90
+ } ) ;
93
91
94
92
_columns . map ( col => {
95
93
const columnName = col . column_name ;
@@ -291,26 +289,26 @@ const ViewRows = ({
291
289
const getColCellContent = ( ) => {
292
290
const rowColumnValue = row [ columnName ] ;
293
291
294
- const getCellValue = ( ) => {
295
- let cellValue = '' ;
296
-
297
- if ( rowColumnValue === null ) {
298
- cellValue = ( < i > NULL</ i > ) ;
299
- } else if ( rowColumnValue === undefined ) {
300
- cellValue = 'NULL' ;
301
- } else if ( col . data_type === 'json' || col . data_type === 'jsonb' ) {
302
- cellValue = JSON . stringify ( rowColumnValue ) ;
303
- } else {
304
- cellValue = rowColumnValue . toString ( ) ;
305
- }
306
-
307
- return cellValue ;
308
- } ;
292
+ let cellValue = '' ;
293
+ let cellTitle = '' ;
294
+
295
+ if ( rowColumnValue === null ) {
296
+ cellValue = ( < i > NULL</ i > ) ;
297
+ cellTitle = 'NULL' ;
298
+ } else if ( rowColumnValue === undefined ) {
299
+ cellValue = 'NULL' ;
300
+ cellTitle = cellValue ;
301
+ } else if ( col . data_type === 'json' || col . data_type === 'jsonb' ) {
302
+ cellValue = JSON . stringify ( rowColumnValue ) ;
303
+ cellTitle = cellValue ;
304
+ } else {
305
+ cellValue = rowColumnValue . toString ( ) ;
306
+ cellTitle = cellValue ;
307
+ }
309
308
310
- const cellValue = getCellValue ( ) ;
311
309
312
310
return (
313
- < div className = { isExpanded ? styles . tableCellExpanded : '' } >
311
+ < div className = { isExpanded ? styles . tableCellExpanded : '' } title = { cellTitle } >
314
312
{ cellValue }
315
313
</ div >
316
314
) ;
@@ -338,9 +336,9 @@ const ViewRows = ({
338
336
) ;
339
337
} ;
340
338
341
- const isExpanded = curQuery . columns . find ( c => c . name === rel . rel_name ) !== undefined ;
339
+ const isRelExpanded = curQuery . columns . find ( c => c . name === rel . rel_name ) !== undefined ;
342
340
343
- if ( isExpanded ) {
341
+ if ( isRelExpanded ) {
344
342
const handleCloseClick = e => {
345
343
e . preventDefault ( ) ;
346
344
dispatch ( vCloseRel ( curPath , rel . rel_name ) ) ;
@@ -491,30 +489,36 @@ const ViewRows = ({
491
489
// Render child only if data is available
492
490
if ( curRows [ 0 ] [ cq . name ] ) {
493
491
const rel = tableSchema . relationships . find ( r => r . rel_name === cq . name ) ;
494
- let childRows = curRows [ 0 ] [ cq . name ] ;
495
- if ( rel . rel_type === 'object' ) {
496
- childRows = [ childRows ] ;
492
+
493
+ if ( rel ) {
494
+ let childRows = curRows [ 0 ] [ cq . name ] ;
495
+ if ( rel . rel_type === 'object' ) {
496
+ childRows = [ childRows ] ;
497
+ }
498
+ // Find the name of this childTable using the rel
499
+ return (
500
+ < ViewRows
501
+ key = { i }
502
+ curTableName = { findTableFromRel ( schemas , tableSchema , rel ) . table_name }
503
+ currentSchema = { currentSchema }
504
+ curQuery = { cq }
505
+ curFilter = { curFilter }
506
+ curPath = { [ ...curPath , rel . rel_name ] }
507
+ curRows = { childRows }
508
+ parentTableName = { curTableName }
509
+ activePath = { activePath }
510
+ ongoingRequest = { ongoingRequest }
511
+ lastError = { lastError }
512
+ lastSuccess = { lastSuccess }
513
+ schemas = { schemas }
514
+ curDepth = { curDepth + 1 }
515
+ dispatch = { dispatch }
516
+ expandedRow = { expandedRow }
517
+ />
518
+ ) ;
497
519
}
498
- // Find the name of this childTable using the rel
499
- return (
500
- < ViewRows
501
- key = { i }
502
- curTableName = { findTableFromRel ( schemas , tableSchema , rel ) . table_name }
503
- curQuery = { cq }
504
- curFilter = { curFilter }
505
- curPath = { [ ...curPath , rel . rel_name ] }
506
- curRows = { childRows }
507
- parentTableName = { curTableName }
508
- activePath = { activePath }
509
- ongoingRequest = { ongoingRequest }
510
- lastError = { lastError }
511
- lastSuccess = { lastSuccess }
512
- schemas = { schemas }
513
- curDepth = { curDepth + 1 }
514
- dispatch = { dispatch }
515
- />
516
- ) ;
517
520
}
521
+
518
522
return null ;
519
523
} ) ;
520
524
0 commit comments