|  |  |  | 
|---|
|  |  |  | SelectColumnsButton, | 
|---|
|  |  |  | EditButton, | 
|---|
|  |  |  | FilterButton, | 
|---|
|  |  |  | CreateButton, | 
|---|
|  |  |  | useRefresh, | 
|---|
|  |  |  | ExportButton, | 
|---|
|  |  |  | BulkDeleteButton, | 
|---|
|  |  |  | WrapperField, | 
|---|
|  |  |  | 
|---|
|  |  |  | import { AgvListFilter } from "./AgvListFilter"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const AgvGrid = () => { | 
|---|
|  |  |  | const { identity } = useGetIdentity(); | 
|---|
|  |  |  | const [createDialog, setCreateDialog] = useState(false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!identity) return null; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | <ListBase perPage={50} sort={{ field: "uuid", order: "asc" }}> | 
|---|
|  |  |  | <ListBase perPage={50} sort={{ field: "create_time", order: "asc" }}> | 
|---|
|  |  |  | <AgvGridLayout | 
|---|
|  |  |  | setCreateDialog={setCreateDialog} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const AgvGridLayout = ({ setCreateDialog }) => { | 
|---|
|  |  |  | const refresh = useRefresh(); | 
|---|
|  |  |  | const { data, isPending, filterValues } = useListContext(); | 
|---|
|  |  |  | const hasFilters = filterValues && Object.keys(filterValues).length > 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | React.useEffect(() => { | 
|---|
|  |  |  | const intervalId = setInterval(() => { | 
|---|
|  |  |  | refresh(); | 
|---|
|  |  |  | }, 2000); | 
|---|
|  |  |  | return () => clearInterval(intervalId); | 
|---|
|  |  |  | }, [refresh]); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (isPending) return null; | 
|---|
|  |  |  | if (!data?.length && !hasFilters) return <EmptyData onClick={() => { setCreateDialog(true) }} />; | 
|---|
|  |  |  |  | 
|---|