Grids: refresh button (small icon, right of the filters button)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
dc72cf2869
commit
31771e3c73
|
|
@ -8,6 +8,7 @@ import {
|
|||
import CheckIcon from '@mui/icons-material/Check';
|
||||
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
||||
import FilterListIcon from '@mui/icons-material/FilterList';
|
||||
import RefreshIcon from '@mui/icons-material/Refresh';
|
||||
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
||||
import EditOutlined from '@mui/icons-material/EditOutlined';
|
||||
import VisibilityOutlined from '@mui/icons-material/VisibilityOutlined';
|
||||
|
|
@ -145,8 +146,21 @@ export function DataGrid<T>({ meta }: DataGridProps<T>) {
|
|||
const columns = meta.visualLtr && rtl ? [...meta.columns].reverse() : meta.columns;
|
||||
const actionsBefore = !!meta.visualLtr && !rtl;
|
||||
|
||||
// reloads the current page with the same filters (nothing to load while a required filter is missing)
|
||||
const hasFilterCard = !!meta.status || filterDefs.length > 0;
|
||||
const refreshButton = (
|
||||
<Tooltip title={t('grid.refresh')}>
|
||||
<span>
|
||||
<IconButton size="small" aria-label={t('grid.refresh')} color="primary" disabled={!canLoad || q.isFetching} onClick={() => void q.refetch()}>
|
||||
<RefreshIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
return (
|
||||
<Stack spacing={1.5}>
|
||||
{!hasFilterCard && <Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>{refreshButton}</Box>}
|
||||
{/* filter card: status chips + filter button, then the applied filters with "clear all" (same look on every list) */}
|
||||
{(meta.status || filterDefs.length > 0) && (
|
||||
<Paper variant="outlined" sx={{ p: 2 }}>
|
||||
|
|
@ -178,6 +192,7 @@ export function DataGrid<T>({ meta }: DataGridProps<T>) {
|
|||
})}
|
||||
</Stack>
|
||||
) : <Box sx={{ flex: 1 }} />}
|
||||
{refreshButton}
|
||||
{filterDefs.length > 0 && (
|
||||
<Badge
|
||||
badgeContent={drawerCount}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ export const ui = {
|
|||
'grid.displayedRows': { en: '{from}-{to} of {count}', ar: '{from}-{to} من {count}' },
|
||||
'grid.filterTitle': { en: 'Filter results', ar: 'تصفية النتائج' },
|
||||
'grid.status': { en: 'Status', ar: 'الحالة' },
|
||||
'grid.clearAll': { en: 'Clear all', ar: 'مسح الكل' },
|
||||
'grid.refresh': { en: 'Refresh', ar: 'تحديث' },
|
||||
'grid.clearAll':{ en: 'Clear all', ar: 'مسح الكل' },
|
||||
'grid.requireFilter': { en: 'Choose at least one filter to load this list.', ar: 'اختر معياراً واحداً على الأقل لتحميل هذه القائمة.' },
|
||||
|
||||
// dialogs / overlay
|
||||
|
|
|
|||
Loading…
Reference in New Issue