|
|
@@ -17,7 +17,7 @@ import styled from 'styled-components'
|
|
|
import PropTypes from 'prop-types'
|
|
|
import connectToStores from 'alt-utils/lib/connectToStores'
|
|
|
|
|
|
-import { EndpointLogos, EndpointField, Button, StatusIcon, LoadingButton, CopyButton, Tooltip } from 'components'
|
|
|
+import { EndpointLogos, EndpointField, Button, StatusIcon, LoadingButton, CopyButton, Tooltip, StatusImage } from 'components'
|
|
|
import NotificationActions from '../../../actions/NotificationActions'
|
|
|
import EndpointStore from '../../../stores/EndpointStore'
|
|
|
import EndpointActions from '../../../actions/EndpointActions'
|
|
|
@@ -87,6 +87,17 @@ const StatusError = styled.div`
|
|
|
margin-left: 4px;
|
|
|
}
|
|
|
`
|
|
|
+const Content = styled.div``
|
|
|
+const LoadingWrapper = styled.div`
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ margin: 32px 0;
|
|
|
+`
|
|
|
+const LoadingText = styled.div`
|
|
|
+ font-size: 18px;
|
|
|
+ margin-top: 32px;
|
|
|
+`
|
|
|
|
|
|
class Endpoint extends React.Component {
|
|
|
static propTypes = {
|
|
|
@@ -400,17 +411,13 @@ class Endpoint extends React.Component {
|
|
|
return button
|
|
|
}
|
|
|
|
|
|
- render() {
|
|
|
- if (this.props.endpointStore.validation && this.props.endpointStore.validation.valid
|
|
|
- && !this.closeTimeout) {
|
|
|
- this.closeTimeout = setTimeout(() => {
|
|
|
- this.props.onCancelClick({ autoClose: true })
|
|
|
- }, 2000)
|
|
|
+ renderContent() {
|
|
|
+ if (this.props.providerStore.connectionSchemaLoading) {
|
|
|
+ return null
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
- <Wrapper>
|
|
|
- <EndpointLogos style={{ marginBottom: '16px' }} height={128} endpoint={this.getEndpointType()} />
|
|
|
+ <Content>
|
|
|
{this.renderEndpointStatus()}
|
|
|
<Fields>
|
|
|
{this.renderFields(this.props.providerStore.connectionInfoSchema)}
|
|
|
@@ -421,6 +428,36 @@ class Endpoint extends React.Component {
|
|
|
<Button large secondary onClick={() => { this.handleCancelClick() }}>Cancel</Button>
|
|
|
{this.renderActionButton()}
|
|
|
</Buttons>
|
|
|
+ </Content>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ renderLoading() {
|
|
|
+ if (!this.props.providerStore.connectionSchemaLoading) {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+
|
|
|
+ return (
|
|
|
+ <LoadingWrapper>
|
|
|
+ <StatusImage loading />
|
|
|
+ <LoadingText>Loading connection schema ...</LoadingText>
|
|
|
+ </LoadingWrapper>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ render() {
|
|
|
+ if (this.props.endpointStore.validation && this.props.endpointStore.validation.valid
|
|
|
+ && !this.closeTimeout) {
|
|
|
+ this.closeTimeout = setTimeout(() => {
|
|
|
+ this.props.onCancelClick({ autoClose: true })
|
|
|
+ }, 2000)
|
|
|
+ }
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Wrapper>
|
|
|
+ <EndpointLogos style={{ marginBottom: '16px' }} height={128} endpoint={this.getEndpointType()} />
|
|
|
+ {this.renderContent()}
|
|
|
+ {this.renderLoading()}
|
|
|
</Wrapper>
|
|
|
)
|
|
|
}
|