@@ -47,15 +47,18 @@ import {isSystemBucket} from 'src/buckets/constants'
4747import { getBucketOverlayWidth } from 'src/buckets/constants'
4848const TELEGRAF_UI_REFRESH_OVERLAY_DEFAULT_WIDTH = 1200
4949
50+ interface OwnProps {
51+ onClose : ( ) => void
52+ }
53+
5054type ReduxProps = ConnectedProps < typeof connector >
51- type Props = ReduxProps & RouteComponentProps < { orgID : string } >
55+ type Props = OwnProps & ReduxProps & RouteComponentProps < { orgID : string } >
5256
5357@ErrorHandling
5458class TelegrafUIRefreshWizard extends PureComponent < Props > {
5559 public state = {
5660 pluginConfig : '' ,
5761 isValidConfiguration : false ,
58- isVisible : true ,
5962 }
6063
6164 public componentDidMount ( ) {
@@ -80,31 +83,35 @@ class TelegrafUIRefreshWizard extends PureComponent<Props> {
8083 }
8184
8285 return (
83- < Overlay visible = { this . state . isVisible } >
84- < Overlay . Container maxWidth = { maxWidth } >
85- < Overlay . Header
86- title = "Create a Telegraf Configuration"
87- onDismiss = { this . handleDismiss }
88- />
89- < Overlay . Body className = { overlayBodyClassName } >
90- < TelegrafUIRefreshStepSwitcher stepProps = { this . stepProps } />
91- </ Overlay . Body >
92- < Footer { ...this . stepProps } />
93- </ Overlay . Container >
94- </ Overlay >
86+ < Overlay . Container maxWidth = { maxWidth } >
87+ < Overlay . Header
88+ title = "Create a Telegraf Configuration"
89+ onDismiss = { this . handleDismiss }
90+ />
91+ < Overlay . Body className = { overlayBodyClassName } >
92+ < TelegrafUIRefreshStepSwitcher stepProps = { this . stepProps } />
93+ </ Overlay . Body >
94+ < Footer { ...this . stepProps } />
95+ </ Overlay . Container >
9596 )
9697 }
9798
9899 private handleDismiss = ( ) => {
99- const { history, locationOnDismiss, org} = this . props
100- const { clearDataLoaders, onClearSteps} = this . props
100+ const {
101+ clearDataLoaders,
102+ onClearSteps,
103+ onClose,
104+ history,
105+ locationOnDismiss,
106+ } = this . props
101107 clearDataLoaders ( )
102108 onClearSteps ( )
103- this . setState ( { isVisible : false } )
104- const location = locationOnDismiss
105- ? locationOnDismiss
106- : `/orgs/${ org . id } /load-data/telegrafs`
107- history . push ( location )
109+ if ( locationOnDismiss ) {
110+ onClose ( )
111+ history . push ( locationOnDismiss )
112+ } else {
113+ onClose ( )
114+ }
108115 }
109116
110117 private handleSetIsValidConfiguration = ( isValid : boolean ) => {
0 commit comments