mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-16 11:52:58 +03:00
+ client: show date in query logs
This commit is contained in:
parent
3a077717ae
commit
108cf73a30
@ -9,6 +9,7 @@ import { HashLink as Link } from 'react-router-hash-link';
|
||||
import {
|
||||
formatTime,
|
||||
formatDateTime,
|
||||
formatTodayDate,
|
||||
} from '../../helpers/helpers';
|
||||
import { SERVICES, FILTERED_STATUS, TABLE_DEFAULT_PAGE_SIZE } from '../../helpers/constants';
|
||||
import { getTrackerData } from '../../helpers/trackers/trackers';
|
||||
@ -115,11 +116,12 @@ class Logs extends Component {
|
||||
checkWhiteList = reason => reason === FILTERED_STATUS.NOT_FILTERED_WHITE_LIST;
|
||||
|
||||
getTimeCell = ({ value }) => (
|
||||
<div className="logs__row">
|
||||
<span className="logs__text" title={formatDateTime(value)}>
|
||||
{formatTime(value)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="logs__row">
|
||||
<span className="logs__text" title={formatDateTime(value)}>
|
||||
{formatTodayDate(value) === formatTodayDate(Date.now())
|
||||
? formatTime(value) : formatDateTime(value)}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
|
||||
getDomainCell = (row) => {
|
||||
@ -257,7 +259,7 @@ class Logs extends Component {
|
||||
{
|
||||
Header: t('time_table_header'),
|
||||
accessor: 'time',
|
||||
maxWidth: 100,
|
||||
minWidth: 105,
|
||||
Cell: this.getTimeCell,
|
||||
},
|
||||
{
|
||||
|
@ -39,6 +39,19 @@ export const formatDateTime = (dateTime) => {
|
||||
return parsedTime.toLocaleString(currentLanguage, options);
|
||||
};
|
||||
|
||||
export const formatTodayDate = (dateTime) => {
|
||||
const currentLanguage = i18n.languages[0] || 'en';
|
||||
const parsedTime = dateParse(dateTime);
|
||||
const options = {
|
||||
year: 'numeric',
|
||||
month: 'numeric',
|
||||
day: 'numeric',
|
||||
hour12: false,
|
||||
};
|
||||
|
||||
return parsedTime.toLocaleString(currentLanguage, options);
|
||||
};
|
||||
|
||||
export const normalizeLogs = logs => logs.map((log) => {
|
||||
const {
|
||||
time,
|
||||
|
Loading…
Reference in New Issue
Block a user