Add CompletionStep to Connection Wizard

pull/4129/head
Deniz Kusefoglu 2018-08-02 14:15:54 -07:00
parent 5419f43d57
commit f184ae204f
2 changed files with 54 additions and 22 deletions

View File

@ -0,0 +1,44 @@
// Libraries
import React, {PureComponent} from 'react'
import {connect} from 'react-redux'
// Components
import {ErrorHandling} from 'src/shared/decorators/errors'
// Actions
import {notify as notifyAction} from 'src/shared/actions/notifications'
// Utils
// APIs
// Constants
// Types
interface Props {
notify: typeof notifyAction
}
// interface State {}
@ErrorHandling
class SourceStep extends PureComponent<Props> {
constructor(props: Props) {
super(props)
}
public next = async () => {
// navigate to newly created source?
}
public render() {
return <>Congratulations! you are complete!</>
}
}
const mdtp = {
notify: notifyAction,
}
export default connect(null, mdtp, null, {withRef: true})(SourceStep)

View File

@ -8,7 +8,6 @@ import WizardOverlay from 'src/reusable_ui/components/wizard/WizardOverlay'
import WizardStep from 'src/reusable_ui/components/wizard/WizardStep' import WizardStep from 'src/reusable_ui/components/wizard/WizardStep'
import SourceStep from 'src/sources/components/SourceStep' import SourceStep from 'src/sources/components/SourceStep'
import KapacitorStep from 'src/sources/components/KapacitorStep' import KapacitorStep from 'src/sources/components/KapacitorStep'
import DashboardsStep from 'src/sources/components/DashboardsStep'
import CompletionStep from 'src/sources/components/CompletionStep' import CompletionStep from 'src/sources/components/CompletionStep'
// Types // Types
@ -28,6 +27,7 @@ interface State {
class ConnectionWizard extends PureComponent<Props, State> { class ConnectionWizard extends PureComponent<Props, State> {
public sourceStepRef: any public sourceStepRef: any
public kapacitorStepRef: any public kapacitorStepRef: any
public completionStepRef: any
constructor(props: Props) { constructor(props: Props) {
super(props) super(props)
this.state = { this.state = {
@ -73,25 +73,18 @@ class ConnectionWizard extends PureComponent<Props, State> {
source={source} source={source}
/> />
</WizardStep> </WizardStep>
<WizardStep
title="Select Preset Dashboards"
tipText="this step is optional"
isComplete={this.isDashboardComplete}
onNext={this.handleDashboardNext}
onPrevious={this.handleDashboardPrev}
nextLabel="Complete Connection"
previousLabel="Go Back"
>
something something
</WizardStep>
<WizardStep <WizardStep
title="You are complete" title="You are complete"
isComplete={this.isDashboardComplete}
tipText="yay" tipText="yay"
isComplete={this.isCompletionComplete}
onNext={this.handleCompletionNext}
onPrevious={this.handleCompletionPrev}
nextLabel="Dismiss" nextLabel="Dismiss"
previousLabel="Go Back" previousLabel="Go Back"
> >
yay! <CompletionStep
ref={c => (this.completionStepRef = c && c.getWrappedInstance())}
/>
</WizardStep> </WizardStep>
</WizardOverlay> </WizardOverlay>
) )
@ -101,7 +94,6 @@ class ConnectionWizard extends PureComponent<Props, State> {
const source = await this.sourceStepRef.next() const source = await this.sourceStepRef.next()
this.setState({source}) this.setState({source})
} }
private isSourceComplete = () => { private isSourceComplete = () => {
const {source} = this.state const {source} = this.state
return !_.isNull(source) return !_.isNull(source)
@ -111,21 +103,17 @@ class ConnectionWizard extends PureComponent<Props, State> {
const {kapacitor} = this.state const {kapacitor} = this.state
return !_.isNull(kapacitor) return !_.isNull(kapacitor)
} }
private handleKapacitorNext = async () => { private handleKapacitorNext = async () => {
const kapacitor = await this.kapacitorStepRef.next() const kapacitor = await this.kapacitorStepRef.next()
this.setState({kapacitor}) this.setState({kapacitor})
} }
private handleKapacitorPrev = () => {} private handleKapacitorPrev = () => {}
private isDashboardComplete = () => { private isCompletionComplete = () => {
return false return false
} }
private handleCompletionNext = () => {}
private handleDashboardNext = () => {} private handleCompletionPrev = () => {}
private handleDashboardPrev = () => {}
} }
export default ConnectionWizard export default ConnectionWizard