@@ -223,11 +223,9 @@ export class TableStatisticsView extends React.Component<TableStatisticsViewProp
223223
224224export const DBTableSelectionDialog : React . FC < {
225225 buttonElement : any ,
226- component : 'dialog' | 'box' ,
227226 sx ?: SxProps
228227} > = function DBTableSelectionDialog ( {
229228 buttonElement,
230- component,
231229 sx,
232230} ) {
233231
@@ -261,7 +259,7 @@ export const DBTableSelectionDialog: React.FC<{
261259 }
262260
263261 useEffect ( ( ) => {
264- //fetchTables() ;
262+ if ( serverConfig . DISABLE_DATABASE ) return ;
265263 fetchDataLoaders ( ) ;
266264 } , [ ] ) ;
267265
@@ -275,6 +273,7 @@ export const DBTableSelectionDialog: React.FC<{
275273
276274 // Fetch list of tables
277275 const fetchTables = async ( ) => {
276+ if ( serverConfig . DISABLE_DATABASE ) return ;
278277 try {
279278 const response = await fetch ( getUrls ( ) . LIST_TABLES ) ;
280279 const data = await response . json ( ) ;
@@ -939,98 +938,75 @@ export const DBTableSelectionDialog: React.FC<{
939938 { tableView }
940939 </ Box >
941940
942- if ( component === 'dialog' ) {
943- return (
944- < >
945- < Tooltip
946- title = { serverConfig . DISABLE_DATABASE ? (
947- < Typography sx = { { fontSize : '11px' } } >
948- Install Data Formulator locally to use database. < br />
949- Link: < Link
950- href = "https://github.com/microsoft/data-formulator"
951- target = "_blank"
952- rel = "noopener noreferrer"
953- sx = { { color : 'inherit' , textDecoration : 'underline' } }
954- onClick = { ( e ) => e . stopPropagation ( ) }
955- >
956- https://github.com/microsoft/data-formulator
957- </ Link >
958- </ Typography >
959- ) : "" }
960- placement = "top"
961- >
962- < span style = { { cursor : serverConfig . DISABLE_DATABASE ? 'help' : 'pointer' } } >
963- < Button variant = "text" sx = { { fontSize : "inherit" , gap : 1 } } disabled = { serverConfig . DISABLE_DATABASE } onClick = { ( ) => {
964- setTableDialogOpen ( true ) ;
965- } } >
966- { buttonElement }
967- </ Button >
968- </ span >
969- </ Tooltip >
970- < Dialog
971- key = "db-table-selection-dialog"
972- onClose = { ( ) => { setTableDialogOpen ( false ) } }
973- open = { tableDialogOpen }
974- sx = { { '& .MuiDialog-paper' : { maxWidth : '100%' , maxHeight : 800 , minWidth : 800 } } }
975- >
976- < DialogTitle sx = { { display : "flex" } } >
977- Database
978- < IconButton
979- sx = { { marginLeft : "auto" } }
980- edge = "start"
981- size = "small"
982- color = "inherit"
983- aria-label = "close"
984- onClick = { ( ) => setTableDialogOpen ( false ) }
941+ return (
942+ < >
943+ < Tooltip
944+ title = { serverConfig . DISABLE_DATABASE ? (
945+ < Typography sx = { { fontSize : '11px' } } >
946+ Install Data Formulator locally to use database. < br />
947+ Link: < Link
948+ href = "https://github.com/microsoft/data-formulator"
949+ target = "_blank"
950+ rel = "noopener noreferrer"
951+ sx = { { color : 'inherit' , textDecoration : 'underline' } }
952+ onClick = { ( e ) => e . stopPropagation ( ) }
985953 >
986- < CloseIcon fontSize = "inherit" />
987- </ IconButton >
988- </ DialogTitle >
989- < DialogContent sx = { { p : 1 , position : "relative" } } >
990- { mainContent }
991- { isUploading && (
992- < Box sx = { {
993- position : 'absolute' ,
994- top : 0 ,
995- left : 0 ,
996- width : '100%' ,
997- height : '100%' ,
998- display : 'flex' ,
999- alignItems : 'center' ,
1000- justifyContent : 'center' ,
1001- backgroundColor : 'rgba(255, 255, 255, 0.7)' ,
1002- zIndex : 1000
1003- } } >
1004- < CircularProgress size = { 60 } thickness = { 5 } />
1005- </ Box >
1006- ) }
1007- </ DialogContent >
1008- </ Dialog >
1009- </ >
1010- ) ;
1011- } else {
1012- return (
1013- < Box sx = { { ...sx } } >
1014- { mainContent }
1015- { isUploading && (
1016- < Box sx = { {
1017- position : 'absolute' ,
1018- top : 0 ,
1019- left : 0 ,
1020- width : '100%' ,
1021- height : '100%' ,
1022- display : 'flex' ,
1023- alignItems : 'center' ,
1024- justifyContent : 'center' ,
1025- backgroundColor : 'rgba(255, 255, 255, 0.7)' ,
1026- zIndex : 1000
954+ https://github.com/microsoft/data-formulator
955+ </ Link >
956+ </ Typography >
957+ ) : "" }
958+ placement = "top"
959+ >
960+ < span style = { { cursor : serverConfig . DISABLE_DATABASE ? 'help' : 'pointer' } } >
961+ < Button variant = "text" sx = { { fontSize : "inherit" , gap : 1 } } disabled = { serverConfig . DISABLE_DATABASE } onClick = { ( ) => {
962+ setTableDialogOpen ( true ) ;
1027963 } } >
1028- < CircularProgress size = { 60 } thickness = { 5 } />
1029- </ Box >
1030- ) }
1031- </ Box >
1032- ) ;
1033- }
964+ { buttonElement }
965+ </ Button >
966+ </ span >
967+ </ Tooltip >
968+ < Dialog
969+ key = "db-table-selection-dialog"
970+ onClose = { ( ) => { setTableDialogOpen ( false ) } }
971+ open = { tableDialogOpen }
972+ sx = { { '& .MuiDialog-paper' : { maxWidth : '100%' , maxHeight : 800 , minWidth : 800 } } }
973+ >
974+ < DialogTitle sx = { { display : "flex" } } >
975+ Database
976+ < IconButton
977+ sx = { { marginLeft : "auto" } }
978+ edge = "start"
979+ size = "small"
980+ color = "inherit"
981+ aria-label = "close"
982+ onClick = { ( ) => setTableDialogOpen ( false ) }
983+ >
984+ < CloseIcon fontSize = "inherit" />
985+ </ IconButton >
986+ </ DialogTitle >
987+ < DialogContent sx = { { p : 1 , position : "relative" } } >
988+ { mainContent }
989+ { isUploading && (
990+ < Box sx = { {
991+ position : 'absolute' ,
992+ top : 0 ,
993+ left : 0 ,
994+ width : '100%' ,
995+ height : '100%' ,
996+ display : 'flex' ,
997+ alignItems : 'center' ,
998+ justifyContent : 'center' ,
999+ backgroundColor : 'rgba(255, 255, 255, 0.7)' ,
1000+ zIndex : 1000
1001+ } } >
1002+ < CircularProgress size = { 60 } thickness = { 5 } />
1003+ </ Box >
1004+ ) }
1005+ </ DialogContent >
1006+ </ Dialog >
1007+ </ >
1008+ ) ;
1009+
10341010}
10351011
10361012export const DataLoaderForm : React . FC < {
0 commit comments