+ 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 {
|
import {
|
||||||
formatTime,
|
formatTime,
|
||||||
formatDateTime,
|
formatDateTime,
|
||||||
|
formatTodayDate,
|
||||||
} from '../../helpers/helpers';
|
} from '../../helpers/helpers';
|
||||||
import { SERVICES, FILTERED_STATUS, TABLE_DEFAULT_PAGE_SIZE } from '../../helpers/constants';
|
import { SERVICES, FILTERED_STATUS, TABLE_DEFAULT_PAGE_SIZE } from '../../helpers/constants';
|
||||||
import { getTrackerData } from '../../helpers/trackers/trackers';
|
import { getTrackerData } from '../../helpers/trackers/trackers';
|
||||||
@ -117,7 +118,8 @@ class Logs extends Component {
|
|||||||
getTimeCell = ({ value }) => (
|
getTimeCell = ({ value }) => (
|
||||||
<div className="logs__row">
|
<div className="logs__row">
|
||||||
<span className="logs__text" title={formatDateTime(value)}>
|
<span className="logs__text" title={formatDateTime(value)}>
|
||||||
{formatTime(value)}
|
{formatTodayDate(value) === formatTodayDate(Date.now())
|
||||||
|
? formatTime(value) : formatDateTime(value)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -257,7 +259,7 @@ class Logs extends Component {
|
|||||||
{
|
{
|
||||||
Header: t('time_table_header'),
|
Header: t('time_table_header'),
|
||||||
accessor: 'time',
|
accessor: 'time',
|
||||||
maxWidth: 100,
|
minWidth: 105,
|
||||||
Cell: this.getTimeCell,
|
Cell: this.getTimeCell,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,19 @@ export const formatDateTime = (dateTime) => {
|
|||||||
return parsedTime.toLocaleString(currentLanguage, options);
|
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) => {
|
export const normalizeLogs = logs => logs.map((log) => {
|
||||||
const {
|
const {
|
||||||
time,
|
time,
|
||||||
|
Loading…
Reference in New Issue
Block a user