+ client: functional components for dashboard
This commit is contained in:
@@ -3,29 +3,9 @@ import PropTypes from 'prop-types';
|
||||
import { withNamespaces } from 'react-i18next';
|
||||
import ReactTable from 'react-table';
|
||||
|
||||
import { CLIENT_ID } from '../../../helpers/constants';
|
||||
import Card from '../../ui/Card';
|
||||
|
||||
class AutoClients extends Component {
|
||||
getClient = (name, clients) => {
|
||||
const client = clients.find(item => name === item.name);
|
||||
|
||||
if (client) {
|
||||
const identifier = client.mac ? CLIENT_ID.MAC : CLIENT_ID.IP;
|
||||
|
||||
return {
|
||||
identifier,
|
||||
use_global_settings: true,
|
||||
...client,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
identifier: 'ip',
|
||||
use_global_settings: true,
|
||||
};
|
||||
};
|
||||
|
||||
getStats = (ip, stats) => {
|
||||
if (stats) {
|
||||
const statsForCurrentIP = stats.find(item => item.name === ip);
|
||||
|
||||
@@ -5,13 +5,13 @@ import { Trans, withNamespaces } from 'react-i18next';
|
||||
import flow from 'lodash/flow';
|
||||
|
||||
import { renderRadioField, toNumber } from '../../../helpers/form';
|
||||
import { STATS_INTERVALS } from '../../../helpers/constants';
|
||||
import { STATS_INTERVALS_DAYS } from '../../../helpers/constants';
|
||||
|
||||
const getIntervalFields = (processing, t, handleChange, toNumber) =>
|
||||
STATS_INTERVALS.map((interval) => {
|
||||
STATS_INTERVALS_DAYS.map((interval) => {
|
||||
const title = interval === 1
|
||||
? t('interval_24_hour')
|
||||
: t('interval_days', { value: interval });
|
||||
: t('interval_days', { count: interval });
|
||||
|
||||
return (
|
||||
<Field
|
||||
|
||||
Reference in New Issue
Block a user