diff options
author | Anton Tananaev <anton@traccar.org> | 2023-08-19 13:58:45 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-08-19 13:59:07 -0700 |
commit | d3c7705bedebd65c94f9eea691aaf2fe03b0cafe (patch) | |
tree | 5f98b3d9bbbd4fe8067b5a334e84aff008b8db22 /modern/src/settings/UserConnectionsPage.jsx | |
parent | 0161ae449d4a7bd0781c0665d663353663ab0faf (diff) | |
download | trackermap-web-d3c7705bedebd65c94f9eea691aaf2fe03b0cafe.tar.gz trackermap-web-d3c7705bedebd65c94f9eea691aaf2fe03b0cafe.tar.bz2 trackermap-web-d3c7705bedebd65c94f9eea691aaf2fe03b0cafe.zip |
Move to Vite
Diffstat (limited to 'modern/src/settings/UserConnectionsPage.jsx')
-rw-r--r-- | modern/src/settings/UserConnectionsPage.jsx | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/modern/src/settings/UserConnectionsPage.jsx b/modern/src/settings/UserConnectionsPage.jsx new file mode 100644 index 00000000..80de8835 --- /dev/null +++ b/modern/src/settings/UserConnectionsPage.jsx @@ -0,0 +1,139 @@ +import React from 'react'; +import { useParams } from 'react-router-dom'; +import { + Accordion, + AccordionSummary, + AccordionDetails, + Typography, + Container, +} from '@mui/material'; +import makeStyles from '@mui/styles/makeStyles'; +import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; +import LinkField from '../common/components/LinkField'; +import { useTranslation } from '../common/components/LocalizationProvider'; +import SettingsMenu from './components/SettingsMenu'; +import { formatNotificationTitle } from '../common/util/formatter'; +import PageLayout from '../common/components/PageLayout'; + +const useStyles = makeStyles((theme) => ({ + container: { + marginTop: theme.spacing(2), + }, + details: { + display: 'flex', + flexDirection: 'column', + gap: theme.spacing(2), + paddingBottom: theme.spacing(3), + }, +})); + +const UserConnectionsPage = () => { + const classes = useStyles(); + const t = useTranslation(); + + const { id } = useParams(); + + return ( + <PageLayout + menu={<SettingsMenu />} + breadcrumbs={['settingsTitle', 'settingsUser', 'sharedConnections']} + > + <Container maxWidth="xs" className={classes.container}> + <Accordion defaultExpanded> + <AccordionSummary expandIcon={<ExpandMoreIcon />}> + <Typography variant="subtitle1"> + {t('sharedConnections')} + </Typography> + </AccordionSummary> + <AccordionDetails className={classes.details}> + <LinkField + endpointAll="/api/devices?all=true" + endpointLinked={`/api/devices?userId=${id}`} + baseId={id} + keyBase="userId" + keyLink="deviceId" + label={t('deviceTitle')} + /> + <LinkField + endpointAll="/api/groups?all=true" + endpointLinked={`/api/groups?userId=${id}`} + baseId={id} + keyBase="userId" + keyLink="groupId" + label={t('settingsGroups')} + /> + <LinkField + endpointAll="/api/geofences?all=true" + endpointLinked={`/api/geofences?userId=${id}`} + baseId={id} + keyBase="userId" + keyLink="geofenceId" + label={t('sharedGeofences')} + /> + <LinkField + endpointAll="/api/notifications?all=true" + endpointLinked={`/api/notifications?userId=${id}`} + baseId={id} + keyBase="userId" + keyLink="notificationId" + titleGetter={(it) => formatNotificationTitle(t, it, true)} + label={t('sharedNotifications')} + /> + <LinkField + endpointAll="/api/calendars?all=true" + endpointLinked={`/api/calendars?userId=${id}`} + baseId={id} + keyBase="userId" + keyLink="calendarId" + label={t('sharedCalendars')} + /> + <LinkField + endpointAll="/api/users?all=true" + endpointLinked={`/api/users?userId=${id}`} + baseId={id} + keyBase="userId" + keyLink="managedUserId" + label={t('settingsUsers')} + /> + <LinkField + endpointAll="/api/attributes/computed?all=true" + endpointLinked={`/api/attributes/computed?userId=${id}`} + baseId={id} + keyBase="userId" + keyLink="attributeId" + titleGetter={(it) => it.description} + label={t('sharedComputedAttributes')} + /> + <LinkField + endpointAll="/api/drivers?all=true" + endpointLinked={`/api/drivers?userId=${id}`} + baseId={id} + keyBase="userId" + keyLink="driverId" + label={t('sharedDrivers')} + /> + <LinkField + endpointAll="/api/commands?all=true" + endpointLinked={`/api/commands?userId=${id}`} + baseId={id} + keyBase="userId" + keyLink="commandId" + titleGetter={(it) => it.description} + label={t('sharedSavedCommands')} + /> + <LinkField + endpointAll="/api/maintenance?all=true" + endpointLinked={`/api/maintenance?userId=${id}`} + baseId={id} + keyBase="userId" + keyLink="maintenanceId" + label={t('sharedMaintenance')} + /> + </AccordionDetails> + </Accordion> + </Container> + </PageLayout> + ); +}; + +export default UserConnectionsPage; |