From 05c5f928545b8171cbc16f09ee7471a4427a999f Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Tue, 11 Jun 2024 16:55:15 -0700 Subject: [PATCH] =?UTF-8?q?fix=20the=20bug=20that=20index=20field=20is=20n?= =?UTF-8?q?ot=20getting=20populated=20when=20editing=20a=20=E2=80=A6=20(#7?= =?UTF-8?q?83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix the bug that index field is not getting populated when editing a detector Signed-off-by: Jackie Han * update documentation Signed-off-by: Jackie Han --------- Signed-off-by: Jackie Han (cherry picked from commit 2198a20c8eefdc82f6a88e313dae320302f378e0) --- .../DefineDetector/components/Datasource/DataSource.tsx | 7 +++---- ...-anomaly-detection-dashboards.release-notes-2.15.0.0.md | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/pages/DefineDetector/components/Datasource/DataSource.tsx b/public/pages/DefineDetector/components/Datasource/DataSource.tsx index 904e1b0b..540605c6 100644 --- a/public/pages/DefineDetector/components/Datasource/DataSource.tsx +++ b/public/pages/DefineDetector/components/Datasource/DataSource.tsx @@ -61,12 +61,11 @@ export function DataSource(props: DataSourceProps) { const { setFieldValue } = useFormikContext(); useEffect(() => { - setFieldValue('index', []); - setFieldValue('timeField', undefined); - setFieldValue('filters', []); - const getInitialIndices = async () => { await dispatch(getIndices(queryText, dataSourceId)); + setFieldValue('index', props.formikProps.values.index); + setFieldValue('timeField', props.formikProps.values.timeField); + setFieldValue('filters', props.formikProps.values.filters); }; getInitialIndices(); }, [dataSourceId]); diff --git a/release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.15.0.0.md b/release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.15.0.0.md index cd288728..dd1c61c5 100644 --- a/release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.15.0.0.md +++ b/release-notes/opensearch-anomaly-detection-dashboards.release-notes-2.15.0.0.md @@ -13,6 +13,7 @@ Compatible with OpenSearch Dashboards 2.15.0 * Fix handling of special characters in categorical values ([#757](https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/pull/757)) * Fix Warning Message About Custom Result Index Despite Existing Indices ([#759](https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/pull/759)) +* Fix index field not getting populated when editing a detector ([#783](https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/pull/783)) ### Maintenance