|
|
@ -1,5 +1,5 @@ |
|
|
|
import { AppBar, Autocomplete, Box, CircularProgress, Dialog, Grid, IconButton, TextField, Toolbar } from '@mui/material' |
|
|
|
import { Fragment, useEffect, useState } from 'react' |
|
|
|
import { Fragment, useState } from 'react' |
|
|
|
import { IRegion } from '../interfaces/fuel' |
|
|
|
import { useRegions, useServers, useServersInfo } from '../hooks/swrHooks' |
|
|
|
import FullFeaturedCrudGrid from './TableEditable' |
|
|
@ -14,7 +14,6 @@ import CardInfoChip from './CardInfo/CardInfoChip' |
|
|
|
import { useDebounce } from '@uidotdev/usehooks' |
|
|
|
|
|
|
|
export default function ServersView() { |
|
|
|
const [options, setOptions] = useState<IRegion[]>([]) |
|
|
|
const [search, setSearch] = useState<string | null>("") |
|
|
|
|
|
|
|
const debouncedSearch = useDebounce(search, 500) |
|
|
@ -28,12 +27,6 @@ export default function ServersView() { |
|
|
|
const [serverDataOpen, setServerDataOpen] = useState(false) |
|
|
|
const [currentServerData, setCurrentServerData] = useState<any | null>(null) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (regions) { |
|
|
|
setOptions([...regions]) |
|
|
|
} |
|
|
|
}, [regions]) |
|
|
|
|
|
|
|
const { servers, isLoading: serversLoading } = useServers(selectedOption?.id, 0, 10) |
|
|
|
|
|
|
|
const serversColumns: GridColDef[] = [ |
|
|
@ -58,7 +51,7 @@ export default function ServersView() { |
|
|
|
}} |
|
|
|
isOptionEqualToValue={(option: IRegion, value: IRegion) => option.name === value.name} |
|
|
|
getOptionLabel={(option: IRegion) => option.name ? option.name : ""} |
|
|
|
options={options} |
|
|
|
options={regions || []} |
|
|
|
loading={isLoading} |
|
|
|
value={params.value} |
|
|
|
renderInput={(params) => ( |
|
|
@ -147,7 +140,7 @@ export default function ServersView() { |
|
|
|
onChange={(_, value) => setSelectedOption(value)} |
|
|
|
isOptionEqualToValue={(option: IRegion, value: IRegion) => option.id === value.id} |
|
|
|
getOptionLabel={(option: IRegion) => option.name ? option.name : ""} |
|
|
|
options={options} |
|
|
|
options={regions || []} |
|
|
|
loading={isLoading} |
|
|
|
value={selectedOption} |
|
|
|
renderInput={(params) => ( |
|
|
|