2018-08-30 14:25:33 +00:00
import React , { Component } from 'react' ;
import PropTypes from 'prop-types' ;
2018-09-21 15:08:39 +00:00
import classnames from 'classnames' ;
2018-08-30 14:25:33 +00:00
import Card from '../ui/Card' ;
export default class Upstream extends Component {
handleChange = ( e ) => {
const { value } = e . currentTarget ;
this . props . handleUpstreamChange ( value ) ;
} ;
handleSubmit = ( e ) => {
e . preventDefault ( ) ;
this . props . handleUpstreamSubmit ( ) ;
} ;
2018-09-21 15:08:39 +00:00
handleTest = ( ) => {
this . props . handleUpstreamTest ( ) ;
}
2018-08-30 14:25:33 +00:00
render ( ) {
2018-09-21 15:08:39 +00:00
const testButtonClass = classnames ( {
'btn btn-primary btn-standart mr-2' : true ,
'btn btn-primary btn-standart mr-2 btn-loading' : this . props . processingTestUpstream ,
} ) ;
2018-08-30 14:25:33 +00:00
return (
< Card
title = "Upstream DNS servers"
2018-10-10 14:24:12 +00:00
subtitle = "If you keep this field empty, AdGuard will use <a href='https://1.1.1.1/' target='_blank'>Cloudflare DNS</a> as an upstream. Use tls:// prefix for DNS over TLS servers."
2018-08-30 14:25:33 +00:00
bodyType = "card-body box-body--settings"
>
< div className = "row" >
< div className = "col" >
< form >
< textarea
2018-09-26 15:38:06 +00:00
className = "form-control form-control--textarea"
value = { this . props . upstreamDns }
2018-08-30 14:25:33 +00:00
onChange = { this . handleChange }
/ >
< div className = "card-actions" >
2018-09-21 15:08:39 +00:00
< button
className = { testButtonClass }
type = "button"
onClick = { this . handleTest }
>
Test upstreams
< / b u t t o n >
2018-08-30 14:25:33 +00:00
< button
className = "btn btn-success btn-standart"
type = "submit"
onClick = { this . handleSubmit }
>
Apply
< / b u t t o n >
< / d i v >
< / f o r m >
< / d i v >
< / d i v >
< / C a r d >
) ;
}
}
Upstream . propTypes = {
2018-09-26 15:38:06 +00:00
upstreamDns : PropTypes . string ,
2018-09-21 15:08:39 +00:00
processingTestUpstream : PropTypes . bool ,
2018-08-30 14:25:33 +00:00
handleUpstreamChange : PropTypes . func ,
handleUpstreamSubmit : PropTypes . func ,
2018-09-21 15:08:39 +00:00
handleUpstreamTest : PropTypes . func ,
2018-08-30 14:25:33 +00:00
} ;