- client: fix naming

This commit is contained in:
Ildar Kamalov 2019-09-26 12:17:58 +03:00
parent 63efce0309
commit 563f8031dc
3 changed files with 18 additions and 14 deletions

View File

@ -4,8 +4,11 @@ import { withNamespaces } from 'react-i18next';
import ReactTable from 'react-table'; import ReactTable from 'react-table';
import Card from '../../ui/Card'; import Card from '../../ui/Card';
import WrapCell from './WrapCell';
import whoisCell from './whoisCell'; import whoisCell from './whoisCell';
import wrapCell from './wrapCell';
const COLUMN_MIN_WIDTH = 200;
class AutoClients extends Component { class AutoClients extends Component {
getStats = (ip, stats) => { getStats = (ip, stats) => {
@ -21,31 +24,31 @@ class AutoClients extends Component {
{ {
Header: this.props.t('table_client'), Header: this.props.t('table_client'),
accessor: 'ip', accessor: 'ip',
minWidth: 200, minWidth: COLUMN_MIN_WIDTH,
Cell: wrapCell, Cell: WrapCell,
}, },
{ {
Header: this.props.t('table_name'), Header: this.props.t('table_name'),
accessor: 'name', accessor: 'name',
minWidth: 200, minWidth: COLUMN_MIN_WIDTH,
Cell: wrapCell, Cell: WrapCell,
}, },
{ {
Header: this.props.t('source_label'), Header: this.props.t('source_label'),
accessor: 'source', accessor: 'source',
minWidth: 200, minWidth: COLUMN_MIN_WIDTH,
Cell: wrapCell, Cell: WrapCell,
}, },
{ {
Header: this.props.t('whois'), Header: this.props.t('whois'),
accessor: 'whois_info', accessor: 'whois_info',
minWidth: 200, minWidth: COLUMN_MIN_WIDTH,
Cell: whoisCell(this.props.t), Cell: whoisCell(this.props.t),
}, },
{ {
Header: this.props.t('requests_count'), Header: this.props.t('requests_count'),
accessor: 'statistics', accessor: 'statistics',
minWidth: 200, minWidth: COLUMN_MIN_WIDTH,
Cell: (row) => { Cell: (row) => {
const clientIP = row.original.ip; const clientIP = row.original.ip;
const clientStats = clientIP && this.getStats(clientIP, this.props.topClients); const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);

View File

@ -6,7 +6,8 @@ import ReactTable from 'react-table';
import { MODAL_TYPE, CLIENT_ID } from '../../../helpers/constants'; import { MODAL_TYPE, CLIENT_ID } from '../../../helpers/constants';
import Card from '../../ui/Card'; import Card from '../../ui/Card';
import Modal from './Modal'; import Modal from './Modal';
import wrapCell from './wrapCell'; import WrapCell from './WrapCell';
import whoisCell from './whoisCell'; import whoisCell from './whoisCell';
class ClientsTable extends Component { class ClientsTable extends Component {
@ -103,7 +104,7 @@ class ClientsTable extends Component {
Header: this.props.t('table_name'), Header: this.props.t('table_name'),
accessor: 'name', accessor: 'name',
minWidth: 120, minWidth: 120,
Cell: wrapCell, Cell: WrapCell,
}, },
{ {
Header: this.props.t('settings'), Header: this.props.t('settings'),

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
const wrapCell = ({ value }) => ( const WrapCell = ({ value }) => (
<div className="logs__row logs__row--overflow"> <div className="logs__row logs__row--overflow">
<span className="logs__text" title={value}> <span className="logs__text" title={value}>
{value || ''} {value || ''}
@ -9,8 +9,8 @@ const wrapCell = ({ value }) => (
</div> </div>
); );
wrapCell.propTypes = { WrapCell.propTypes = {
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}; };
export default wrapCell; export default WrapCell;