2020-06-10 16:04:19 +00:00
|
|
|
import React from 'react';
|
2019-03-06 11:45:21 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2020-06-10 16:04:19 +00:00
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { useDispatch } from 'react-redux';
|
2019-03-06 11:45:21 +00:00
|
|
|
import Form from './Form';
|
2019-06-03 12:41:45 +00:00
|
|
|
import Card from '../../../ui/Card';
|
2020-06-10 16:04:19 +00:00
|
|
|
import { setDnsConfig } from '../../../../actions/dnsConfig';
|
2020-05-25 16:41:04 +00:00
|
|
|
|
2020-06-10 16:04:19 +00:00
|
|
|
const Upstream = (props) => {
|
|
|
|
const [t] = useTranslation();
|
|
|
|
const dispatch = useDispatch();
|
2019-03-06 11:45:21 +00:00
|
|
|
|
2020-06-10 16:04:19 +00:00
|
|
|
const handleSubmit = (values) => {
|
|
|
|
dispatch(setDnsConfig(values));
|
2019-06-03 12:41:45 +00:00
|
|
|
};
|
2019-03-06 11:45:21 +00:00
|
|
|
|
2020-06-10 16:04:19 +00:00
|
|
|
const {
|
|
|
|
processingTestUpstream,
|
|
|
|
dnsConfig: {
|
|
|
|
upstream_dns,
|
|
|
|
bootstrap_dns,
|
|
|
|
processingSetConfig,
|
|
|
|
upstream_mode,
|
|
|
|
},
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Card
|
|
|
|
title={t('upstream_dns')}
|
|
|
|
subtitle={t('upstream_dns_hint')}
|
|
|
|
bodyType="card-body box-body--settings"
|
|
|
|
>
|
|
|
|
<div className="row">
|
|
|
|
<div className="col">
|
|
|
|
<Form
|
|
|
|
initialValues={{
|
|
|
|
upstream_dns,
|
|
|
|
bootstrap_dns,
|
|
|
|
upstream_mode,
|
|
|
|
}}
|
|
|
|
onSubmit={handleSubmit}
|
|
|
|
processingTestUpstream={processingTestUpstream}
|
|
|
|
processingSetConfig={processingSetConfig}
|
|
|
|
/>
|
2019-03-06 11:45:21 +00:00
|
|
|
</div>
|
2020-06-10 16:04:19 +00:00
|
|
|
</div>
|
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
};
|
2019-03-06 11:45:21 +00:00
|
|
|
|
|
|
|
Upstream.propTypes = {
|
|
|
|
processingTestUpstream: PropTypes.bool.isRequired,
|
2020-04-22 16:32:07 +00:00
|
|
|
dnsConfig: PropTypes.object.isRequired,
|
2019-03-06 11:45:21 +00:00
|
|
|
};
|
|
|
|
|
2020-06-10 16:04:19 +00:00
|
|
|
export default Upstream;
|