+ client: show date in query logs

This commit is contained in:
Artem Baskal 2019-12-24 00:29:10 +03:00
parent 3a077717ae
commit 108cf73a30
2 changed files with 21 additions and 6 deletions

View File

@ -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,
},
{

View File

@ -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,