diff --git a/frontend/src/components/DatabaseTablesGrid.tsx b/frontend/src/components/DatabaseTablesGrid.tsx index a8ed772..2c6b466 100644 --- a/frontend/src/components/DatabaseTablesGrid.tsx +++ b/frontend/src/components/DatabaseTablesGrid.tsx @@ -1,17 +1,17 @@ import React, { useState, useEffect, useCallback } from 'react'; -import { - Box, - Paper, - Typography, - Button, - Stack, - Checkbox +import { + Box, + Paper, + Typography, + Button, + Stack, + Checkbox } from '@mui/material'; -import { - TableChart, - CleaningServices, - Close, - Save +import { + TableChart, + CleaningServices, + Close, + Save } from '@mui/icons-material'; import { DataGrid, type GridColDef } from '@mui/x-data-grid'; import { SchemaService } from '../services/api'; @@ -47,7 +47,7 @@ const DatabaseTablesGrid: React.FC = ({ database, setNo const handleBulkAction = async (action: 'truncate' | 'drop' | 'optimize') => { if (selectionModel.length === 0) return; - + const confirmMsg = `Are you sure you want to ${action} ${selectionModel.length} selected tables? This action is irreversible!`; if (!window.confirm(confirmMsg)) return; @@ -79,7 +79,7 @@ const DatabaseTablesGrid: React.FC = ({ database, setNo }; const toggleRow = (name: string) => { - setSelectionModel(prev => + setSelectionModel(prev => prev.includes(name) ? prev.filter(n => n !== name) : [...prev, name] ); }; @@ -100,16 +100,16 @@ const DatabaseTablesGrid: React.FC = ({ database, setNo sortable: false, filterable: false, renderHeader: () => ( - 0 && selectionModel.length < tableRows.length} checked={tableRows.length > 0 && selectionModel.length === tableRows.length} onChange={toggleAll} /> ), renderCell: (params) => ( - { e.stopPropagation(); @@ -118,14 +118,14 @@ const DatabaseTablesGrid: React.FC = ({ database, setNo /> ) }, - { - field: 'name', - headerName: 'Table Name', - flex: 1, + { + field: 'name', + headerName: 'Table Name', + flex: 1, minWidth: 200, renderCell: (params) => ( - )} - diff --git a/frontend/src/components/TechnicalOverview.tsx b/frontend/src/components/TechnicalOverview.tsx index 954aee4..bbc35d5 100644 --- a/frontend/src/components/TechnicalOverview.tsx +++ b/frontend/src/components/TechnicalOverview.tsx @@ -1,19 +1,25 @@ import React, { useState, useEffect, useCallback } from 'react'; -import { - Box, - Paper, - Typography, - Button, - CircularProgress, - Alert +import { + Box, + Paper, + Typography, + Button, + CircularProgress, + Alert, + Table, + TableBody, + TableCell, + TableContainer, + TableRow, + Avatar } from '@mui/material'; -import { - Terminal, - TableChart, - CleaningServices, - Save, - History, - Info +import { + Terminal, + TableChart, + CleaningServices, + Save, + History, + Info } from '@mui/icons-material'; import { SchemaService } from '../services/api'; import ConfirmDialog from './ConfirmDialog'; @@ -34,7 +40,7 @@ const TechnicalOverview: React.FC = ({ database, table, const fetchMeta = useCallback(async () => { setLoadingMeta(true); try { - const res = table + const res = table ? await SchemaService.getTableMetadata(database, table) : await SchemaService.getDatabaseMetadata(database); setMeta(res.data); @@ -98,9 +104,9 @@ const TechnicalOverview: React.FC = ({ database, table, Technical Specifications: {table ? `${database}.${table}` : database} {table && ( - - - )} + + + + {/* Export Row */} + {(mode === 'export' || mode === 'both') && ( + + + + + + + + Export {activeTable ? 'Table' : 'Database'} + + Create a full backup of the current {activeTable ? 'table' : 'database'}:
+ + {activeTable ? `${activeDatabase}.${activeTable}` : (activeDatabase || 'All Databases')} + +
+
+ + + +
+ )} - {/* Import Card */} - {(mode === 'import' || mode === 'both') && ( - - - - - Import {activeTable ? 'Table' : 'Database'} - - Upload a .sql file to restore or migrate your {activeTable ? 'table' : 'database'}. - - - - - - {file ? file.name : "Click or drag .sql file here"} - - - - - - - )} - + {/* Import Row */} + {(mode === 'import' || mode === 'both') && ( + + + + + + + + Import {activeTable ? 'Table' : 'Database'} + + Upload a .sql file to restore or migrate your {activeTable ? 'table' : 'database'}. + + + + + + + {file ? file.name : "Select or drag .sql file here"} + + + + + + + + )} +
+
+
{loading && (