2019-06-03 13:08:50 +00:00
|
|
|
import React, { Component, Fragment } from 'react';
|
2019-06-03 12:41:45 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { withNamespaces } from 'react-i18next';
|
|
|
|
|
|
|
|
import Upstream from './Upstream';
|
2019-06-03 13:08:50 +00:00
|
|
|
import Access from './Access';
|
2019-12-05 13:00:20 +00:00
|
|
|
import Config from './Config';
|
2019-06-03 12:41:45 +00:00
|
|
|
import PageTitle from '../../ui/PageTitle';
|
2019-06-03 13:08:50 +00:00
|
|
|
import Loading from '../../ui/Loading';
|
2019-06-03 12:41:45 +00:00
|
|
|
|
2019-06-03 13:08:50 +00:00
|
|
|
class Dns extends Component {
|
|
|
|
componentDidMount() {
|
|
|
|
this.props.getAccessList();
|
2019-12-05 13:00:20 +00:00
|
|
|
this.props.getDnsConfig();
|
2019-06-03 13:08:50 +00:00
|
|
|
}
|
2019-06-03 12:41:45 +00:00
|
|
|
|
2019-06-03 13:08:50 +00:00
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
t,
|
|
|
|
settings,
|
|
|
|
access,
|
|
|
|
setAccessList,
|
|
|
|
testUpstream,
|
2019-12-05 13:00:20 +00:00
|
|
|
dnsConfig,
|
|
|
|
setDnsConfig,
|
2019-06-03 13:08:50 +00:00
|
|
|
} = this.props;
|
|
|
|
|
2020-04-22 16:32:07 +00:00
|
|
|
const isDataLoading = access.processing || dnsConfig.processingGetConfig;
|
2019-09-17 09:22:15 +00:00
|
|
|
|
2019-06-03 13:08:50 +00:00
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
<PageTitle title={t('dns_settings')} />
|
2020-04-22 16:32:07 +00:00
|
|
|
{isDataLoading ?
|
|
|
|
<Loading /> :
|
2019-06-03 13:08:50 +00:00
|
|
|
<Fragment>
|
|
|
|
<Upstream
|
|
|
|
processingTestUpstream={settings.processingTestUpstream}
|
|
|
|
testUpstream={testUpstream}
|
2020-04-22 16:32:07 +00:00
|
|
|
dnsConfig={dnsConfig}
|
|
|
|
setDnsConfig={setDnsConfig}
|
2019-06-03 13:08:50 +00:00
|
|
|
/>
|
2020-04-24 13:51:44 +00:00
|
|
|
<Config
|
|
|
|
dnsConfig={dnsConfig}
|
|
|
|
setDnsConfig={setDnsConfig}
|
|
|
|
/>
|
2019-06-03 13:08:50 +00:00
|
|
|
<Access access={access} setAccessList={setAccessList} />
|
2020-04-22 16:32:07 +00:00
|
|
|
</Fragment>}
|
2019-06-03 13:08:50 +00:00
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-06-03 12:41:45 +00:00
|
|
|
|
|
|
|
Dns.propTypes = {
|
|
|
|
settings: PropTypes.object.isRequired,
|
|
|
|
testUpstream: PropTypes.func.isRequired,
|
2019-06-03 13:08:50 +00:00
|
|
|
getAccessList: PropTypes.func.isRequired,
|
|
|
|
setAccessList: PropTypes.func.isRequired,
|
|
|
|
access: PropTypes.object.isRequired,
|
2019-12-05 13:00:20 +00:00
|
|
|
dnsConfig: PropTypes.object.isRequired,
|
|
|
|
setDnsConfig: PropTypes.func.isRequired,
|
|
|
|
getDnsConfig: PropTypes.func.isRequired,
|
2019-06-03 12:41:45 +00:00
|
|
|
t: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default withNamespaces()(Dns);
|