aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/reports')
-rw-r--r--modern/src/reports/ChartReportPage.js9
-rw-r--r--modern/src/reports/RouteReportPage.js7
2 files changed, 5 insertions, 11 deletions
diff --git a/modern/src/reports/ChartReportPage.js b/modern/src/reports/ChartReportPage.js
index f9698102..dbc205fc 100644
--- a/modern/src/reports/ChartReportPage.js
+++ b/modern/src/reports/ChartReportPage.js
@@ -10,7 +10,6 @@ import { formatDate } from '../common/util/formatter';
import { useTranslation } from '../common/components/LocalizationProvider';
import PageLayout from '../common/components/PageLayout';
import ReportsMenu from './components/ReportsMenu';
-import usePositionProperties from '../common/attributes/usePositionProperties';
import usePositionAttributes from '../common/attributes/usePositionAttributes';
const useStyles = makeStyles(() => ({
@@ -25,9 +24,7 @@ const ChartReportPage = () => {
const filterClasses = useFilterStyles();
const t = useTranslation();
- const positionProperties = usePositionProperties(t);
const positionAttributes = usePositionAttributes(t);
- const typesObject = { ...positionProperties, ...positionAttributes };
const [items, setItems] = useState([]);
const [type, setType] = useState('speed');
@@ -61,8 +58,8 @@ const ChartReportPage = () => {
<FormControl variant="filled" fullWidth>
<InputLabel>{t('reportChartType')}</InputLabel>
<Select value={type} onChange={(e) => setType(e.target.value)}>
- {Object.keys(typesObject).filter((key) => typesObject[key].type === 'number').map((key) => (
- <MenuItem key={key} value={key}>{typesObject[key].name}</MenuItem>
+ {Object.keys(positionAttributes).filter((key) => positionAttributes[key].type === 'number').map((key) => (
+ <MenuItem key={key} value={key}>{positionAttributes[key].name}</MenuItem>
))}
</Select>
</FormControl>
@@ -80,7 +77,7 @@ const ChartReportPage = () => {
<XAxis dataKey="fixTime" />
<YAxis type="number" domain={[`dataMin - ${dataRange / 5}`, `dataMax + ${dataRange / 5}`]} />
<CartesianGrid strokeDasharray="3 3" />
- <Tooltip formatter={(value, name) => [value, typesObject[name].name]} />
+ <Tooltip formatter={(value, name) => [value, positionAttributes[name].name]} />
<Line type="natural" dataKey={type} />
</LineChart>
</ResponsiveContainer>
diff --git a/modern/src/reports/RouteReportPage.js b/modern/src/reports/RouteReportPage.js
index e1dd59a0..cd2c3694 100644
--- a/modern/src/reports/RouteReportPage.js
+++ b/modern/src/reports/RouteReportPage.js
@@ -9,15 +9,12 @@ import ReportsMenu from './components/ReportsMenu';
import usePersistedState from '../common/util/usePersistedState';
import PositionValue from '../common/components/PositionValue';
import ColumnSelect from './components/ColumnSelect';
-import usePositionProperties from '../common/attributes/usePositionProperties';
import usePositionAttributes from '../common/attributes/usePositionAttributes';
const RouteReportPage = () => {
const t = useTranslation();
- const positionProperties = usePositionProperties(t);
const positionAttributes = usePositionAttributes(t);
- const columnsObject = { ...positionProperties, ...positionAttributes };
const [columns, setColumns] = usePersistedState('routeColumns', ['fixTime', 'latitude', 'longitude', 'speed', 'address']);
const [items, setItems] = useState([]);
@@ -45,14 +42,14 @@ const RouteReportPage = () => {
<ColumnSelect
columns={columns}
setColumns={setColumns}
- columnsObject={columnsObject}
+ columnsObject={positionAttributes}
/>
</ReportFilter>
<TableContainer>
<Table>
<TableHead>
<TableRow>
- {columns.map((key) => (<TableCell>{columnsObject[key].name}</TableCell>))}
+ {columns.map((key) => (<TableCell>{positionAttributes[key].name}</TableCell>))}
</TableRow>
</TableHead>
<TableBody>