diff options
author | Anton Tananaev <anton@traccar.org> | 2023-07-22 07:49:09 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-07-22 07:49:09 -0700 |
commit | 2a281113650977f6e40f4f7a4daa2a11dea61d8a (patch) | |
tree | 9bb64dd24a46347df5c9ddab2d956051506d155e | |
parent | 4b50a30e2ff1c64a3e2e4a34651d1695953cae1f (diff) | |
download | trackermap-web-2a281113650977f6e40f4f7a4daa2a11dea61d8a.tar.gz trackermap-web-2a281113650977f6e40f4f7a4daa2a11dea61d8a.tar.bz2 trackermap-web-2a281113650977f6e40f4f7a4daa2a11dea61d8a.zip |
Fix server selection issues
-rw-r--r-- | modern/src/Navigation.js | 2 | ||||
-rw-r--r-- | modern/src/login/ChangeServerPage.js (renamed from modern/src/other/ChangeServerPage.js) | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/modern/src/Navigation.js b/modern/src/Navigation.js index d9ca1817..ad02106c 100644 --- a/modern/src/Navigation.js +++ b/modern/src/Navigation.js @@ -48,7 +48,7 @@ import AccumulatorsPage from './settings/AccumulatorsPage'; import CommandDevicePage from './settings/CommandDevicePage'; import CommandGroupPage from './settings/CommandGroupPage'; import App from './App'; -import ChangeServerPage from './other/ChangeServerPage'; +import ChangeServerPage from './login/ChangeServerPage'; import DevicesPage from './settings/DevicesPage'; import ScheduledPage from './reports/ScheduledPage'; import DeviceConnectionsPage from './settings/DeviceConnectionsPage'; diff --git a/modern/src/other/ChangeServerPage.js b/modern/src/login/ChangeServerPage.js index 0343a941..a92536d0 100644 --- a/modern/src/other/ChangeServerPage.js +++ b/modern/src/login/ChangeServerPage.js @@ -2,8 +2,9 @@ import React from 'react'; import ElectricalServicesIcon from '@mui/icons-material/ElectricalServices'; import { makeStyles } from '@mui/styles'; import { - Autocomplete, Container, createFilterOptions, TextField, + Autocomplete, Button, Container, createFilterOptions, TextField, } from '@mui/material'; +import { useNavigate } from 'react-router-dom'; import { useTranslation } from '../common/components/LocalizationProvider'; const currentServer = `${window.location.protocol}//${window.location.host}`; @@ -36,6 +37,7 @@ const useStyles = makeStyles((theme) => ({ const ChangeServerPage = () => { const classes = useStyles(); + const navigate = useNavigate(); const t = useTranslation(); const filter = createFilterOptions(); @@ -59,7 +61,7 @@ const ChangeServerPage = () => { options={officialServers} renderInput={(params) => <TextField {...params} label={t('settingsServer')} />} value={currentServer} - onChange={(_, value) => handleSubmit(value)} + onChange={(_, value) => value && handleSubmit(value)} filterOptions={(options, params) => { const filtered = filter(options, params); if (params.inputValue && !filtered.includes(params.inputValue)) { @@ -68,6 +70,12 @@ const ChangeServerPage = () => { return filtered; }} /> + <Button + onClick={() => navigate(-1)} + color="secondary" + > + {t('sharedCancel')} + </Button> </Container> ); }; |