|
@@ -19,15 +19,10 @@ import connectToStores from 'alt-utils/lib/connectToStores'
|
|
|
|
|
|
|
|
import {
|
|
import {
|
|
|
EndpointLogos,
|
|
EndpointLogos,
|
|
|
- EndpointField,
|
|
|
|
|
- Button,
|
|
|
|
|
StatusIcon,
|
|
StatusIcon,
|
|
|
- LoadingButton,
|
|
|
|
|
CopyButton,
|
|
CopyButton,
|
|
|
Tooltip,
|
|
Tooltip,
|
|
|
StatusImage,
|
|
StatusImage,
|
|
|
- RadioInput,
|
|
|
|
|
- TextArea,
|
|
|
|
|
} from 'components'
|
|
} from 'components'
|
|
|
import NotificationActions from '../../../actions/NotificationActions'
|
|
import NotificationActions from '../../../actions/NotificationActions'
|
|
|
import EndpointStore from '../../../stores/EndpointStore'
|
|
import EndpointStore from '../../../stores/EndpointStore'
|
|
@@ -37,7 +32,7 @@ import ProviderActions from '../../../actions/ProviderActions'
|
|
|
import ObjectUtils from '../../../utils/ObjectUtils'
|
|
import ObjectUtils from '../../../utils/ObjectUtils'
|
|
|
import Palette from '../../styleUtils/Palette'
|
|
import Palette from '../../styleUtils/Palette'
|
|
|
import DomUtils from '../../../utils/DomUtils'
|
|
import DomUtils from '../../../utils/DomUtils'
|
|
|
-import StyleProps from '../../styleUtils/StyleProps'
|
|
|
|
|
|
|
+import { ContentPlugin } from '../../../plugins/endpoint'
|
|
|
|
|
|
|
|
const Wrapper = styled.div`
|
|
const Wrapper = styled.div`
|
|
|
padding: 48px 32px 32px 32px;
|
|
padding: 48px 32px 32px 32px;
|
|
@@ -45,27 +40,6 @@ const Wrapper = styled.div`
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
`
|
|
`
|
|
|
-const Fields = styled.div`
|
|
|
|
|
- display: flex;
|
|
|
|
|
- flex-wrap: wrap;
|
|
|
|
|
- margin-left: -64px;
|
|
|
|
|
- margin-top: 32px;
|
|
|
|
|
-`
|
|
|
|
|
-const FieldStyled = styled(EndpointField)`
|
|
|
|
|
- margin-left: 64px;
|
|
|
|
|
- min-width: 224px;
|
|
|
|
|
- max-width: 224px;
|
|
|
|
|
- margin-bottom: 16px;
|
|
|
|
|
-`
|
|
|
|
|
-const RadioGroup = styled.div`
|
|
|
|
|
- width: 100%;
|
|
|
|
|
-`
|
|
|
|
|
-const Buttons = styled.div`
|
|
|
|
|
- display: flex;
|
|
|
|
|
- justify-content: space-between;
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- margin-top: 32px;
|
|
|
|
|
-`
|
|
|
|
|
const Status = styled.div`
|
|
const Status = styled.div`
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
@@ -111,31 +85,6 @@ const LoadingText = styled.div`
|
|
|
font-size: 18px;
|
|
font-size: 18px;
|
|
|
margin-top: 32px;
|
|
margin-top: 32px;
|
|
|
`
|
|
`
|
|
|
-const ConfigLabel = styled.div`
|
|
|
|
|
- font-size: 11px;
|
|
|
|
|
- margin-top: -10px;
|
|
|
|
|
- color: ${Palette.grayscale[3]};
|
|
|
|
|
-`
|
|
|
|
|
-const AdditionalConfigTitle = styled.div`
|
|
|
|
|
- text-align: center;
|
|
|
|
|
-`
|
|
|
|
|
-const AzureConfigInputType = styled.div`
|
|
|
|
|
- margin-top: 32px;
|
|
|
|
|
- > div {
|
|
|
|
|
- margin-bottom: 16px;
|
|
|
|
|
- }
|
|
|
|
|
-`
|
|
|
|
|
-const PasteField = styled.div`
|
|
|
|
|
- margin-top: 32px;
|
|
|
|
|
-`
|
|
|
|
|
-const PasteFieldLabel = styled.div`
|
|
|
|
|
- font-size: 10px;
|
|
|
|
|
- font-weight: ${StyleProps.fontWeights.medium};
|
|
|
|
|
- color: ${Palette.grayscale[3]};
|
|
|
|
|
- text-transform: uppercase;
|
|
|
|
|
- margin-bottom: 4px;
|
|
|
|
|
-`
|
|
|
|
|
-const PasteFieldInput = styled.div``
|
|
|
|
|
|
|
|
|
|
class Endpoint extends React.Component {
|
|
class Endpoint extends React.Component {
|
|
|
static propTypes = {
|
|
static propTypes = {
|
|
@@ -144,10 +93,8 @@ class Endpoint extends React.Component {
|
|
|
deleteOnCancel: PropTypes.bool,
|
|
deleteOnCancel: PropTypes.bool,
|
|
|
endpoint: PropTypes.object,
|
|
endpoint: PropTypes.object,
|
|
|
connectionInfo: PropTypes.object,
|
|
connectionInfo: PropTypes.object,
|
|
|
- onFieldChange: PropTypes.func,
|
|
|
|
|
onCancelClick: PropTypes.func,
|
|
onCancelClick: PropTypes.func,
|
|
|
onResizeUpdate: PropTypes.func,
|
|
onResizeUpdate: PropTypes.func,
|
|
|
- onValidateClick: PropTypes.func,
|
|
|
|
|
endpointStore: PropTypes.object,
|
|
endpointStore: PropTypes.object,
|
|
|
providerStore: PropTypes.object,
|
|
providerStore: PropTypes.object,
|
|
|
}
|
|
}
|
|
@@ -171,15 +118,11 @@ class Endpoint extends React.Component {
|
|
|
super()
|
|
super()
|
|
|
|
|
|
|
|
this.state = {
|
|
this.state = {
|
|
|
- fields: null,
|
|
|
|
|
invalidFields: [],
|
|
invalidFields: [],
|
|
|
validating: false,
|
|
validating: false,
|
|
|
showErrorMessage: false,
|
|
showErrorMessage: false,
|
|
|
endpoint: {},
|
|
endpoint: {},
|
|
|
isNew: null,
|
|
isNew: null,
|
|
|
- showAdditionalConfig: false, // if azure
|
|
|
|
|
- additionConfigManualInput: false, // if azure
|
|
|
|
|
- masJsonConfig: '', // if azure
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -188,9 +131,6 @@ class Endpoint extends React.Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
componentWillReceiveProps(props) {
|
|
componentWillReceiveProps(props) {
|
|
|
- let selectedRadio = this.getSelectedRadio(props.endpointStore.connectionInfo,
|
|
|
|
|
- props.providerStore.connectionInfoSchema)
|
|
|
|
|
-
|
|
|
|
|
if (this.state.validating) {
|
|
if (this.state.validating) {
|
|
|
if (props.endpointStore.validation && !props.endpointStore.validation.valid) {
|
|
if (props.endpointStore.validation && !props.endpointStore.validation.valid) {
|
|
|
this.setState({ validating: false })
|
|
this.setState({ validating: false })
|
|
@@ -201,7 +141,6 @@ class Endpoint extends React.Component {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
endpoint: {
|
|
endpoint: {
|
|
|
...ObjectUtils.flatten(props.endpoint),
|
|
...ObjectUtils.flatten(props.endpoint),
|
|
|
- ...selectedRadio,
|
|
|
|
|
...ObjectUtils.flatten(props.endpointStore.connectionInfo),
|
|
...ObjectUtils.flatten(props.endpointStore.connectionInfo),
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
@@ -210,7 +149,6 @@ class Endpoint extends React.Component {
|
|
|
isNew: this.state.isNew === null || this.state.isNew,
|
|
isNew: this.state.isNew === null || this.state.isNew,
|
|
|
endpoint: {
|
|
endpoint: {
|
|
|
type: props.type,
|
|
type: props.type,
|
|
|
- ...selectedRadio,
|
|
|
|
|
...ObjectUtils.flatten(this.state.endpoint),
|
|
...ObjectUtils.flatten(this.state.endpoint),
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
@@ -219,16 +157,9 @@ class Endpoint extends React.Component {
|
|
|
this.props.onResizeUpdate()
|
|
this.props.onResizeUpdate()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // if azure?
|
|
|
|
|
- componentDidUpdate(prevProps, prevState) {
|
|
|
|
|
- if (prevState.showAdditionalConfig !== this.state.showAdditionalConfig ||
|
|
|
|
|
- prevState.additionConfigManualInput !== this.state.additionConfigManualInput) {
|
|
|
|
|
- this.props.onResizeUpdate()
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
componentWillUnmount() {
|
|
componentWillUnmount() {
|
|
|
EndpointActions.clearValidation()
|
|
EndpointActions.clearValidation()
|
|
|
|
|
+ ProviderActions.clearConnectionInfoSchema()
|
|
|
clearTimeout(this.closeTimeout)
|
|
clearTimeout(this.closeTimeout)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -240,34 +171,7 @@ class Endpoint extends React.Component {
|
|
|
return this.props.type
|
|
return this.props.type
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- getSelectedRadio(connectionInfo, schema) {
|
|
|
|
|
- let radioGroup = schema.find(f => f.type === 'radio-group')
|
|
|
|
|
-
|
|
|
|
|
- if (!radioGroup) {
|
|
|
|
|
- return null
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- let selectedGroupItem = {}
|
|
|
|
|
-
|
|
|
|
|
- if (!connectionInfo) {
|
|
|
|
|
- selectedGroupItem[radioGroup.name] = radioGroup.default
|
|
|
|
|
- } else {
|
|
|
|
|
- radioGroup.items.forEach(i => {
|
|
|
|
|
- let key = Object.keys(connectionInfo).find(k => k === i.name)
|
|
|
|
|
- if (key) {
|
|
|
|
|
- selectedGroupItem[radioGroup.name] = key
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return selectedGroupItem
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- getFieldValue(field, parentGroup) {
|
|
|
|
|
- if (parentGroup) {
|
|
|
|
|
- return this.state.endpoint[parentGroup.name] === field.name
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ getFieldValue(field) {
|
|
|
if (this.state.endpoint[field.name]) {
|
|
if (this.state.endpoint[field.name]) {
|
|
|
return this.state.endpoint[field.name]
|
|
return this.state.endpoint[field.name]
|
|
|
}
|
|
}
|
|
@@ -283,26 +187,8 @@ class Endpoint extends React.Component {
|
|
|
return this.state.validating
|
|
return this.state.validating
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // if azure - isFinal
|
|
|
|
|
- findInvalidFields(invalidFields, schemaRoot, isFinal) {
|
|
|
|
|
- schemaRoot.forEach(field => {
|
|
|
|
|
- if (field.type === 'radio-group') {
|
|
|
|
|
- let selectedItem = field.items.find(i => i.name === this.state.endpoint[field.name])
|
|
|
|
|
- this.findInvalidFields(invalidFields, selectedItem.fields)
|
|
|
|
|
- } else if (field.required) {
|
|
|
|
|
- let value = this.getFieldValue(field)
|
|
|
|
|
- if (!value) {
|
|
|
|
|
- invalidFields.push(field.name)
|
|
|
|
|
- }
|
|
|
|
|
- } else if (isFinal && field.name === 'cloud_profile' && this.state.endpoint.cloud_profile === 'CustomCloud') {
|
|
|
|
|
- this.findInvalidFields(invalidFields, field.custom_cloud_fields)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- highlightRequired(isFinal) {
|
|
|
|
|
- let invalidFields = []
|
|
|
|
|
- this.findInvalidFields(invalidFields, this.props.providerStore.connectionInfoSchema, isFinal)
|
|
|
|
|
|
|
+ highlightRequired() {
|
|
|
|
|
+ let invalidFields = this.contentPluginRef.findInvalidFields()
|
|
|
this.setState({ invalidFields })
|
|
this.setState({ invalidFields })
|
|
|
return invalidFields.length > 0
|
|
return invalidFields.length > 0
|
|
|
}
|
|
}
|
|
@@ -323,14 +209,12 @@ class Endpoint extends React.Component {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- handleFieldChange(field, value, parentGroup) {
|
|
|
|
|
|
|
+ handleFieldsChange(items) {
|
|
|
let endpoint = { ...this.state.endpoint }
|
|
let endpoint = { ...this.state.endpoint }
|
|
|
|
|
|
|
|
- if (parentGroup) {
|
|
|
|
|
- endpoint[parentGroup.name] = field.name
|
|
|
|
|
- } else {
|
|
|
|
|
- endpoint[field.name] = value
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ items.forEach(item => {
|
|
|
|
|
+ endpoint[item.field.name] = item.value
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
this.setState({ endpoint })
|
|
this.setState({ endpoint })
|
|
|
}
|
|
}
|
|
@@ -371,101 +255,6 @@ class Endpoint extends React.Component {
|
|
|
this.props.onCancelClick()
|
|
this.props.onCancelClick()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // if azure
|
|
|
|
|
- handleNextClick() {
|
|
|
|
|
- if (!this.highlightRequired()) {
|
|
|
|
|
- this.setState({ showAdditionalConfig: true })
|
|
|
|
|
- } else {
|
|
|
|
|
- NotificationActions.notify('Please fill all the required fields', 'error')
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // if azure
|
|
|
|
|
- handleMasJsonConfigChange(value) {
|
|
|
|
|
- this.setState({ masJsonConfig: value })
|
|
|
|
|
-
|
|
|
|
|
- // JSON parse
|
|
|
|
|
- let json
|
|
|
|
|
- try {
|
|
|
|
|
- json = JSON.parse(value)
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (!json.endpoints || !json.suffixes) {
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const fieldNameMapper = {
|
|
|
|
|
- activeDirectory: 'active_directory_url',
|
|
|
|
|
- activeDirectoryDataLakeResourceId: 'active_directory_data_lake_resource_id',
|
|
|
|
|
- activeDirectoryGraphResourceId: 'active_directory_graph_resource_id',
|
|
|
|
|
- activeDirectoryResourceId: 'active_directory_resource_id',
|
|
|
|
|
- batchResourceId: 'batch_resource_endpoint',
|
|
|
|
|
- gallery: 'gallery_endpoint',
|
|
|
|
|
- management: 'management_endpoint',
|
|
|
|
|
- resourceManager: 'resource_manager_endpoint',
|
|
|
|
|
- sqlManagement: 'sql_management_endpoint',
|
|
|
|
|
- vmImageAliasDoc: 'vm_image_alias_doc',
|
|
|
|
|
- azureDatalakeAnalyticsCatalogAndJobEndpoint: 'azure_datalake_analytics_catalog_and_job_endpoint',
|
|
|
|
|
- azureDatalakeStoreFileSystemEndpoint: 'azure_datalake_store_file_system_endpoint',
|
|
|
|
|
- keyvaultDns: 'keyvault_dns',
|
|
|
|
|
- sqlServerHostname: 'sql_server_hostname',
|
|
|
|
|
- storageEndpoint: 'storage_endpoint',
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- let endpoint = this.state.endpoint
|
|
|
|
|
- const setValue = (object, key) => {
|
|
|
|
|
- if (object[key]) {
|
|
|
|
|
- endpoint[fieldNameMapper[key]] = object[key]
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- Object.keys(json.endpoints).forEach(k => {
|
|
|
|
|
- setValue(json.endpoints, k)
|
|
|
|
|
- })
|
|
|
|
|
- Object.keys(json.suffixes).forEach(k => {
|
|
|
|
|
- setValue(json.suffixes, k)
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- this.setState({ endpoint })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- renderFields(fields, parentGroup) {
|
|
|
|
|
- let renderedFields = []
|
|
|
|
|
-
|
|
|
|
|
- fields.forEach(field => {
|
|
|
|
|
- if (field.type === 'radio-group') {
|
|
|
|
|
- renderedFields = renderedFields.concat(
|
|
|
|
|
- <RadioGroup key={field.name}>{this.renderFields(field.items, field)}</RadioGroup>
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
- field.items.forEach(item => {
|
|
|
|
|
- if (this.getFieldValue(item, field)) {
|
|
|
|
|
- renderedFields = renderedFields.concat(this.renderFields(item.fields))
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- renderedFields = renderedFields.concat(
|
|
|
|
|
- <FieldStyled
|
|
|
|
|
- {...field}
|
|
|
|
|
- large
|
|
|
|
|
- disabled={this.isValidating()
|
|
|
|
|
- || (this.props.endpointStore.validation && this.props.endpointStore.validation.valid)}
|
|
|
|
|
- key={field.name}
|
|
|
|
|
- password={field.name === 'password'}
|
|
|
|
|
- highlight={this.state.invalidFields.findIndex(fn => fn === field.name) > -1}
|
|
|
|
|
- value={this.getFieldValue(field, parentGroup)}
|
|
|
|
|
- onChange={value => { this.handleFieldChange(field, value, parentGroup) }}
|
|
|
|
|
- />
|
|
|
|
|
- )
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- return renderedFields
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
renderEndpointStatus() {
|
|
renderEndpointStatus() {
|
|
|
let validation = this.props.endpointStore.validation
|
|
let validation = this.props.endpointStore.validation
|
|
|
if (!this.isValidating() && !validation) {
|
|
if (!this.isValidating() && !validation) {
|
|
@@ -506,135 +295,30 @@ class Endpoint extends React.Component {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // if azure
|
|
|
|
|
- renderNextButton() {
|
|
|
|
|
- if (!this.state.endpoint.cloud_profile || this.state.endpoint.cloud_profile !== 'CustomCloud' || this.state.showAdditionalConfig) {
|
|
|
|
|
- return null
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return <Button large onClick={() => this.handleNextClick()}>Next</Button>
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- renderActionButton() {
|
|
|
|
|
- let nextButton = this.renderNextButton()
|
|
|
|
|
- if (nextButton) {
|
|
|
|
|
- return nextButton
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- let button = <Button large onClick={() => this.handleValidateClick()}>Validate and save</Button>
|
|
|
|
|
-
|
|
|
|
|
- let message = 'Validating Endpoint ...'
|
|
|
|
|
- let validation = this.props.endpointStore.validation
|
|
|
|
|
-
|
|
|
|
|
- if (this.isValidating() || (validation && validation.valid)) {
|
|
|
|
|
- if (validation && validation.valid) {
|
|
|
|
|
- message = 'Saving ...'
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- button = <LoadingButton large>{message}</LoadingButton>
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return button
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- renderCancelButton() {
|
|
|
|
|
- // if azure
|
|
|
|
|
- if (this.state.showAdditionalConfig) {
|
|
|
|
|
- return <Button large secondary onClick={() => { this.setState({ showAdditionalConfig: false }) }}>Back</Button>
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return <Button large secondary onClick={() => { this.handleCancelClick() }}>{this.props.cancelButtonText}</Button>
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // if azure
|
|
|
|
|
- renderAdditionalConfigLabel() {
|
|
|
|
|
- if (!this.state.endpoint.cloud_profile || this.state.endpoint.cloud_profile !== 'CustomCloud') {
|
|
|
|
|
- return null
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return <ConfigLabel>* Additional configuration required</ConfigLabel>
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
renderContent() {
|
|
renderContent() {
|
|
|
- // if azure
|
|
|
|
|
- if (this.props.providerStore.connectionSchemaLoading || this.state.showAdditionalConfig) {
|
|
|
|
|
|
|
+ if (this.props.providerStore.connectionSchemaLoading) {
|
|
|
return null
|
|
return null
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<Content>
|
|
<Content>
|
|
|
{this.renderEndpointStatus()}
|
|
{this.renderEndpointStatus()}
|
|
|
- <Fields>
|
|
|
|
|
- {this.renderFields(this.props.providerStore.connectionInfoSchema)}
|
|
|
|
|
- </Fields>
|
|
|
|
|
- {this.renderAdditionalConfigLabel()}
|
|
|
|
|
- <Buttons>
|
|
|
|
|
- {this.renderCancelButton()}
|
|
|
|
|
- {this.renderActionButton()}
|
|
|
|
|
- </Buttons>
|
|
|
|
|
- <Tooltip />
|
|
|
|
|
- {Tooltip.rebuild()}
|
|
|
|
|
- </Content>
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // if azure
|
|
|
|
|
- renderAdditionalConfigContent() {
|
|
|
|
|
- if (!this.state.showAdditionalConfig) {
|
|
|
|
|
- return null
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- let fieldsContent = null
|
|
|
|
|
-
|
|
|
|
|
- if (this.state.additionConfigManualInput) {
|
|
|
|
|
- fieldsContent = (
|
|
|
|
|
- <Fields>
|
|
|
|
|
- {this.renderFields(this.props.providerStore.connectionInfoSchema.find(f => f.name === 'cloud_profile').custom_cloud_fields)}
|
|
|
|
|
- </Fields>
|
|
|
|
|
- )
|
|
|
|
|
- } else {
|
|
|
|
|
- fieldsContent = (
|
|
|
|
|
- <PasteField>
|
|
|
|
|
- <PasteFieldLabel>Azure Stack Profile Configuration</PasteFieldLabel>
|
|
|
|
|
- <PasteFieldInput>
|
|
|
|
|
- <TextArea
|
|
|
|
|
- width="100%"
|
|
|
|
|
- height="164px"
|
|
|
|
|
- placeholder="Paste JSON output here"
|
|
|
|
|
- value={this.state.masJsonConfig}
|
|
|
|
|
- onChange={e => { this.handleMasJsonConfigChange(e.target.value) }}
|
|
|
|
|
- />
|
|
|
|
|
- </PasteFieldInput>
|
|
|
|
|
- </PasteField>
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- let title = <AdditionalConfigTitle>Azure Stack Additional Configuration</AdditionalConfigTitle>
|
|
|
|
|
- if (this.isValidating() || this.props.endpointStore.validation) {
|
|
|
|
|
- title = null
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return (
|
|
|
|
|
- <Content>
|
|
|
|
|
- {title}
|
|
|
|
|
- {this.renderEndpointStatus()}
|
|
|
|
|
- <AzureConfigInputType>
|
|
|
|
|
- <RadioInput
|
|
|
|
|
- checked={!this.state.additionConfigManualInput}
|
|
|
|
|
- label="Paste Configuration"
|
|
|
|
|
- onChange={e => { this.setState({ additionConfigManualInput: !e.target.checked }) }}
|
|
|
|
|
- />
|
|
|
|
|
- <RadioInput
|
|
|
|
|
- checked={this.state.additionConfigManualInput}
|
|
|
|
|
- label="Manual Input"
|
|
|
|
|
- onChange={e => { this.setState({ additionConfigManualInput: e.target.checked }) }}
|
|
|
|
|
- />
|
|
|
|
|
- </AzureConfigInputType>
|
|
|
|
|
- {fieldsContent}
|
|
|
|
|
- <Buttons>
|
|
|
|
|
- {this.renderCancelButton()}
|
|
|
|
|
- {this.renderActionButton()}
|
|
|
|
|
- </Buttons>
|
|
|
|
|
|
|
+ {React.createElement(ContentPlugin[this.getEndpointType()] || ContentPlugin.default, {
|
|
|
|
|
+ connectionInfoSchema: this.props.providerStore.connectionInfoSchema,
|
|
|
|
|
+ validation: this.props.endpointStore.validation,
|
|
|
|
|
+ invalidFields: this.state.invalidFields,
|
|
|
|
|
+ validating: this.state.validating,
|
|
|
|
|
+ disabled: this.isValidating() || (this.props.endpointStore.validation && this.props.endpointStore.validation.valid),
|
|
|
|
|
+ cancelButtonText: this.props.cancelButtonText,
|
|
|
|
|
+ getFieldValue: field => this.getFieldValue(field),
|
|
|
|
|
+ highlightRequired: () => this.highlightRequired(),
|
|
|
|
|
+ handleFieldChange: (field, value) => { this.handleFieldsChange([{ field, value }]) },
|
|
|
|
|
+ handleFieldsChange: fields => { this.handleFieldsChange(fields) },
|
|
|
|
|
+ handleValidateClick: () => { this.handleValidateClick() },
|
|
|
|
|
+ handleCancelClick: () => { this.handleCancelClick() },
|
|
|
|
|
+ onRef: ref => { this.contentPluginRef = ref },
|
|
|
|
|
+ onResizeUpdate: () => { this.props.onResizeUpdate() },
|
|
|
|
|
+ })}
|
|
|
<Tooltip />
|
|
<Tooltip />
|
|
|
{Tooltip.rebuild()}
|
|
{Tooltip.rebuild()}
|
|
|
</Content>
|
|
</Content>
|
|
@@ -666,7 +350,6 @@ class Endpoint extends React.Component {
|
|
|
<Wrapper>
|
|
<Wrapper>
|
|
|
<EndpointLogos style={{ marginBottom: '16px' }} height={128} endpoint={this.getEndpointType()} />
|
|
<EndpointLogos style={{ marginBottom: '16px' }} height={128} endpoint={this.getEndpointType()} />
|
|
|
{this.renderContent()}
|
|
{this.renderContent()}
|
|
|
- {this.renderAdditionalConfigContent()}
|
|
|
|
|
{this.renderLoading()}
|
|
{this.renderLoading()}
|
|
|
</Wrapper>
|
|
</Wrapper>
|
|
|
)
|
|
)
|