Merge pull request #73 in DNS/adguard-dns from fix/362 to master

* commit '1cdbe3f879566f8e08ad0fa88daad5b568750820':
  Fix sorting issue and show loader
This commit is contained in:
Andrey Meshkov 2018-10-12 17:05:58 +03:00
commit 838406353b
2 changed files with 7 additions and 4 deletions

View File

@ -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 }) => (<div className="logs__row"><span className="logs__text" title={value}>{formatTime(value)}</span></div>),
}, {
Header: 'Domain name',
accessor: 'domain',
@ -261,8 +264,8 @@ class Logs extends Component {
</div>
</PageTitle>
<Card>
{queryLogEnabled && queryLogs.processing && <Loading />}
{queryLogEnabled && !queryLogs.processing &&
{queryLogEnabled && queryLogs.getLogsProcessing && <Loading />}
{queryLogEnabled && !queryLogs.getLogsProcessing &&
this.renderLogs(queryLogs.logs)}
</Card>
</Fragment>

View File

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