* client: move access settings to DNS settings page
This commit is contained in:
parent
cf53653cfa
commit
757bb7285a
|
@ -9,12 +9,20 @@ import Loading from '../../ui/Loading';
|
||||||
|
|
||||||
class Clients extends Component {
|
class Clients extends Component {
|
||||||
render() {
|
render() {
|
||||||
const { dashboard, clients, t } = this.props;
|
const {
|
||||||
|
t,
|
||||||
|
dashboard,
|
||||||
|
clients,
|
||||||
|
addClient,
|
||||||
|
updateClient,
|
||||||
|
deleteClient,
|
||||||
|
toggleClientModal,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<PageTitle title={t('clients_settings')} />
|
<PageTitle title={t('clients_settings')} />
|
||||||
{!dashboard.processingTopStats || (!dashboard.processingClients && <Loading />)}
|
{(dashboard.processingTopStats || dashboard.processingClients) && <Loading />}
|
||||||
{!dashboard.processingTopStats && !dashboard.processingClients && (
|
{!dashboard.processingTopStats && !dashboard.processingClients && (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<ClientsTable
|
<ClientsTable
|
||||||
|
@ -23,10 +31,10 @@ class Clients extends Component {
|
||||||
isModalOpen={clients.isModalOpen}
|
isModalOpen={clients.isModalOpen}
|
||||||
modalClientName={clients.modalClientName}
|
modalClientName={clients.modalClientName}
|
||||||
modalType={clients.modalType}
|
modalType={clients.modalType}
|
||||||
addClient={this.props.addClient}
|
addClient={addClient}
|
||||||
updateClient={this.props.updateClient}
|
updateClient={updateClient}
|
||||||
deleteClient={this.props.deleteClient}
|
deleteClient={deleteClient}
|
||||||
toggleClientModal={this.props.toggleClientModal}
|
toggleClientModal={toggleClientModal}
|
||||||
processingAdding={clients.processingAdding}
|
processingAdding={clients.processingAdding}
|
||||||
processingDeleting={clients.processingDeleting}
|
processingDeleting={clients.processingDeleting}
|
||||||
processingUpdating={clients.processingUpdating}
|
processingUpdating={clients.processingUpdating}
|
||||||
|
@ -45,18 +53,12 @@ class Clients extends Component {
|
||||||
Clients.propTypes = {
|
Clients.propTypes = {
|
||||||
t: PropTypes.func.isRequired,
|
t: PropTypes.func.isRequired,
|
||||||
dashboard: PropTypes.object.isRequired,
|
dashboard: PropTypes.object.isRequired,
|
||||||
clients: PropTypes.array.isRequired,
|
clients: PropTypes.object.isRequired,
|
||||||
topStats: PropTypes.object.isRequired,
|
|
||||||
toggleClientModal: PropTypes.func.isRequired,
|
toggleClientModal: PropTypes.func.isRequired,
|
||||||
deleteClient: PropTypes.func.isRequired,
|
deleteClient: PropTypes.func.isRequired,
|
||||||
addClient: PropTypes.func.isRequired,
|
addClient: PropTypes.func.isRequired,
|
||||||
updateClient: PropTypes.func.isRequired,
|
updateClient: PropTypes.func.isRequired,
|
||||||
isModalOpen: PropTypes.bool.isRequired,
|
topStats: PropTypes.object,
|
||||||
modalType: PropTypes.string.isRequired,
|
|
||||||
modalClientName: PropTypes.string.isRequired,
|
|
||||||
processingAdding: PropTypes.bool.isRequired,
|
|
||||||
processingDeleting: PropTypes.bool.isRequired,
|
|
||||||
processingUpdating: PropTypes.bool.isRequired,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withNamespaces()(Clients);
|
export default withNamespaces()(Clients);
|
||||||
|
|
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
||||||
import { withNamespaces } from 'react-i18next';
|
import { withNamespaces } from 'react-i18next';
|
||||||
|
|
||||||
import Form from './Form';
|
import Form from './Form';
|
||||||
import Card from '../../ui/Card';
|
import Card from '../../../ui/Card';
|
||||||
|
|
||||||
class Access extends Component {
|
class Access extends Component {
|
||||||
handleFormSubmit = (values) => {
|
handleFormSubmit = (values) => {
|
|
@ -1,34 +1,59 @@
|
||||||
import React, { Fragment } from 'react';
|
import React, { Component, Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { withNamespaces } from 'react-i18next';
|
import { withNamespaces } from 'react-i18next';
|
||||||
|
|
||||||
import Upstream from './Upstream';
|
import Upstream from './Upstream';
|
||||||
|
import Access from './Access';
|
||||||
import PageTitle from '../../ui/PageTitle';
|
import PageTitle from '../../ui/PageTitle';
|
||||||
|
import Loading from '../../ui/Loading';
|
||||||
|
|
||||||
const Dns = (props) => {
|
class Dns extends Component {
|
||||||
const { dashboard, settings, t } = props;
|
componentDidMount() {
|
||||||
|
this.props.getAccessList();
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
render() {
|
||||||
<Fragment>
|
const {
|
||||||
<PageTitle title={t('dns_settings')} />
|
t,
|
||||||
<Upstream
|
dashboard,
|
||||||
upstreamDns={dashboard.upstreamDns}
|
settings,
|
||||||
bootstrapDns={dashboard.bootstrapDns}
|
access,
|
||||||
allServers={dashboard.allServers}
|
setAccessList,
|
||||||
setUpstream={props.setUpstream}
|
testUpstream,
|
||||||
testUpstream={props.testUpstream}
|
setUpstream,
|
||||||
processingTestUpstream={settings.processingTestUpstream}
|
} = this.props;
|
||||||
processingSetUpstream={settings.processingSetUpstream}
|
|
||||||
/>
|
return (
|
||||||
</Fragment>
|
<Fragment>
|
||||||
);
|
<PageTitle title={t('dns_settings')} />
|
||||||
};
|
{(dashboard.processing || access.processing) && <Loading />}
|
||||||
|
{!dashboard.processing && !access.processing && (
|
||||||
|
<Fragment>
|
||||||
|
<Upstream
|
||||||
|
upstreamDns={dashboard.upstreamDns}
|
||||||
|
bootstrapDns={dashboard.bootstrapDns}
|
||||||
|
allServers={dashboard.allServers}
|
||||||
|
processingTestUpstream={settings.processingTestUpstream}
|
||||||
|
processingSetUpstream={settings.processingSetUpstream}
|
||||||
|
setUpstream={setUpstream}
|
||||||
|
testUpstream={testUpstream}
|
||||||
|
/>
|
||||||
|
<Access access={access} setAccessList={setAccessList} />
|
||||||
|
</Fragment>
|
||||||
|
)}
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Dns.propTypes = {
|
Dns.propTypes = {
|
||||||
dashboard: PropTypes.object.isRequired,
|
dashboard: PropTypes.object.isRequired,
|
||||||
settings: PropTypes.object.isRequired,
|
settings: PropTypes.object.isRequired,
|
||||||
setUpstream: PropTypes.func.isRequired,
|
setUpstream: PropTypes.func.isRequired,
|
||||||
testUpstream: PropTypes.func.isRequired,
|
testUpstream: PropTypes.func.isRequired,
|
||||||
|
getAccessList: PropTypes.func.isRequired,
|
||||||
|
setAccessList: PropTypes.func.isRequired,
|
||||||
|
access: PropTypes.object.isRequired,
|
||||||
t: PropTypes.func.isRequired,
|
t: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { handleUpstreamChange, setUpstream, testUpstream, addErrorToast } from '../actions';
|
import { handleUpstreamChange, setUpstream, testUpstream, addErrorToast } from '../actions';
|
||||||
|
import { getAccessList, setAccessList } from '../actions/access';
|
||||||
import Dns from '../components/Settings/Dns';
|
import Dns from '../components/Settings/Dns';
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
const { dashboard, settings } = state;
|
const { dashboard, settings, access } = state;
|
||||||
const props = {
|
const props = {
|
||||||
dashboard,
|
dashboard,
|
||||||
settings,
|
settings,
|
||||||
|
access,
|
||||||
};
|
};
|
||||||
return props;
|
return props;
|
||||||
};
|
};
|
||||||
|
@ -16,6 +18,8 @@ const mapDispatchToProps = {
|
||||||
setUpstream,
|
setUpstream,
|
||||||
testUpstream,
|
testUpstream,
|
||||||
addErrorToast,
|
addErrorToast,
|
||||||
|
getAccessList,
|
||||||
|
setAccessList,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -1,53 +1,11 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import { initSettings, toggleSetting, addErrorToast } from '../actions';
|
||||||
initSettings,
|
|
||||||
toggleSetting,
|
|
||||||
handleUpstreamChange,
|
|
||||||
setUpstream,
|
|
||||||
testUpstream,
|
|
||||||
addErrorToast,
|
|
||||||
toggleDhcp,
|
|
||||||
getDhcpStatus,
|
|
||||||
getDhcpInterfaces,
|
|
||||||
setDhcpConfig,
|
|
||||||
findActiveDhcp,
|
|
||||||
addStaticLease,
|
|
||||||
removeStaticLease,
|
|
||||||
toggleLeaseModal,
|
|
||||||
} from '../actions';
|
|
||||||
import {
|
|
||||||
getTlsStatus,
|
|
||||||
setTlsConfig,
|
|
||||||
validateTlsConfig,
|
|
||||||
} from '../actions/encryption';
|
|
||||||
import {
|
|
||||||
addClient,
|
|
||||||
updateClient,
|
|
||||||
deleteClient,
|
|
||||||
toggleClientModal,
|
|
||||||
} from '../actions/clients';
|
|
||||||
import {
|
|
||||||
getAccessList,
|
|
||||||
setAccessList,
|
|
||||||
} from '../actions/access';
|
|
||||||
import Settings from '../components/Settings';
|
import Settings from '../components/Settings';
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
const {
|
const { settings } = state;
|
||||||
settings,
|
|
||||||
dashboard,
|
|
||||||
dhcp,
|
|
||||||
encryption,
|
|
||||||
clients,
|
|
||||||
access,
|
|
||||||
} = state;
|
|
||||||
const props = {
|
const props = {
|
||||||
settings,
|
settings,
|
||||||
dashboard,
|
|
||||||
dhcp,
|
|
||||||
encryption,
|
|
||||||
clients,
|
|
||||||
access,
|
|
||||||
};
|
};
|
||||||
return props;
|
return props;
|
||||||
};
|
};
|
||||||
|
@ -55,27 +13,7 @@ const mapStateToProps = (state) => {
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
initSettings,
|
initSettings,
|
||||||
toggleSetting,
|
toggleSetting,
|
||||||
handleUpstreamChange,
|
|
||||||
setUpstream,
|
|
||||||
testUpstream,
|
|
||||||
addErrorToast,
|
addErrorToast,
|
||||||
toggleDhcp,
|
|
||||||
getDhcpStatus,
|
|
||||||
getDhcpInterfaces,
|
|
||||||
setDhcpConfig,
|
|
||||||
findActiveDhcp,
|
|
||||||
getTlsStatus,
|
|
||||||
setTlsConfig,
|
|
||||||
validateTlsConfig,
|
|
||||||
addClient,
|
|
||||||
updateClient,
|
|
||||||
deleteClient,
|
|
||||||
toggleClientModal,
|
|
||||||
addStaticLease,
|
|
||||||
removeStaticLease,
|
|
||||||
toggleLeaseModal,
|
|
||||||
getAccessList,
|
|
||||||
setAccessList,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -17,6 +17,7 @@ const access = handleActions(
|
||||||
allowed_clients: allowed_clients.join('\n'),
|
allowed_clients: allowed_clients.join('\n'),
|
||||||
disallowed_clients: disallowed_clients.join('\n'),
|
disallowed_clients: disallowed_clients.join('\n'),
|
||||||
blocked_hosts: blocked_hosts.join('\n'),
|
blocked_hosts: blocked_hosts.join('\n'),
|
||||||
|
processing: false,
|
||||||
};
|
};
|
||||||
return newState;
|
return newState;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue