+ client: handle clients find
This commit is contained in:
@@ -28,19 +28,17 @@ const countCell = dnsQueries =>
|
||||
return <Cell value={value} percent={percent} color={percentColor} />;
|
||||
};
|
||||
|
||||
const clientCell = (clients, autoClients, t) =>
|
||||
const clientCell = t =>
|
||||
function cell(row) {
|
||||
const { value } = row;
|
||||
|
||||
return (
|
||||
<div className="logs__row logs__row--overflow logs__row--column">
|
||||
{formatClientCell(value, clients, autoClients, t)}
|
||||
{formatClientCell(row, t)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const Clients = ({
|
||||
t, refreshButton, topClients, subtitle, clients, autoClients, dnsQueries,
|
||||
t, refreshButton, topClients, subtitle, dnsQueries,
|
||||
}) => (
|
||||
<Card
|
||||
title={t('top_clients')}
|
||||
@@ -49,9 +47,10 @@ const Clients = ({
|
||||
refresh={refreshButton}
|
||||
>
|
||||
<ReactTable
|
||||
data={topClients.map(({ name: ip, count }) => ({
|
||||
data={topClients.map(({ name: ip, count, info }) => ({
|
||||
ip,
|
||||
count,
|
||||
info,
|
||||
}))}
|
||||
columns={[
|
||||
{
|
||||
@@ -59,7 +58,7 @@ const Clients = ({
|
||||
accessor: 'ip',
|
||||
sortMethod: (a, b) =>
|
||||
parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10),
|
||||
Cell: clientCell(clients, autoClients, t),
|
||||
Cell: clientCell(t),
|
||||
},
|
||||
{
|
||||
Header: <Trans>requests_count</Trans>,
|
||||
|
||||
@@ -20,7 +20,6 @@ class Dashboard extends Component {
|
||||
getAllStats = () => {
|
||||
this.props.getStats();
|
||||
this.props.getStatsConfig();
|
||||
this.props.getClients();
|
||||
};
|
||||
|
||||
getToggleFilteringButton = () => {
|
||||
@@ -44,7 +43,6 @@ class Dashboard extends Component {
|
||||
const { dashboard, stats, t } = this.props;
|
||||
const dashboardProcessing =
|
||||
dashboard.processing ||
|
||||
dashboard.processingClients ||
|
||||
stats.processingStats ||
|
||||
stats.processingGetConfig;
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ class Logs extends Component {
|
||||
this.props.setLogsPage(TABLE_FIRST_PAGE);
|
||||
this.getLogs(...INITIAL_REQUEST_DATA);
|
||||
this.props.getFilteringStatus();
|
||||
this.props.getClients();
|
||||
this.props.getLogsConfig();
|
||||
}
|
||||
|
||||
@@ -191,9 +190,9 @@ class Logs extends Component {
|
||||
);
|
||||
};
|
||||
|
||||
getClientCell = ({ original, value }) => {
|
||||
const { dashboard, t } = this.props;
|
||||
const { clients, autoClients } = dashboard;
|
||||
getClientCell = (row) => {
|
||||
const { original } = row;
|
||||
const { t } = this.props;
|
||||
const { reason, domain } = original;
|
||||
const isFiltered = this.checkFiltered(reason);
|
||||
const isRewrite = this.checkRewrite(reason);
|
||||
@@ -201,7 +200,7 @@ class Logs extends Component {
|
||||
return (
|
||||
<Fragment>
|
||||
<div className="logs__row logs__row--overflow logs__row--column">
|
||||
{formatClientCell(value, clients, autoClients, t)}
|
||||
{formatClientCell(row, t)}
|
||||
</div>
|
||||
{isRewrite ? (
|
||||
<div className="logs__action">
|
||||
@@ -232,12 +231,11 @@ class Logs extends Component {
|
||||
};
|
||||
|
||||
renderLogs() {
|
||||
const { queryLogs, dashboard, t } = this.props;
|
||||
const { processingClients } = dashboard;
|
||||
const { queryLogs, t } = this.props;
|
||||
const {
|
||||
processingGetLogs, processingGetConfig, logs, pages, page,
|
||||
} = queryLogs;
|
||||
const isLoading = processingGetLogs || processingClients || processingGetConfig;
|
||||
const isLoading = processingGetLogs || processingGetConfig;
|
||||
|
||||
const columns = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user