aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports/LogsPage.jsx
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-12-30 15:21:02 -0800
committerAnton Tananaev <anton@traccar.org>2023-12-30 15:21:02 -0800
commit6b74ea793333313ae578d7f7203aad0e5b854f7d (patch)
tree9f18a967d4a3db09fbcd21aa9820a1503b615784 /modern/src/reports/LogsPage.jsx
parent363d473ce27a4d672110005f4dcde6576eb68ccc (diff)
downloadtrackermap-web-6b74ea793333313ae578d7f7203aad0e5b854f7d.tar.gz
trackermap-web-6b74ea793333313ae578d7f7203aad0e5b854f7d.tar.bz2
trackermap-web-6b74ea793333313ae578d7f7203aad0e5b854f7d.zip
Support unknown devices logs
Diffstat (limited to 'modern/src/reports/LogsPage.jsx')
-rw-r--r--modern/src/reports/LogsPage.jsx40
1 files changed, 39 insertions, 1 deletions
diff --git a/modern/src/reports/LogsPage.jsx b/modern/src/reports/LogsPage.jsx
index 9bc04201..4b689944 100644
--- a/modern/src/reports/LogsPage.jsx
+++ b/modern/src/reports/LogsPage.jsx
@@ -1,14 +1,33 @@
import React, { useEffect } from 'react';
+import { useNavigate } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux';
import {
- Table, TableRow, TableCell, TableHead, TableBody,
+ Table, TableRow, TableCell, TableHead, TableBody, IconButton, Tooltip,
} from '@mui/material';
+import makeStyles from '@mui/styles/makeStyles';
+import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
+import HelpOutlineIcon from '@mui/icons-material/HelpOutline';
import { useTranslation } from '../common/components/LocalizationProvider';
import PageLayout from '../common/components/PageLayout';
import ReportsMenu from './components/ReportsMenu';
import { sessionActions } from '../store';
+const useStyles = makeStyles((theme) => ({
+ columnAction: {
+ width: '1%',
+ paddingLeft: theme.spacing(1),
+ },
+ success: {
+ color: theme.palette.success.main,
+ },
+ error: {
+ color: theme.palette.error.main,
+ },
+}));
+
const LogsPage = () => {
+ const classes = useStyles();
+ const navigate = useNavigate();
const dispatch = useDispatch();
const t = useTranslation();
@@ -19,11 +38,17 @@ const LogsPage = () => {
const items = useSelector((state) => state.session.logs);
+ const registerDevice = (uniqueId) => {
+ const query = new URLSearchParams({ uniqueId });
+ navigate(`/settings/device?${query.toString()}`);
+ }
+
return (
<PageLayout menu={<ReportsMenu />} breadcrumbs={['reportTitle', 'statisticsTitle']}>
<Table>
<TableHead>
<TableRow>
+ <TableCell className={classes.columnAction} />
<TableCell>{t('deviceIdentifier')}</TableCell>
<TableCell>{t('positionProtocol')}</TableCell>
<TableCell>{t('commandData')}</TableCell>
@@ -32,6 +57,19 @@ const LogsPage = () => {
<TableBody>
{items.map((item, index) => (
<TableRow key={index}>
+ <TableCell className={classes.columnAction} padding="none">
+ {item.deviceId ? (
+ <IconButton size="small" disabled>
+ <CheckCircleOutlineIcon fontSize="small" className={classes.success} />
+ </IconButton>
+ ) : (
+ <Tooltip title={t('loginRegister')}>
+ <IconButton size="small" onClick={() => registerDevice(item.uniqueId)}>
+ <HelpOutlineIcon fontSize="small" className={classes.error} />
+ </IconButton>
+ </Tooltip>
+ )}
+ </TableCell>
<TableCell>{item.uniqueId}</TableCell>
<TableCell>{item.protocol}</TableCell>
<TableCell>{item.data}</TableCell>