Add https checking to SourceStep

pull/4129/head
Deniz Kusefoglu 2018-08-01 12:13:03 -07:00
parent a510c77e98
commit e1d06a718a
1 changed files with 14 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import {
notifySourceCreationFailed, notifySourceCreationFailed,
notifySourceCreationSucceeded, notifySourceCreationSucceeded,
} from 'src/shared/copy/notifications' } from 'src/shared/copy/notifications'
import {insecureSkipVerifyText} from 'src/shared/copy/tooltipText'
import {Source} from 'src/types' import {Source} from 'src/types'
import {DEFAULT_SOURCE} from 'src/shared/constants' import {DEFAULT_SOURCE} from 'src/shared/constants'
@ -87,9 +88,16 @@ class SourceStep extends PureComponent<Props, State> {
/> />
<WizardCheckbox <WizardCheckbox
isChecked={source.default} isChecked={source.default}
text="Make this the default connection" text={'Make this the default connection'}
onChange={this.onChangeInput('default')} onChange={this.onChangeInput('default')}
/> />
{this.isHTTPS && (
<WizardCheckbox
isChecked={source.insecureSkipVerify}
text={`Unsafe SSL: ${insecureSkipVerifyText}`}
onChange={this.onChangeInput('insecureSkipVerify')}
/>
)}
</> </>
) )
} }
@ -110,6 +118,11 @@ class SourceStep extends PureComponent<Props, State> {
const {source} = this.state const {source} = this.state
this.setState({source: {...source, [key]: value}}) this.setState({source: {...source, [key]: value}})
} }
private get isHTTPS(): boolean {
const {source} = this.state
return getDeep<string>(source, 'url', '').startsWith('https')
}
} }
const mdtp = { const mdtp = {