@@ -27,7 +27,7 @@ import { Box } from '@mui/material';
2727import { styled } from '@mui/material/styles' ;
2828
2929const TYPE = 'table' ;
30- const TABLE_WIDTH = 175 ;
30+ const TABLE_WIDTH = 180 ;
3131
3232export class TableNodeModel extends DefaultNodeModel {
3333 constructor ( { otherInfo, ...options } ) {
@@ -214,16 +214,31 @@ RowIcon.propTypes = {
214214
215215const StyledDiv = styled ( 'div' ) ( ( { theme} ) => ( {
216216 '&.TableNode-tableNode' : {
217- backgroundColor : theme . palette . background . default ,
218217 color : theme . palette . text . primary ,
219- ...theme . mixins . panelBorder . all ,
220- borderRadius : theme . shape . borderRadius ,
221218 position : 'relative' ,
222219 width : `${ TABLE_WIDTH } px` ,
223220 fontSize : '0.8em' ,
224- '& div:last-child' : {
225- borderBottomLeftRadius : 'inherit' ,
226- borderBottomRightRadius : 'inherit' ,
221+
222+ '& .TableNode-tableContent' : {
223+ backgroundColor : theme . palette . background . default ,
224+ ...theme . mixins . panelBorder . all ,
225+ borderBottomLeftRadius : theme . shape . borderRadius ,
226+ borderBottomRightRadius : theme . shape . borderRadius ,
227+ } ,
228+ '& .TableNode-tableToolbar' : {
229+ background : theme . otherVars . editorToolbarBg ,
230+ ...theme . mixins . panelBorder . all ,
231+ borderBottom : 'none' ,
232+ borderTopLeftRadius : theme . shape . borderRadius ,
233+ borderTopRightRadius : theme . shape . borderRadius ,
234+ padding : '0.125rem 0.25rem' ,
235+ display : 'flex' ,
236+
237+ '& .TableNode-noteBtn' : {
238+ marginLeft : 'auto' ,
239+ backgroundColor : theme . palette . warning . main ,
240+ color : theme . palette . warning . contrastText ,
241+ } ,
227242 } ,
228243 '& .TableNode-tableSection' : {
229244 ...theme . mixins . panelBorder . bottom ,
@@ -237,16 +252,6 @@ const StyledDiv = styled('div')(({theme})=>({
237252 color : theme . palette . error . main ,
238253 } ,
239254 } ,
240- '&.TableNode-tableToolbar' : {
241- background : theme . otherVars . editorToolbarBg ,
242- borderTopLeftRadius : 'inherit' ,
243- borderTopRightRadius : 'inherit' ,
244- } ,
245- '& .TableNode-noteBtn' : {
246- marginLeft : 'auto' ,
247- backgroundColor : theme . palette . warning . main ,
248- color : theme . palette . warning . contrastText ,
249- } ,
250255 } ,
251256 '& .TableNode-columnSection' : {
252257 display :'flex' ,
@@ -370,7 +375,7 @@ export class TableNodeWidget extends React.Component {
370375 return (
371376 < StyledDiv className = { [ 'TableNode-tableNode' , ( this . props . node . isSelected ( ) ? 'TableNode-tableNodeSelected' : '' ) ] . join ( ' ' ) }
372377 onDoubleClick = { ( ) => { this . props . node . fireEvent ( { } , 'editTable' ) ; } } style = { styles } >
373- < div className = { 'TableNode-tableSection TableNode- tableToolbar' } >
378+ < div className = { 'TableNode-tableToolbar' } >
374379 < PgIconButton size = "xs" title = { gettext ( 'Show Details' ) } icon = { this . state . show_details ? < VisibilityRoundedIcon /> : < VisibilityOffRoundedIcon /> }
375380 onClick = { this . toggleShowDetails } onDoubleClick = { ( e ) => { e . stopPropagation ( ) ; } } />
376381 { this . props . node . getNote ( ) &&
@@ -381,24 +386,26 @@ export class TableNodeWidget extends React.Component {
381386 } }
382387 /> }
383388 </ div >
384- { tableMetaData . is_promise &&
389+ < div className = 'TableNode-tableContent' >
390+ { tableMetaData . is_promise &&
385391 < div className = 'TableNode-tableSection' >
386392 { ! tableMetaData . data_failed && < div className = 'TableNode-tableNameText' > { gettext ( 'Fetching...' ) } </ div > }
387393 { tableMetaData . data_failed && < div className = { 'TableNode-tableNameText TableNode-error' } > { gettext ( 'Failed to get data. Please delete this table.' ) } </ div > }
388394 </ div > }
389- { ! tableMetaData . is_promise && < >
390- < div className = 'TableNode-tableSection' >
391- < RowIcon icon = { SchemaIcon } />
392- < div className = 'TableNode-tableNameText' data-test = "schema-name" > { tableData . schema } </ div >
393- </ div >
394- < div className = 'TableNode-tableSection' >
395- < RowIcon icon = { TableIcon } />
396- < div className = 'TableNode-tableNameText' data-test = "table-name" > { tableData . name } </ div >
397- </ div >
398- { tableData . columns . length > 0 && < div >
399- { _ . map ( tableData . columns , ( col ) => this . generateColumn ( col , localFkCols , localUkCols ) ) }
400- </ div > }
401- </ > }
395+ { ! tableMetaData . is_promise && < >
396+ < div className = 'TableNode-tableSection' >
397+ < RowIcon icon = { SchemaIcon } />
398+ < div className = 'TableNode-tableNameText' data-test = "schema-name" > { tableData . schema } </ div >
399+ </ div >
400+ < div className = 'TableNode-tableSection' >
401+ < RowIcon icon = { TableIcon } />
402+ < div className = 'TableNode-tableNameText' data-test = "table-name" > { tableData . name } </ div >
403+ </ div >
404+ { tableData . columns . length > 0 && < div >
405+ { _ . map ( tableData . columns , ( col ) => this . generateColumn ( col , localFkCols , localUkCols ) ) }
406+ </ div > }
407+ </ > }
408+ </ div >
402409 </ StyledDiv >
403410 ) ;
404411 }
0 commit comments