diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-08 14:52:01 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-08 14:52:01 -0700 |
commit | 176ef4d766fa4bbe230849190b8695380ad10822 (patch) | |
tree | bb083a7bd7c3cefb5c09f4ef60593756f1b34cdd /modern | |
parent | 4d17b6baf8f3745478eb105c6ee196ebf4ceb7c7 (diff) | |
download | trackermap-web-176ef4d766fa4bbe230849190b8695380ad10822.tar.gz trackermap-web-176ef4d766fa4bbe230849190b8695380ad10822.tar.bz2 trackermap-web-176ef4d766fa4bbe230849190b8695380ad10822.zip |
Organize router
Diffstat (limited to 'modern')
-rw-r--r-- | modern/src/App.js | 45 | ||||
-rw-r--r-- | modern/src/common/components/BottomMenu.js | 4 | ||||
-rw-r--r-- | modern/src/main/DevicesList.js | 2 | ||||
-rw-r--r-- | modern/src/main/MainPage.js | 2 | ||||
-rw-r--r-- | modern/src/main/StatusCard.js | 4 | ||||
-rw-r--r-- | modern/src/map/GeofenceEditMap.js | 2 | ||||
-rw-r--r-- | modern/src/other/GeofencesList.js | 2 | ||||
-rw-r--r-- | modern/src/other/PositionPage.js (renamed from modern/src/main/PositionPage.js) | 0 | ||||
-rw-r--r-- | modern/src/settings/UsersPage.js | 2 | ||||
-rw-r--r-- | modern/src/settings/components/OptionsLayout.js | 8 |
10 files changed, 37 insertions, 34 deletions
diff --git a/modern/src/App.js b/modern/src/App.js index 702006f3..6305d487 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -15,7 +15,7 @@ import NotificationsPage from './settings/NotificationsPage'; import NotificationPage from './settings/NotificationPage'; import GroupsPage from './settings/GroupsPage'; import GroupPage from './settings/GroupPage'; -import PositionPage from './main/PositionPage'; +import PositionPage from './other/PositionPage'; import EventReportPage from './reports/EventReportPage'; import ReplayPage from './other/ReplayPage'; import TripReportPage from './reports/TripReportPage'; @@ -111,39 +111,42 @@ const App = () => { <div className={classes.page}> <Switch> <Route exact path="/" component={MainPage} /> - <Route exact path="/replay" component={ReplayPage} /> + <Route exact path="/position/:id?" component={PositionPage} /> <Route exact path="/event/:id?" component={EventPage} /> - <Route exact path="/user/:id?" component={UserPage} /> - <Route exact path="/device/:id?" component={DevicePage} /> - <Route exact path="/geofence/:id?" component={GeofencePage} /> + <Route exact path="/replay" component={ReplayPage} /> <Route exact path="/geofences" component={GeofencesPage} /> + <Route exact path="/settings/accumulators/:deviceId?" component={AccumulatorsPage} /> - <Route exact path="/settings/preferences" component={PreferencesPage} /> - <Route exact path="/settings/notifications" component={NotificationsPage} /> - <Route exact path="/settings/notification/:id?" component={NotificationPage} /> - <Route exact path="/settings/groups" component={GroupsPage} /> - <Route exact path="/settings/group/:id?" component={GroupPage} /> - <Route exact path="/settings/drivers" component={DriversPage} /> - <Route exact path="/settings/driver/:id?" component={DriverPage} /> <Route exact path="/settings/calendars" component={CalendarsPage} /> <Route exact path="/settings/calendar/:id?" component={CalendarPage} /> + <Route exact path="/settings/commands" component={CommandsPage} /> + <Route exact path="/settings/command/:id?" component={CommandPage} /> + <Route exact path="/settings/command-send/:deviceId?" component={CommandSendPage} /> <Route exact path="/settings/attributes" component={ComputedAttributesPage} /> <Route exact path="/settings/attribute/:id?" component={ComputedAttributePage} /> + <Route exact path="/settings/device/:id?" component={DevicePage} /> + <Route exact path="/settings/drivers" component={DriversPage} /> + <Route exact path="/settings/driver/:id?" component={DriverPage} /> + <Route exact path="/settings/geofence/:id?" component={GeofencePage} /> + <Route exact path="/settings/groups" component={GroupsPage} /> + <Route exact path="/settings/group/:id?" component={GroupPage} /> <Route exact path="/settings/maintenances" component={MaintenancesPage} /> <Route exact path="/settings/maintenance/:id?" component={MaintenancePage} /> - <Route exact path="/settings/commands" component={CommandsPage} /> - <Route exact path="/settings/command/:id?" component={CommandPage} /> - <Route exact path="/command/:deviceId?" component={CommandSendPage} /> - <Route exact path="/admin/server" component={ServerPage} /> - <Route exact path="/admin/users" component={UsersPage} /> - <Route exact path="/admin/statistics" component={StatisticsPage} /> - <Route exact path="/reports/route" component={RouteReportPage} /> + <Route exact path="/settings/notifications" component={NotificationsPage} /> + <Route exact path="/settings/notification/:id?" component={NotificationPage} /> + <Route exact path="/settings/preferences" component={PreferencesPage} /> + <Route exact path="/settings/server" component={ServerPage} /> + <Route exact path="/settings/users" component={UsersPage} /> + <Route exact path="/settings/user/:id?" component={UserPage} /> + + <Route exact path="/reports/chart" component={ChartReportPage} /> <Route exact path="/reports/event" component={EventReportPage} /> - <Route exact path="/reports/trip" component={TripReportPage} /> + <Route exact path="/reports/route" component={RouteReportPage} /> + <Route exact path="/reports/statistics" component={StatisticsPage} /> <Route exact path="/reports/stop" component={StopReportPage} /> <Route exact path="/reports/summary" component={SummaryReportPage} /> - <Route exact path="/reports/chart" component={ChartReportPage} /> + <Route exact path="/reports/trip" component={TripReportPage} /> </Switch> </div> {!desktop && ( diff --git a/modern/src/common/components/BottomMenu.js b/modern/src/common/components/BottomMenu.js index 3865de29..048cb0d7 100644 --- a/modern/src/common/components/BottomMenu.js +++ b/modern/src/common/components/BottomMenu.js @@ -27,7 +27,7 @@ const BottomMenu = () => { const [anchorEl, setAnchorEl] = useState(null); const currentSelection = () => { - if (location.pathname.startsWith('/user')) { + if (location.pathname.startsWith('/settings/user')) { return 3; } if (location.pathname.startsWith('/settings')) { return 2; @@ -41,7 +41,7 @@ const BottomMenu = () => { const handleAccount = () => { setAnchorEl(null); - history.push(`/user/${userId}`); + history.push(`/settings/user/${userId}`); }; const handleLogout = async () => { diff --git a/modern/src/main/DevicesList.js b/modern/src/main/DevicesList.js index 57778667..4da93547 100644 --- a/modern/src/main/DevicesList.js +++ b/modern/src/main/DevicesList.js @@ -189,7 +189,7 @@ const DeviceView = ({ updateTimestamp, onMenuClick, filter }) => { }; const DevicesList = ({ filter }) => ( - <EditCollectionView content={DeviceView} editPath="/device" endpoint="devices" disableAdd filter={filter} /> + <EditCollectionView content={DeviceView} editPath="/settings/device" endpoint="devices" disableAdd filter={filter} /> ); export default DevicesList; diff --git a/modern/src/main/MainPage.js b/modern/src/main/MainPage.js index 569978af..2f3ed3dc 100644 --- a/modern/src/main/MainPage.js +++ b/modern/src/main/MainPage.js @@ -179,7 +179,7 @@ const MainPage = () => { placeholder={t('sharedSearchDevices')} variant="filled" /> - <IconButton onClick={() => history.push('/device')} disabled={deviceReadonly}> + <IconButton onClick={() => history.push('/settings/device')} disabled={deviceReadonly}> <AddIcon /> </IconButton> {!isTablet && ( diff --git a/modern/src/main/StatusCard.js b/modern/src/main/StatusCard.js index 46d288c6..f49799b5 100644 --- a/modern/src/main/StatusCard.js +++ b/modern/src/main/StatusCard.js @@ -109,10 +109,10 @@ const StatusCard = ({ deviceId, onClose }) => { <IconButton onClick={() => history.push('/replay')} disabled={!position}> <ReplayIcon /> </IconButton> - <IconButton onClick={() => history.push(`/command/${deviceId}`)} disabled={readonly}> + <IconButton onClick={() => history.push(`/settings/command-send/${deviceId}`)} disabled={readonly}> <PublishIcon /> </IconButton> - <IconButton onClick={() => history.push(`/device/${deviceId}`)} disabled={deviceReadonly}> + <IconButton onClick={() => history.push(`/settings/device/${deviceId}`)} disabled={deviceReadonly}> <EditIcon /> </IconButton> <IconButton onClick={() => setRemoveDialogShown(true)} disabled={deviceReadonly} className={classes.negative}> diff --git a/modern/src/map/GeofenceEditMap.js b/modern/src/map/GeofenceEditMap.js index 2fa7a7b4..2eb86321 100644 --- a/modern/src/map/GeofenceEditMap.js +++ b/modern/src/map/GeofenceEditMap.js @@ -65,7 +65,7 @@ const GeofenceEditMap = () => { }); if (response.ok) { const item = await response.json(); - history.push(`/geofence/${item.id}`); + history.push(`/settings/geofence/${item.id}`); } }; diff --git a/modern/src/other/GeofencesList.js b/modern/src/other/GeofencesList.js index b4fde749..d0d0853f 100644 --- a/modern/src/other/GeofencesList.js +++ b/modern/src/other/GeofencesList.js @@ -50,7 +50,7 @@ const GeofenceView = ({ onMenuClick }) => { }; const GeofencesList = () => ( - <EditCollectionView content={GeofenceView} editPath="/geofence" endpoint="geofences" disableAdd /> + <EditCollectionView content={GeofenceView} editPath="/settings/geofence" endpoint="geofences" disableAdd /> ); export default GeofencesList; diff --git a/modern/src/main/PositionPage.js b/modern/src/other/PositionPage.js index ecb4095d..ecb4095d 100644 --- a/modern/src/main/PositionPage.js +++ b/modern/src/other/PositionPage.js diff --git a/modern/src/settings/UsersPage.js b/modern/src/settings/UsersPage.js index 07c859d5..bdadf845 100644 --- a/modern/src/settings/UsersPage.js +++ b/modern/src/settings/UsersPage.js @@ -63,7 +63,7 @@ const UsersView = ({ updateTimestamp, onMenuClick }) => { const UsersPage = () => ( <OptionsLayout> - <EditCollectionView content={UsersView} editPath="/user" endpoint="users" /> + <EditCollectionView content={UsersView} editPath="/settings/user" endpoint="users" /> </OptionsLayout> ); diff --git a/modern/src/settings/components/OptionsLayout.js b/modern/src/settings/components/OptionsLayout.js index ea4a4e1f..af104b01 100644 --- a/modern/src/settings/components/OptionsLayout.js +++ b/modern/src/settings/components/OptionsLayout.js @@ -80,7 +80,7 @@ const OptionsLayout = ({ children }) => { const mainRoutes = useMemo(() => [ { name: t('sharedNotifications'), href: '/settings/notifications', icon: <NotificationsIcon /> }, - { name: t('settingsUser'), href: `/user/${userId}`, icon: <PersonIcon /> }, + { name: t('settingsUser'), href: `/settings/user/${userId}`, icon: <PersonIcon /> }, { name: t('sharedGeofences'), href: '/geofences', icon: <CreateIcon /> }, { name: t('settingsGroups'), href: '/settings/groups', icon: <FolderIcon /> }, { name: t('sharedDrivers'), href: '/settings/drivers', icon: <PersonIcon /> }, @@ -92,9 +92,9 @@ const OptionsLayout = ({ children }) => { const adminRoutes = useMemo(() => [ { subheader: t('userAdmin') }, - { name: t('settingsServer'), href: '/admin/server', icon: <StorageIcon /> }, - { name: t('settingsUsers'), href: '/admin/users', icon: <PeopleIcon /> }, - { name: t('statisticsTitle'), href: '/admin/statistics', icon: <BarChartIcon /> }, + { name: t('settingsServer'), href: '/settings/server', icon: <StorageIcon /> }, + { name: t('settingsUsers'), href: '/settings/users', icon: <PeopleIcon /> }, + { name: t('statisticsTitle'), href: '/reports/statistics', icon: <BarChartIcon /> }, ], [t]); const routes = useMemo(() => ( |