(null)
-
- const handleCityInputChange = (value: string) => {
- setCitiesSearch(value)
+ function CustomTabPanel(props: TabPanelProps) {
+ const { children, value, index, ...other } = props;
+
+ return (
+
+ {value === index && {children}}
+
+ );
}
- const handleCityOptionChange = (value: ICity | null) => {
- setSelectedCityOption(value)
- }
-
- useEffect(() => {
- if (cities) {
- setCitiesOptions([...cities])
- }
- }, [cities])
-
- useEffect(() => {
- const handler = setTimeout(() => {
- setDebouncedCitySearch(citiesSearch)
- }, 500)
-
- return () => {
- clearTimeout(handler)
- }
- }, [citiesSearch])
-
- useEffect(() => {
- setCitiesPage(1)
- setCitiesSearch("")
- }, [])
-
- const { servers, isLoading: serversLoading } = useServers(selectedOption?.id, 0, 10)
-
- const serversColumns: GridColDef[] = [
- //{ field: 'id', headerName: 'ID', type: "number" },
- { field: 'name', headerName: 'Название', type: "string", editable: true },
- ]
-
- const [serverDataOpen, setServerDataOpen] = useState(false)
- const [currentServerData, setCurrentServerData] = useState(null)
-
- const { serversInfo } = useServersInfo(selectedOption?.id)
-
return (
-
-
-
- Servers by region
-
-
- {
- setOpen(true)
- }}
- onClose={() => {
- setOpen(false)
- }}
- onInputChange={(_, value) => handleInputChange(value)}
- onChange={(_, value) => handleOptionChange(value)}
- filterOptions={(x) => x}
- isOptionEqualToValue={(option: IRegion, value: IRegion) => option.name === value.name}
- getOptionLabel={(option: IRegion) => option.name ? option.name : ""}
- options={options}
- loading={isLoading}
- value={selectedOption}
- renderInput={(params) => (
-
- {isLoading ? : null}
- {params.InputProps.endAdornment}
-
- )
- }}
- />
- )}
- />
-
- {
- setCitiesOpen(true)
- }}
- onClose={() => {
- setCitiesOpen(false)
- }}
- onInputChange={(_, value) => handleCityInputChange(value)}
- onChange={(_, value) => handleCityOptionChange(value)}
- filterOptions={(x) => x}
- isOptionEqualToValue={(option: ICity, value: ICity) => option.name === value.name}
- getOptionLabel={(option: ICity) => option.name ? option.name : ""}
- options={citiesOptions}
- loading={citiesLoading}
- value={selectedCityOption}
- renderInput={(params) => (
-
- {citiesLoading ? : null}
- {params.InputProps.endAdornment}
-
- )
- }}
- />
- )}
- />
-
- {servers &&
-
-
- Информация
-
-
- {serversInfo &&
-
- {serversInfo.map((serverInfo: IServersInfo) => (
-
-
-
- {serverInfo.name}
-
-
-
-
-
-
- Количество IP:
-
-
-
- {serverInfo.IPs_count}
-
-
-
-
-
- Количество серверов:
-
-
-
- {serverInfo.servers_count}
-
-
-
- : serverInfo.status === "Offline" ? : }
- variant="outlined"
- label={serverInfo.status}
- color={serverInfo.status === "Online" ? "success" : serverInfo.status === "Offline" ? "error" : "error"}
- />
-
-
- ))}
-
- }
-
- }
-
- {serversLoading ?
-
- :
- servers &&
- {
- setCurrentServerData(params.row)
- setServerDataOpen(true)
- }}
- />
- }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{/*