aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports/EventReportPage.js
diff options
context:
space:
mode:
authorDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-11 22:14:39 +0000
committerDesmond Kyeremeh <elDekyfin@gmail.com>2021-07-11 22:14:39 +0000
commit1b93de84e2bf6a6532bdb03e1ae75e47061a4dca (patch)
tree8989ce8c6c5bb1d2a748ffe91895fe929c99dd5e /modern/src/reports/EventReportPage.js
parentefe18c504a834760242937572b369530c552e589 (diff)
downloadtrackermap-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.tar.gz
trackermap-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.tar.bz2
trackermap-web-1b93de84e2bf6a6532bdb03e1ae75e47061a4dca.zip
Fixed linting
Diffstat (limited to 'modern/src/reports/EventReportPage.js')
-rw-r--r--modern/src/reports/EventReportPage.js39
1 files changed, 21 insertions, 18 deletions
diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js
index b938dc85..b5c3daeb 100644
--- a/modern/src/reports/EventReportPage.js
+++ b/modern/src/reports/EventReportPage.js
@@ -1,7 +1,9 @@
import React, { useState } from 'react';
import { DataGrid } from '@material-ui/data-grid';
-import { Grid, FormControl, InputLabel, Select, MenuItem } from '@material-ui/core';
-import { useTheme } from "@material-ui/core/styles";
+import {
+ Grid, FormControl, InputLabel, Select, MenuItem,
+} from '@material-ui/core';
+import { useTheme } from '@material-ui/core/styles';
import { useSelector } from 'react-redux';
import { formatDate } from '../common/formatter';
import ReportFilter from './ReportFilter';
@@ -10,12 +12,13 @@ import { prefixString } from '../common/stringUtils';
import t from '../common/localization';
const Filter = ({ setItems }) => {
-
const [eventTypes, setEventTypes] = useState(['allEvents']);
const handleSubmit = async (deviceId, from, to, mail, headers) => {
- const query = new URLSearchParams({ deviceId, from, to, mail });
- eventTypes.forEach(it => query.append('type', it));
+ const query = new URLSearchParams({
+ deviceId, from, to, mail,
+ });
+ eventTypes.forEach((it) => query.append('type', it));
const response = await fetch(`/api/reports/events?${query.toString()}`, { headers });
if (response.ok) {
const contentType = response.headers.get('content-type');
@@ -34,7 +37,7 @@ const Filter = ({ setItems }) => {
<Grid item xs={12} sm={6}>
<FormControl variant="filled" fullWidth>
<InputLabel>{t('reportEventTypes')}</InputLabel>
- <Select value={eventTypes} onChange={e => setEventTypes(e.target.value)} multiple>
+ <Select value={eventTypes} onChange={(e) => setEventTypes(e.target.value)} multiple>
<MenuItem value="allEvents">{t('eventAll')}</MenuItem>
<MenuItem value="deviceOnline">{t('eventDeviceOnline')}</MenuItem>
<MenuItem value="deviceUnknown">{t('eventDeviceUnknown')}</MenuItem>
@@ -58,21 +61,20 @@ const Filter = ({ setItems }) => {
</Grid>
</ReportFilter>
);
-}
+};
const EventReportPage = () => {
-
const theme = useTheme();
- const geofences = useSelector(state => state.geofences.items);
+ const geofences = useSelector((state) => state.geofences.items);
const [items, setItems] = useState([]);
- const formatGeofence = value => {
+ const formatGeofence = (value) => {
if (value > 0) {
- const geofence = geofences[value];
- return geofence ? geofence.name : '';
+ const geofence = geofences[value];
+ return geofence ? geofence.name : '';
}
return null;
- }
+ };
const columns = [{
headerName: t('positionFixTime'),
@@ -101,12 +103,13 @@ const EventReportPage = () => {
return (
<ReportLayout filter={<Filter setItems={setItems} />}>
<DataGrid
- rows={items}
- columns={columns}
- hideFooter
- autoHeight />
+ rows={items}
+ columns={columns}
+ hideFooter
+ autoHeight
+ />
</ReportLayout>
);
-}
+};
export default EventReportPage;