2019-03-06 11:45:21 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-05-22 14:06:05 +00:00
|
|
|
import { withTranslation } from 'react-i18next';
|
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';
|
2019-03-06 11:45:21 +00:00
|
|
|
|
|
|
|
class Upstream extends Component {
|
|
|
|
handleSubmit = (values) => {
|
2020-04-22 16:32:07 +00:00
|
|
|
this.props.setDnsConfig(values);
|
2019-03-06 11:45:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
handleTest = (values) => {
|
|
|
|
this.props.testUpstream(values);
|
2019-06-03 12:41:45 +00:00
|
|
|
};
|
2019-03-06 11:45:21 +00:00
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
t,
|
|
|
|
processingTestUpstream,
|
2020-04-22 16:32:07 +00:00
|
|
|
dnsConfig: {
|
|
|
|
upstream_dns,
|
|
|
|
bootstrap_dns,
|
|
|
|
fastest_addr,
|
|
|
|
parallel_requests,
|
|
|
|
processingSetConfig,
|
|
|
|
},
|
2019-03-06 11:45:21 +00:00
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Card
|
2019-06-03 12:41:45 +00:00
|
|
|
title={t('upstream_dns')}
|
|
|
|
subtitle={t('upstream_dns_hint')}
|
2019-03-06 11:45:21 +00:00
|
|
|
bodyType="card-body box-body--settings"
|
|
|
|
>
|
|
|
|
<div className="row">
|
|
|
|
<div className="col">
|
|
|
|
<Form
|
|
|
|
initialValues={{
|
|
|
|
upstream_dns,
|
|
|
|
bootstrap_dns,
|
2020-04-22 16:32:07 +00:00
|
|
|
fastest_addr,
|
|
|
|
parallel_requests,
|
2019-03-06 11:45:21 +00:00
|
|
|
}}
|
|
|
|
testUpstream={this.handleTest}
|
|
|
|
onSubmit={this.handleSubmit}
|
|
|
|
processingTestUpstream={processingTestUpstream}
|
2020-04-22 16:32:07 +00:00
|
|
|
processingSetConfig={processingSetConfig}
|
2019-03-06 11:45:21 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Upstream.propTypes = {
|
|
|
|
testUpstream: PropTypes.func.isRequired,
|
|
|
|
processingTestUpstream: PropTypes.bool.isRequired,
|
|
|
|
t: PropTypes.func.isRequired,
|
2020-04-22 16:32:07 +00:00
|
|
|
dnsConfig: PropTypes.object.isRequired,
|
|
|
|
setDnsConfig: PropTypes.func.isRequired,
|
2019-03-06 11:45:21 +00:00
|
|
|
};
|
|
|
|
|
2020-05-22 14:06:05 +00:00
|
|
|
export default withTranslation()(Upstream);
|