Skip to content

Commit 538be44

Browse files
authored
fix: redirect users to a plugin's page on cancel instead of going back (#3016)
1 parent 1ec06ed commit 538be44

File tree

2 files changed

+21
-4
lines changed
  • src/writeData/components

2 files changed

+21
-4
lines changed

src/writeData/components/PluginAddToExistingConfiguration/Wizard.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ import {
2323
} from 'src/dataLoaders/actions/steps'
2424
import {clearDataLoaders} from 'src/dataLoaders/actions/dataLoaders'
2525

26+
// Selectors
27+
import {getOrg} from 'src/organizations/selectors'
28+
29+
// Constants
30+
import {TELEGRAF_PLUGINS} from 'src/shared/constants/routes'
2631
const PLUGIN_CREATE_CONFIGURATION_OVERLAY_DEFAULT_WIDTH = 1200
2732
const PLUGIN_CREATE_CONFIGURATION_OVERLAY_OPTIONS_WIDTH = 480
2833
const PREVENT_OVERLAY_FLICKER_STEP = -1
@@ -39,7 +44,7 @@ const StepSwitcher = Loadable({
3944

4045
interface WizardProps {
4146
history: {
42-
goBack: () => void
47+
push: (route: string) => void
4348
}
4449
}
4550

@@ -61,6 +66,7 @@ const Wizard: FC<Props> = props => {
6166
onIncrementCurrentStepIndex,
6267
onSetCurrentStepIndex,
6368
onSetSubstepIndex,
69+
org,
6470
} = props
6571

6672
const {contentID} = useParams<ParamsType>()
@@ -80,7 +86,7 @@ const Wizard: FC<Props> = props => {
8086
onClearDataLoaders()
8187
onClearSteps()
8288
onSetCurrentStepIndex(PREVENT_OVERLAY_FLICKER_STEP)
83-
history.goBack()
89+
history.push(`/orgs/${org.id}/load-data/${TELEGRAF_PLUGINS}/${contentID}`)
8490
setIsVisible(false)
8591
}
8692

@@ -134,8 +140,11 @@ const mstp = (state: AppState) => {
134140
},
135141
} = state
136142

143+
const org = getOrg(state)
144+
137145
return {
138146
currentStepIndex: currentStep,
147+
org,
139148
}
140149
}
141150

src/writeData/components/PluginCreateConfiguration/Wizard.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ import {
2424
} from 'src/dataLoaders/actions/steps'
2525
import {clearDataLoaders} from 'src/dataLoaders/actions/dataLoaders'
2626

27+
// Selectors
28+
import {getOrg} from 'src/organizations/selectors'
29+
2730
// Constants
2831
import {getBucketOverlayWidth} from 'src/buckets/constants'
32+
import {TELEGRAF_PLUGINS} from 'src/shared/constants/routes'
2933
const PLUGIN_CREATE_CONFIGURATION_OVERLAY_DEFAULT_WIDTH = 1200
3034
const PLUGIN_CREATE_CONFIGURATION_OVERLAY_OPTIONS_WIDTH = 480
3135

@@ -39,7 +43,7 @@ const StepSwitcher = Loadable({
3943

4044
interface WizardProps {
4145
history: {
42-
goBack: () => void
46+
push: (route: string) => void
4347
}
4448
}
4549

@@ -61,6 +65,7 @@ const Wizard: FC<Props> = props => {
6165
onIncrementCurrentStepIndex,
6266
onSetCurrentStepIndex,
6367
onSetSubstepIndex,
68+
org,
6469
setBucketInfo,
6570
substepIndex,
6671
} = props
@@ -87,7 +92,7 @@ const Wizard: FC<Props> = props => {
8792
onSetSubstepIndex(0, 0)
8893
} else {
8994
setIsVisible(false)
90-
history.goBack()
95+
history.push(`/orgs/${org.id}/load-data/${TELEGRAF_PLUGINS}/${contentID}`)
9196
}
9297
}
9398

@@ -148,8 +153,11 @@ const mstp = (state: AppState) => {
148153
},
149154
} = state
150155

156+
const org = getOrg(state)
157+
151158
return {
152159
currentStepIndex: currentStep,
160+
org,
153161
substepIndex: typeof substep === 'number' ? substep : 0,
154162
}
155163
}

0 commit comments

Comments
 (0)