aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings
diff options
context:
space:
mode:
authorDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-01 14:03:37 +0000
committerDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-01 14:03:37 +0000
commite5b727e1bc85e6c38a15c8917aae57a70533da46 (patch)
treebdef36c1f371aae8293f277f187d58bc90d2e194 /modern/src/settings
parent70fd67f635fbcd75ceab50934419999cdb71e78e (diff)
downloadetbsa-traccar-web-e5b727e1bc85e6c38a15c8917aae57a70533da46.tar.gz
etbsa-traccar-web-e5b727e1bc85e6c38a15c8917aae57a70533da46.tar.bz2
etbsa-traccar-web-e5b727e1bc85e6c38a15c8917aae57a70533da46.zip
Apply OptionsLayout to settings pages
Diffstat (limited to 'modern/src/settings')
-rw-r--r--modern/src/settings/ComputedAttributesPage.js34
-rw-r--r--modern/src/settings/DriversPage.js26
-rw-r--r--modern/src/settings/GroupsPage.js26
-rw-r--r--modern/src/settings/MaintenancesPage.js26
-rw-r--r--modern/src/settings/NotificationsPage.js32
5 files changed, 90 insertions, 54 deletions
diff --git a/modern/src/settings/ComputedAttributesPage.js b/modern/src/settings/ComputedAttributesPage.js
index 1a6feab..49c35d6 100644
--- a/modern/src/settings/ComputedAttributesPage.js
+++ b/modern/src/settings/ComputedAttributesPage.js
@@ -6,19 +6,22 @@ import { useSelector } from 'react-redux';
import t from '../common/localization';
import { useEffectAsync } from '../reactHelper';
import EditCollectionView from '../EditCollectionView';
+import OptionsLayout from './OptionsLayout';
const useStyles = makeStyles(theme => ({
columnAction: {
width: theme.spacing(1),
- padding: theme.spacing(0, 1),
- },
+ padding: theme.spacing(0, 1)
+ }
}));
const ComputedAttributeView = ({ updateTimestamp, onMenuClick }) => {
const classes = useStyles();
const [items, setItems] = useState([]);
- const adminEnabled = useSelector(state => state.session.user && state.session.user.administrator);
+ const adminEnabled = useSelector(
+ state => state.session.user && state.session.user.administrator
+ );
useEffectAsync(async () => {
const response = await fetch('/api/attributes/computed');
@@ -40,15 +43,17 @@ const ComputedAttributeView = ({ updateTimestamp, onMenuClick }) => {
</TableRow>
</TableHead>
<TableBody>
- {items.map((item) => (
+ {items.map(item => (
<TableRow key={item.id}>
- {adminEnabled &&
+ {adminEnabled && (
<TableCell className={classes.columnAction} padding="none">
- <IconButton onClick={(event) => onMenuClick(event.currentTarget, item.id)}>
+ <IconButton
+ onClick={event => onMenuClick(event.currentTarget, item.id)}
+ >
<MoreVertIcon />
</IconButton>
</TableCell>
- }
+ )}
<TableCell>{item.description}</TableCell>
<TableCell>{item.attribute}</TableCell>
<TableCell>{item.expression}</TableCell>
@@ -59,15 +64,18 @@ const ComputedAttributeView = ({ updateTimestamp, onMenuClick }) => {
</Table>
</TableContainer>
);
-}
+};
const ComputedAttributesPage = () => {
return (
- <>
- <MainToolbar />
- <EditCollectionView content={ComputedAttributeView} editPath="/settings/attribute" endpoint="attributes/computed" />
- </>
+ <OptionsLayout>
+ <EditCollectionView
+ content={ComputedAttributeView}
+ editPath="/settings/attribute"
+ endpoint="attributes/computed"
+ />
+ </OptionsLayout>
);
-}
+};
export default ComputedAttributesPage;
diff --git a/modern/src/settings/DriversPage.js b/modern/src/settings/DriversPage.js
index 957e225..13cb1c6 100644
--- a/modern/src/settings/DriversPage.js
+++ b/modern/src/settings/DriversPage.js
@@ -5,12 +5,13 @@ import MoreVertIcon from '@material-ui/icons/MoreVert';
import t from '../common/localization';
import { useEffectAsync } from '../reactHelper';
import EditCollectionView from '../EditCollectionView';
+import OptionsLayout from './OptionsLayout';
const useStyles = makeStyles(theme => ({
columnAction: {
width: theme.spacing(1),
- padding: theme.spacing(0, 1),
- },
+ padding: theme.spacing(0, 1)
+ }
}));
const DriversView = ({ updateTimestamp, onMenuClick }) => {
@@ -36,10 +37,12 @@ const DriversView = ({ updateTimestamp, onMenuClick }) => {
</TableRow>
</TableHead>
<TableBody>
- {items.map((item) => (
+ {items.map(item => (
<TableRow key={item.id}>
<TableCell className={classes.columnAction} padding="none">
- <IconButton onClick={(event) => onMenuClick(event.currentTarget, item.id)}>
+ <IconButton
+ onClick={event => onMenuClick(event.currentTarget, item.id)}
+ >
<MoreVertIcon />
</IconButton>
</TableCell>
@@ -51,15 +54,18 @@ const DriversView = ({ updateTimestamp, onMenuClick }) => {
</Table>
</TableContainer>
);
-}
+};
const DriversPage = () => {
return (
- <>
- <MainToolbar />
- <EditCollectionView content={DriversView} editPath="/settings/driver" endpoint="drivers" />
- </>
+ <OptionsLayout>
+ <EditCollectionView
+ content={DriversView}
+ editPath="/settings/driver"
+ endpoint="drivers"
+ />
+ </OptionsLayout>
);
-}
+};
export default DriversPage;
diff --git a/modern/src/settings/GroupsPage.js b/modern/src/settings/GroupsPage.js
index e274062..2de6241 100644
--- a/modern/src/settings/GroupsPage.js
+++ b/modern/src/settings/GroupsPage.js
@@ -5,12 +5,13 @@ import MoreVertIcon from '@material-ui/icons/MoreVert';
import t from '../common/localization';
import { useEffectAsync } from '../reactHelper';
import EditCollectionView from '../EditCollectionView';
+import OptionsLayout from './OptionsLayout';
const useStyles = makeStyles(theme => ({
columnAction: {
width: theme.spacing(1),
- padding: theme.spacing(0, 1),
- },
+ padding: theme.spacing(0, 1)
+ }
}));
const GroupsView = ({ updateTimestamp, onMenuClick }) => {
@@ -35,10 +36,12 @@ const GroupsView = ({ updateTimestamp, onMenuClick }) => {
</TableRow>
</TableHead>
<TableBody>
- {items.map((item) => (
+ {items.map(item => (
<TableRow key={item.id}>
<TableCell className={classes.columnAction} padding="none">
- <IconButton onClick={(event) => onMenuClick(event.currentTarget, item.id)}>
+ <IconButton
+ onClick={event => onMenuClick(event.currentTarget, item.id)}
+ >
<MoreVertIcon />
</IconButton>
</TableCell>
@@ -49,15 +52,18 @@ const GroupsView = ({ updateTimestamp, onMenuClick }) => {
</Table>
</TableContainer>
);
-}
+};
const GroupsPage = () => {
return (
- <>
- <MainToolbar />
- <EditCollectionView content={GroupsView} editPath="/settings/group" endpoint="groups" />
- </>
+ <OptionsLayout>
+ <EditCollectionView
+ content={GroupsView}
+ editPath="/settings/group"
+ endpoint="groups"
+ />
+ </OptionsLayout>
);
-}
+};
export default GroupsPage;
diff --git a/modern/src/settings/MaintenancesPage.js b/modern/src/settings/MaintenancesPage.js
index 7ba4bd2..3fd0b39 100644
--- a/modern/src/settings/MaintenancesPage.js
+++ b/modern/src/settings/MaintenancesPage.js
@@ -9,12 +9,13 @@ import EditCollectionView from '../EditCollectionView';
import positionAttributes from '../attributes/positionAttributes';
import { formatDistance, formatSpeed } from '../common/formatter';
import { useAttributePreference } from '../common/preferences';
+import OptionsLayout from './OptionsLayout';
const useStyles = makeStyles(theme => ({
columnAction: {
width: theme.spacing(1),
- padding: theme.spacing(0, 1),
- },
+ padding: theme.spacing(0, 1)
+ }
}));
const MaintenancesView = ({ updateTimestamp, onMenuClick }) => {
@@ -45,7 +46,7 @@ const MaintenancesView = ({ updateTimestamp, onMenuClick }) => {
}
return value;
- }
+ };
return (
<TableContainer>
@@ -63,7 +64,9 @@ const MaintenancesView = ({ updateTimestamp, onMenuClick }) => {
{items.map(item => (
<TableRow key={item.id}>
<TableCell className={classes.columnAction} padding="none">
- <IconButton onClick={event => onMenuClick(event.currentTarget, item.id)}>
+ <IconButton
+ onClick={event => onMenuClick(event.currentTarget, item.id)}
+ >
<MoreVertIcon />
</IconButton>
</TableCell>
@@ -77,15 +80,18 @@ const MaintenancesView = ({ updateTimestamp, onMenuClick }) => {
</Table>
</TableContainer>
);
-}
+};
const MaintenacesPage = () => {
return (
- <>
- <MainToolbar />
- <EditCollectionView content={MaintenancesView} editPath="/settings/maintenance" endpoint="maintenance" />
- </>
+ <OptionsLayout>
+ <EditCollectionView
+ content={MaintenancesView}
+ editPath="/settings/maintenance"
+ endpoint="maintenance"
+ />
+ </OptionsLayout>
);
-}
+};
export default MaintenacesPage;
diff --git a/modern/src/settings/NotificationsPage.js b/modern/src/settings/NotificationsPage.js
index 15da0de..3756e96 100644
--- a/modern/src/settings/NotificationsPage.js
+++ b/modern/src/settings/NotificationsPage.js
@@ -7,12 +7,13 @@ import { useEffectAsync } from '../reactHelper';
import EditCollectionView from '../EditCollectionView';
import { prefixString } from '../common/stringUtils';
import { formatBoolean } from '../common/formatter';
+import OptionsLayout from './OptionsLayout';
const useStyles = makeStyles(theme => ({
columnAction: {
width: theme.spacing(1),
- padding: theme.spacing(0, 1),
- },
+ padding: theme.spacing(0, 1)
+ }
}));
const NotificationsView = ({ updateTimestamp, onMenuClick }) => {
@@ -54,29 +55,38 @@ const NotificationsView = ({ updateTimestamp, onMenuClick }) => {
{items.map(item => (
<TableRow key={item.id}>
<TableCell className={classes.columnAction} padding="none">
- <IconButton onClick={(event) => onMenuClick(event.currentTarget, item.id)}>
+ <IconButton
+ onClick={event => onMenuClick(event.currentTarget, item.id)}
+ >
<MoreVertIcon />
</IconButton>
</TableCell>
<TableCell>{t(prefixString('event', item.type))}</TableCell>
<TableCell>{formatBoolean(item.always)}</TableCell>
- <TableCell>{formatList('alarm', item.attributes.alarms)}</TableCell>
- <TableCell>{formatList('notificator', item.notificators)}</TableCell>
+ <TableCell>
+ {formatList('alarm', item.attributes.alarms)}
+ </TableCell>
+ <TableCell>
+ {formatList('notificator', item.notificators)}
+ </TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
);
-}
+};
const NotificationsPage = () => {
return (
- <>
- <MainToolbar />
- <EditCollectionView content={NotificationsView} editPath="/settings/notification" endpoint="notifications" />
- </>
+ <OptionsLayout>
+ <EditCollectionView
+ content={NotificationsView}
+ editPath="/settings/notification"
+ endpoint="notifications"
+ />
+ </OptionsLayout>
);
-}
+};
export default NotificationsPage;