From 1cdbe3f879566f8e08ad0fa88daad5b568750820 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Fri, 12 Oct 2018 16:58:48 +0300 Subject: [PATCH] Fix sorting issue and show loader Closes #362 --- client/src/components/Logs/index.js | 7 +++++-- client/src/helpers/helpers.js | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/src/components/Logs/index.js b/client/src/components/Logs/index.js index 343c1f1a..dcc87f66 100644 --- a/client/src/components/Logs/index.js +++ b/client/src/components/Logs/index.js @@ -4,6 +4,8 @@ import ReactTable from 'react-table'; import { saveAs } from 'file-saver/FileSaver'; import escapeRegExp from 'lodash/escapeRegExp'; import endsWith from 'lodash/endsWith'; + +import { formatTime } from '../../helpers/helpers'; import PageTitle from '../ui/PageTitle'; import Card from '../ui/Card'; import Loading from '../ui/Loading'; @@ -83,6 +85,7 @@ class Logs extends Component { accessor: 'time', maxWidth: 110, filterable: false, + Cell: ({ value }) => (
{formatTime(value)}
), }, { Header: 'Domain name', accessor: 'domain', @@ -261,8 +264,8 @@ class Logs extends Component { - {queryLogEnabled && queryLogs.processing && } - {queryLogEnabled && !queryLogs.processing && + {queryLogEnabled && queryLogs.getLogsProcessing && } + {queryLogEnabled && !queryLogs.getLogsProcessing && this.renderLogs(queryLogs.logs)} diff --git a/client/src/helpers/helpers.js b/client/src/helpers/helpers.js index d21ba510..1dea8b8a 100644 --- a/client/src/helpers/helpers.js +++ b/client/src/helpers/helpers.js @@ -6,7 +6,7 @@ import round from 'lodash/round'; import { STATS_NAMES } from './constants'; -const formatTime = (time) => { +export const formatTime = (time) => { const parsedTime = dateParse(time); return dateFormat(parsedTime, 'HH:mm:ss'); }; @@ -26,7 +26,7 @@ export const normalizeLogs = logs => logs.map((log) => { return `${type}: ${value} (ttl=${ttl})`; }) : []; return { - time: formatTime(time), + time, domain, type, response: responsesArray,