From 0c6f5d8f0e2df0339b1b7987f964e097e00bab3e Mon Sep 17 00:00:00 2001 From: Prabhat Sharma Date: Wed, 1 May 2024 11:37:03 +0530 Subject: [PATCH] Fixed Transform job create flow where indices won't reset after change of datasource Signed-off-by: Prabhat Sharma --- .../containers/CreateRollup/CreateRollup.tsx | 1 - .../CreateTransformForm.tsx | 99 +++++++++++-------- .../SetUpIndicesStep/SetUpIndicesStep.tsx | 5 +- 3 files changed, 59 insertions(+), 46 deletions(-) diff --git a/public/pages/CreateRollup/containers/CreateRollup/CreateRollup.tsx b/public/pages/CreateRollup/containers/CreateRollup/CreateRollup.tsx index 92905139e..ddef06dc0 100644 --- a/public/pages/CreateRollup/containers/CreateRollup/CreateRollup.tsx +++ b/public/pages/CreateRollup/containers/CreateRollup/CreateRollup.tsx @@ -13,7 +13,6 @@ import CreateRollupSteps from "../../components/CreateRollupSteps"; import IndexService from "../../../../services/IndexService"; import { IndexItem } from "../../../../../models/interfaces"; import { DataSourceMenuContext, DataSourceMenuProperties } from "../../../../services/DataSourceMenuContext"; -import { useUpdateUrlWithDataSourceProperties } from "../../../../components/MDSEnabledComponent"; interface CreateRollupProps extends RouteComponentProps, DataSourceMenuProperties { rollupService: RollupService; diff --git a/public/pages/CreateTransform/containers/CreateTransformForm/CreateTransformForm.tsx b/public/pages/CreateTransform/containers/CreateTransformForm/CreateTransformForm.tsx index 1c788e442..644a01710 100644 --- a/public/pages/CreateTransform/containers/CreateTransformForm/CreateTransformForm.tsx +++ b/public/pages/CreateTransform/containers/CreateTransformForm/CreateTransformForm.tsx @@ -89,52 +89,54 @@ export class CreateTransformForm extends Component) { + if (prevProps.dataSourceId !== this.props.dataSourceId) { + // reset the state, if dataSourceId changes, i.e., clear state + this.setState({ + ...CreateTransformForm.baseState, + transformId: this.state.transformId, + description: this.state.description, + }); + } + } + componentWillUnmount() { this._isMount = false; } diff --git a/public/pages/CreateTransform/containers/SetUpIndicesStep/SetUpIndicesStep.tsx b/public/pages/CreateTransform/containers/SetUpIndicesStep/SetUpIndicesStep.tsx index 04fa983ac..b4689d0b9 100644 --- a/public/pages/CreateTransform/containers/SetUpIndicesStep/SetUpIndicesStep.tsx +++ b/public/pages/CreateTransform/containers/SetUpIndicesStep/SetUpIndicesStep.tsx @@ -12,8 +12,9 @@ import TransformIndices from "../../components/TransformIndices"; import CreateTransformSteps from "../../components/CreateTransformSteps"; import IndexService from "../../../../services/IndexService"; import { FieldItem, IndexItem } from "../../../../../models/interfaces"; +import { DataSourceMenuContext, DataSourceMenuProperties } from "../../../../services/DataSourceMenuContext"; -interface SetUpIndicesStepProps extends RouteComponentProps { +interface SetUpIndicesStepProps extends RouteComponentProps, DataSourceMenuProperties { transformService: TransformService; indexService: IndexService; transformId: string; @@ -59,7 +60,7 @@ export default class SetUpIndicesStep extends Component { - +