From d3de57370aea8227ac2dd85a80003d37ec213ca0 Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Wed, 14 Feb 2024 14:12:01 -0800 Subject: [PATCH 1/6] update snapshots Signed-off-by: Jackie Han --- .../__snapshots__/AnomalyStat.test.tsx.snap | 12 +++- .../AnomalyHeatmapChart.test.tsx.snap | 36 ++++++++-- .../AggregationSelector.test.tsx.snap | 12 +++- .../__snapshots__/CategoryField.test.tsx.snap | 18 ++++- .../ConfigureModel.test.tsx.snap | 66 +++++++++++++++---- .../EmptyDashboard.test.tsx.snap | 6 +- .../__snapshots__/IndexOption.test.tsx.snap | 6 +- .../__snapshots__/Settings.test.tsx.snap | 12 +++- .../DefineDetector.test.tsx.snap | 42 ++++++++++-- .../DetectorConfig.test.tsx.snap | 18 ++++- .../DetectorControls.test.tsx.snap | 6 +- .../MonitorCallout.test.tsx.snap | 12 +++- .../__snapshots__/HistoricalJob.test.tsx.snap | 6 +- .../__snapshots__/RealTimeJob.test.tsx.snap | 6 +- .../__snapshots__/DetectorJobs.test.tsx.snap | 12 +++- .../__snapshots__/ListControls.test.tsx.snap | 12 +++- .../__snapshots__/ListFilters.test.tsx.snap | 30 +++++++-- ...ptyHistoricalDetectorResults.test.tsx.snap | 6 +- .../__snapshots__/SampleDataBox.test.tsx.snap | 6 +- .../SampleDataCallout.test.tsx.snap | 12 +++- .../AnomalyDetectionOverview.test.tsx.snap | 48 +++++++++++--- .../ModelConfigurationFields.test.tsx.snap | 18 ++++- .../ReviewAndCreate.test.tsx.snap | 12 +++- 23 files changed, 345 insertions(+), 69 deletions(-) diff --git a/public/pages/AnomalyCharts/components/AnomaliesStat/__tests__/__snapshots__/AnomalyStat.test.tsx.snap b/public/pages/AnomalyCharts/components/AnomaliesStat/__tests__/__snapshots__/AnomalyStat.test.tsx.snap index 65ee1883..4d0a9440 100644 --- a/public/pages/AnomalyCharts/components/AnomaliesStat/__tests__/__snapshots__/AnomalyStat.test.tsx.snap +++ b/public/pages/AnomalyCharts/components/AnomaliesStat/__tests__/__snapshots__/AnomalyStat.test.tsx.snap @@ -113,7 +113,11 @@ exports[` spec Alert Stat renders component with monitor and not l viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -282,7 +286,11 @@ exports[` spec Anomaly Stat with tooltip renders compo viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +

diff --git a/public/pages/AnomalyCharts/containers/__tests__/__snapshots__/AnomalyHeatmapChart.test.tsx.snap b/public/pages/AnomalyCharts/containers/__tests__/__snapshots__/AnomalyHeatmapChart.test.tsx.snap index 7cc82915..4517ab41 100644 --- a/public/pages/AnomalyCharts/containers/__tests__/__snapshots__/AnomalyHeatmapChart.test.tsx.snap +++ b/public/pages/AnomalyCharts/containers/__tests__/__snapshots__/AnomalyHeatmapChart.test.tsx.snap @@ -24,7 +24,11 @@ exports[` spec AnomalyHeatmapChart with Sample anomaly da viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -128,7 +132,11 @@ exports[` spec AnomalyHeatmapChart with Sample anomaly da viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -166,7 +174,11 @@ exports[` spec AnomalyHeatmapChart with Sample anomaly da viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -240,7 +256,11 @@ exports[` spec AnomalyHeatmapChart with Sample anomaly da viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -292,7 +312,11 @@ exports[` spec AnomalyHeatmapChart with Sample anomaly da viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/ConfigureModel/components/AggregationSelector/__tests__/__snapshots__/AggregationSelector.test.tsx.snap b/public/pages/ConfigureModel/components/AggregationSelector/__tests__/__snapshots__/AggregationSelector.test.tsx.snap index b82301bc..18303391 100644 --- a/public/pages/ConfigureModel/components/AggregationSelector/__tests__/__snapshots__/AggregationSelector.test.tsx.snap +++ b/public/pages/ConfigureModel/components/AggregationSelector/__tests__/__snapshots__/AggregationSelector.test.tsx.snap @@ -74,7 +74,11 @@ exports[` spec Empty results renders component with aggre viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -164,7 +168,11 @@ exports[` spec Empty results renders component with aggre viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap b/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap index df15a8a6..8c0d619a 100644 --- a/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap +++ b/public/pages/ConfigureModel/components/CategoryField/__tests__/__snapshots__/CategoryField.test.tsx.snap @@ -61,7 +61,11 @@ exports[` spec renders the component when disabled 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -263,7 +267,11 @@ exports[` spec renders the component when enabled 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -352,7 +360,11 @@ exports[` spec renders the component when enabled 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap b/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap index 365b6302..a7695db8 100644 --- a/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap +++ b/public/pages/ConfigureModel/containers/__tests__/__snapshots__/ConfigureModel.test.tsx.snap @@ -46,7 +46,11 @@ exports[` spec creating model configuration renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -106,7 +110,11 @@ exports[` spec creating model configuration renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -165,7 +173,11 @@ exports[` spec creating model configuration renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + spec creating model configuration renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -438,7 +454,11 @@ exports[` spec creating model configuration renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -528,7 +548,11 @@ exports[` spec creating model configuration renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -638,7 +662,11 @@ exports[` spec creating model configuration renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -684,7 +712,11 @@ exports[` spec creating model configuration renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -854,7 +886,11 @@ exports[` spec creating model configuration renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -895,7 +931,11 @@ exports[` spec creating model configuration renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -1686,7 +1726,11 @@ exports[` spec editing model configuration renders the compone viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap b/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap index 03d27a8e..67762b0d 100644 --- a/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap +++ b/public/pages/Dashboard/Components/EmptyDashboard/__tests__/__snapshots__/EmptyDashboard.test.tsx.snap @@ -45,7 +45,11 @@ exports[` spec Empty results renders component with empty messa viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/DefineDetector/components/Datasource/__tests__/__snapshots__/IndexOption.test.tsx.snap b/public/pages/DefineDetector/components/Datasource/__tests__/__snapshots__/IndexOption.test.tsx.snap index da9f3b91..b6546aba 100644 --- a/public/pages/DefineDetector/components/Datasource/__tests__/__snapshots__/IndexOption.test.tsx.snap +++ b/public/pages/DefineDetector/components/Datasource/__tests__/__snapshots__/IndexOption.test.tsx.snap @@ -20,7 +20,11 @@ exports[` spec renders the component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +
spec renders the component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -203,7 +207,11 @@ exports[` spec renders the component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/DefineDetector/containers/__tests__/__snapshots__/DefineDetector.test.tsx.snap b/public/pages/DefineDetector/containers/__tests__/__snapshots__/DefineDetector.test.tsx.snap index 8ccaa0d1..7c86c166 100644 --- a/public/pages/DefineDetector/containers/__tests__/__snapshots__/DefineDetector.test.tsx.snap +++ b/public/pages/DefineDetector/containers/__tests__/__snapshots__/DefineDetector.test.tsx.snap @@ -323,7 +323,11 @@ exports[` Full creating detector definition renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +
@@ -392,7 +396,11 @@ exports[` Full creating detector definition renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +
Full creating detector definition renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +
@@ -671,7 +683,11 @@ exports[` Full creating detector definition renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -775,7 +791,11 @@ exports[` Full creating detector definition renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -892,7 +912,11 @@ exports[` Full creating detector definition renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -2174,7 +2198,11 @@ exports[` empty editing detector definition renders the compon viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/DetectorConfig/containers/__tests__/__snapshots__/DetectorConfig.test.tsx.snap b/public/pages/DetectorConfig/containers/__tests__/__snapshots__/DetectorConfig.test.tsx.snap index 9ddc5f82..6580e900 100644 --- a/public/pages/DetectorConfig/containers/__tests__/__snapshots__/DetectorConfig.test.tsx.snap +++ b/public/pages/DetectorConfig/containers/__tests__/__snapshots__/DetectorConfig.test.tsx.snap @@ -606,7 +606,11 @@ exports[` spec renders the component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -661,7 +665,11 @@ exports[` spec renders the component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -1104,7 +1112,11 @@ exports[` spec renders the component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +
spec Detector Controls renders detector controls w viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/DetectorDetail/components/MonitorCallout/__tests__/__snapshots__/MonitorCallout.test.tsx.snap b/public/pages/DetectorDetail/components/MonitorCallout/__tests__/__snapshots__/MonitorCallout.test.tsx.snap index e9ff894d..44b14d8c 100644 --- a/public/pages/DetectorDetail/components/MonitorCallout/__tests__/__snapshots__/MonitorCallout.test.tsx.snap +++ b/public/pages/DetectorDetail/components/MonitorCallout/__tests__/__snapshots__/MonitorCallout.test.tsx.snap @@ -16,7 +16,11 @@ exports[` spec Monitor callout renders component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -49,7 +53,11 @@ exports[` spec Monitor callout renders component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/DetectorJobs/components/HistoricalJob/__tests__/__snapshots__/HistoricalJob.test.tsx.snap b/public/pages/DetectorJobs/components/HistoricalJob/__tests__/__snapshots__/HistoricalJob.test.tsx.snap index e5970a49..9c83d67e 100644 --- a/public/pages/DetectorJobs/components/HistoricalJob/__tests__/__snapshots__/HistoricalJob.test.tsx.snap +++ b/public/pages/DetectorJobs/components/HistoricalJob/__tests__/__snapshots__/HistoricalJob.test.tsx.snap @@ -49,7 +49,11 @@ exports[` spec renders the component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/DetectorJobs/components/RealTimeJob/__tests__/__snapshots__/RealTimeJob.test.tsx.snap b/public/pages/DetectorJobs/components/RealTimeJob/__tests__/__snapshots__/RealTimeJob.test.tsx.snap index f8391adb..0c727c43 100644 --- a/public/pages/DetectorJobs/components/RealTimeJob/__tests__/__snapshots__/RealTimeJob.test.tsx.snap +++ b/public/pages/DetectorJobs/components/RealTimeJob/__tests__/__snapshots__/RealTimeJob.test.tsx.snap @@ -49,7 +49,11 @@ exports[` spec renders the component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/DetectorJobs/containers/__tests__/__snapshots__/DetectorJobs.test.tsx.snap b/public/pages/DetectorJobs/containers/__tests__/__snapshots__/DetectorJobs.test.tsx.snap index a40c033e..89274801 100644 --- a/public/pages/DetectorJobs/containers/__tests__/__snapshots__/DetectorJobs.test.tsx.snap +++ b/public/pages/DetectorJobs/containers/__tests__/__snapshots__/DetectorJobs.test.tsx.snap @@ -69,7 +69,11 @@ exports[` spec configuring detector jobs renders the component 1 viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -175,7 +179,11 @@ exports[` spec configuring detector jobs renders the component 1 viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/DetectorResults/components/ListControls/__tests__/__snapshots__/ListControls.test.tsx.snap b/public/pages/DetectorResults/components/ListControls/__tests__/__snapshots__/ListControls.test.tsx.snap index 0962ac71..cdae893b 100644 --- a/public/pages/DetectorResults/components/ListControls/__tests__/__snapshots__/ListControls.test.tsx.snap +++ b/public/pages/DetectorResults/components/ListControls/__tests__/__snapshots__/ListControls.test.tsx.snap @@ -28,7 +28,11 @@ exports[` spec Empty results renders component with empty messag viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +
    spec Empty results renders component with empty messag viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +
diff --git a/public/pages/DetectorsList/components/ListFilters/__tests__/__snapshots__/ListFilters.test.tsx.snap b/public/pages/DetectorsList/components/ListFilters/__tests__/__snapshots__/ListFilters.test.tsx.snap index 6b517bd1..cb793711 100644 --- a/public/pages/DetectorsList/components/ListFilters/__tests__/__snapshots__/ListFilters.test.tsx.snap +++ b/public/pages/DetectorsList/components/ListFilters/__tests__/__snapshots__/ListFilters.test.tsx.snap @@ -36,7 +36,11 @@ exports[` spec Empty results renders component with empty message viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +
@@ -103,7 +107,11 @@ exports[` spec Empty results renders component with empty message viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -171,7 +179,11 @@ exports[` spec Empty results renders component with empty message viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -201,7 +213,11 @@ exports[` spec Empty results renders component with empty message viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +
    spec Empty results renders component with empty message viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/HistoricalDetectorResults/components/__tests__/__snapshots__/EmptyHistoricalDetectorResults.test.tsx.snap b/public/pages/HistoricalDetectorResults/components/__tests__/__snapshots__/EmptyHistoricalDetectorResults.test.tsx.snap index 0a555922..fbec394e 100644 --- a/public/pages/HistoricalDetectorResults/components/__tests__/__snapshots__/EmptyHistoricalDetectorResults.test.tsx.snap +++ b/public/pages/HistoricalDetectorResults/components/__tests__/__snapshots__/EmptyHistoricalDetectorResults.test.tsx.snap @@ -39,7 +39,11 @@ exports[` spec renders component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/Overview/components/SampleDataBox/__tests__/__snapshots__/SampleDataBox.test.tsx.snap b/public/pages/Overview/components/SampleDataBox/__tests__/__snapshots__/SampleDataBox.test.tsx.snap index 20c5ca11..fbec5767 100644 --- a/public/pages/Overview/components/SampleDataBox/__tests__/__snapshots__/SampleDataBox.test.tsx.snap +++ b/public/pages/Overview/components/SampleDataBox/__tests__/__snapshots__/SampleDataBox.test.tsx.snap @@ -255,7 +255,11 @@ exports[` spec Data not loaded renders component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +

    spec Data not loaded renders component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -49,7 +53,11 @@ exports[` spec Data not loaded renders component 1`] = ` viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/Overview/containers/__tests__/__snapshots__/AnomalyDetectionOverview.test.tsx.snap b/public/pages/Overview/containers/__tests__/__snapshots__/AnomalyDetectionOverview.test.tsx.snap index 26092ab6..1cdefe53 100644 --- a/public/pages/Overview/containers/__tests__/__snapshots__/AnomalyDetectionOverview.test.tsx.snap +++ b/public/pages/Overview/containers/__tests__/__snapshots__/AnomalyDetectionOverview.test.tsx.snap @@ -62,7 +62,11 @@ exports[` spec No sample detectors created renders c viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -165,7 +169,11 @@ exports[` spec No sample detectors created renders c viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -227,7 +235,11 @@ exports[` spec No sample detectors created renders c viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -289,7 +301,11 @@ exports[` spec No sample detectors created renders c viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -351,7 +367,11 @@ exports[` spec No sample detectors created renders c viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -452,7 +472,11 @@ exports[` spec No sample detectors created renders c viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +

    spec No sample detectors created renders c viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +

    spec No sample detectors created renders c viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +

    + > + + @@ -305,7 +309,11 @@ exports[`ModelConfigurationFields renders the component in create mode (no ID) 1 viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -360,7 +368,11 @@ exports[`ModelConfigurationFields renders the component in create mode (no ID) 1 viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + diff --git a/public/pages/ReviewAndCreate/containers/__tests__/__snapshots__/ReviewAndCreate.test.tsx.snap b/public/pages/ReviewAndCreate/containers/__tests__/__snapshots__/ReviewAndCreate.test.tsx.snap index ece4b589..7f09ec44 100644 --- a/public/pages/ReviewAndCreate/containers/__tests__/__snapshots__/ReviewAndCreate.test.tsx.snap +++ b/public/pages/ReviewAndCreate/containers/__tests__/__snapshots__/ReviewAndCreate.test.tsx.snap @@ -713,7 +713,11 @@ exports[` spec renders the component, validation loading 1`] viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + @@ -768,7 +772,11 @@ exports[` spec renders the component, validation loading 1`] viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + From 8258d5cd01595380eb82b8dbf4329c6a0dc60c82 Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Wed, 14 Feb 2024 14:36:00 -0800 Subject: [PATCH 2/6] add snpshot Signed-off-by: Jackie Han --- .../__tests__/__snapshots__/ListActions.test.tsx.snap | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/pages/DetectorsList/components/ListActions/__tests__/__snapshots__/ListActions.test.tsx.snap b/public/pages/DetectorsList/components/ListActions/__tests__/__snapshots__/ListActions.test.tsx.snap index 959774fa..180cdf14 100644 --- a/public/pages/DetectorsList/components/ListActions/__tests__/__snapshots__/ListActions.test.tsx.snap +++ b/public/pages/DetectorsList/components/ListActions/__tests__/__snapshots__/ListActions.test.tsx.snap @@ -33,7 +33,11 @@ exports[` spec List actions renders component when disabled 1`] = viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + + From e0333ec08151636fdbcee7ad44b9f5eb1ceae4a7 Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Thu, 4 Apr 2024 15:36:41 -0700 Subject: [PATCH 3/6] neo List Detectors page Signed-off-by: Jackie Han --- public/anomaly_detection_app.tsx | 17 ++++- public/models/interfaces.ts | 1 + .../DetectorsList/containers/List/List.tsx | 67 +++++++++++++++++-- public/pages/main/Main.tsx | 19 +++++- public/pages/utils/helpers.ts | 20 +++++- public/plugin.ts | 11 ++- public/services.ts | 4 ++ server/models/types.ts | 1 + server/plugin.ts | 31 ++++++--- server/routes/ad.ts | 45 +++++++------ server/utils/helpers.ts | 24 +++++++ 11 files changed, 198 insertions(+), 42 deletions(-) diff --git a/public/anomaly_detection_app.tsx b/public/anomaly_detection_app.tsx index dfbc4591..87b11cfb 100644 --- a/public/anomaly_detection_app.tsx +++ b/public/anomaly_detection_app.tsx @@ -17,8 +17,15 @@ import { Main } from './pages/main'; import { Provider } from 'react-redux'; import configureStore from './redux/configureStore'; import { CoreServicesContext } from './components/CoreServices/CoreServices'; +import { DataSourceManagementPluginSetup } from '../../../src/plugins/data_source_management/public'; +import { DataSourcePluginSetup } from '../../../src/plugins/data_source/public'; -export function renderApp(coreStart: CoreStart, params: AppMountParameters) { +export function renderApp( + coreStart: CoreStart, + params: AppMountParameters, + dataSourceManagement: DataSourceManagementPluginSetup, + dataSource: DataSourcePluginSetup +) { const http = coreStart.http; const store = configureStore(http); @@ -29,13 +36,19 @@ export function renderApp(coreStart: CoreStart, params: AppMountParameters) { } else { require('@elastic/charts/dist/theme_only_light.css'); } + ReactDOM.render( ( -
    +
    )} /> diff --git a/public/models/interfaces.ts b/public/models/interfaces.ts index eff5ead5..ecce16ef 100644 --- a/public/models/interfaces.ts +++ b/public/models/interfaces.ts @@ -218,6 +218,7 @@ export type DetectorListItem = { lastUpdateTime: number; enabledTime?: number; detectorType?: string; + dataSourceId: string; }; export type EntityData = { diff --git a/public/pages/DetectorsList/containers/List/List.tsx b/public/pages/DetectorsList/containers/List/List.tsx index 864f9951..ab37fc94 100644 --- a/public/pages/DetectorsList/containers/List/List.tsx +++ b/public/pages/DetectorsList/containers/List/List.tsx @@ -20,7 +20,7 @@ import { } from '@elastic/eui'; import { debounce, get, isEmpty } from 'lodash'; import queryString from 'querystring'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { RouteComponentProps } from 'react-router'; import { @@ -44,13 +44,16 @@ import { } from '../../../../redux/reducers/opensearch'; import { APP_PATH, PLUGIN_NAME } from '../../../../utils/constants'; import { DETECTOR_STATE } from '../../../../../server/utils/constants'; -import { getVisibleOptions, sanitizeSearchText } from '../../../utils/helpers'; +import { + getAllDetectorsQueryParamsWithDataSourceId, + getVisibleOptions, + sanitizeSearchText, +} from '../../../utils/helpers'; import { EmptyDetectorMessage } from '../../components/EmptyMessage/EmptyMessage'; import { ListFilters } from '../../components/ListFilters/ListFilters'; import { MAX_DETECTORS, MAX_SELECTED_INDICES, - GET_ALL_DETECTORS_QUERY_PARAMS, ALL_DETECTOR_STATES, ALL_INDICES, SINGLE_DETECTOR_NOT_FOUND_MSG, @@ -78,8 +81,13 @@ import { NO_PERMISSIONS_KEY_WORD, prettifyErrorMessage, } from '../../../../../server/utils/helpers'; -import { CoreStart } from '../../../../../../../src/core/public'; +import { CoreStart, MountPoint } from '../../../../../../../src/core/public'; import { CoreServicesContext } from '../../../../components/CoreServices/CoreServices'; +import { + DataSourceManagementPluginSetup, + DataSourceSelectableConfig, +} from '../../../../../../../src/plugins/data_source_management/public'; +import { getNotifications, getSavedObjectsClient } from '../../../../services'; export interface ListRouterParams { from: string; @@ -88,13 +96,19 @@ export interface ListRouterParams { indices: string; sortDirection: SORT_DIRECTION; sortField: string; + dataSourceId: string; +} +interface ListProps extends RouteComponentProps { + dataSourceEnabled: boolean; + dataSourceManagement: DataSourceManagementPluginSetup; + setActionMenu: (menuMount: MountPoint | undefined) => void; } -interface ListProps extends RouteComponentProps {} interface ListState { page: number; queryParams: GetDetectorsQueryParams; selectedDetectorStates: DETECTOR_STATE[]; selectedIndices: string[]; + selectedDataSourceId: string; } interface ConfirmModalState { isOpen: boolean; @@ -198,6 +212,9 @@ export const DetectorList = (props: ListProps) => { selectedIndices: queryParams.indices ? queryParams.indices.split(',') : ALL_INDICES, + selectedDataSourceId: queryParams.dataSourceId + ? queryParams.dataSourceId + : '', }); // Set breadcrumbs on page initialization @@ -215,6 +232,7 @@ export const DetectorList = (props: ListProps) => { ...state.queryParams, indices: state.selectedIndices.join(','), from: state.page * state.queryParams.size, + dataSourceId: state.selectedDataSourceId, }; history.replace({ @@ -229,6 +247,7 @@ export const DetectorList = (props: ListProps) => { state.queryParams, state.selectedDetectorStates, state.selectedIndices, + state.selectedDataSourceId, ]); // Handle all filtering / sorting of detectors @@ -246,7 +265,8 @@ export const DetectorList = (props: ListProps) => { const curDetectorsToDisplay = getDetectorsToDisplay( curSelectedDetectors, state.page, - state.queryParams.size + state.queryParams.size, + state.selectedDataSourceId ); setDetectorsToDisplay(curDetectorsToDisplay); @@ -273,7 +293,11 @@ export const DetectorList = (props: ListProps) => { }, [confirmModalState.isRequestingToClose, isLoading]); const getUpdatedDetectors = async () => { - dispatch(getDetectorList(GET_ALL_DETECTORS_QUERY_PARAMS)); + dispatch( + getDetectorList( + getAllDetectorsQueryParamsWithDataSourceId(state.selectedDataSourceId) + ) + ); }; const handlePageChange = (pageNumber: number) => { @@ -552,6 +576,16 @@ export const DetectorList = (props: ListProps) => { }); }; + const handleDataSourceChange = (e) => { + const dataConnectionId = e[0] ? e[0].id : undefined; + + setState({ + ...state, + page: 0, + selectedDataSourceId: dataConnectionId, + }); + }; + const getConfirmModal = () => { if (confirmModalState.isOpen) { //@ts-ignore @@ -626,9 +660,28 @@ export const DetectorList = (props: ListProps) => { const confirmModal = getConfirmModal(); + const DataSourceMenu = + props.dataSourceManagement.ui.getDataSourceMenu(); + const renderDataSourceComponent = useMemo(() => { + return ( + + handleDataSourceChange(dataSources), + }} + /> + ); + }, [getSavedObjectsClient(), getNotifications(), props.setActionMenu]); + return ( + {props.dataSourceEnabled && renderDataSourceComponent} void; +} export function Main(props: MainProps) { + const { dataSourceEnabled, dataSourceManagement, setHeaderActionMenu } = + props; + const hideSideNavBar = useSelector( (state: AppState) => state.adApp.hideSideNavBar ); @@ -83,7 +91,12 @@ export function Main(props: MainProps) { exact path={APP_PATH.LIST_DETECTORS} render={(props: RouteComponentProps) => ( - + )} /> { + detectors.forEach((detector) => { + detector.dataSourceId = dataSourceId; + }); return detectors.slice(size * page, page * size + size); }; @@ -112,3 +116,15 @@ export const formatNumber = (data: any) => { return ''; } }; + +export const getAllDetectorsQueryParamsWithDataSourceId = ( + dataSourceId: string +) => ({ + from: 0, + search: '', + indices: '', + size: MAX_DETECTORS, + sortDirection: SORT_DIRECTION.ASC, + sortField: 'name', + dataSourceId: dataSourceId, +}); diff --git a/public/plugin.ts b/public/plugin.ts index 25ea0ebf..97fc1eaa 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -35,6 +35,7 @@ import { setUiActions, setUISettings, setQueryService, + setSavedObjectsClient, } from './services'; import { AnomalyDetectionOpenSearchDashboardsPluginStart } from 'public'; import { @@ -43,6 +44,7 @@ import { } from '../../../src/plugins/vis_augmenter/public'; import { UiActionsStart } from '../../../src/plugins/ui_actions/public'; import { DataPublicPluginStart } from '../../../src/plugins/data/public'; +import { DataSourceManagementPluginSetup } from '../../../src/plugins/data_source_management/public'; declare module '../../../src/plugins/ui_actions/public' { export interface ActionContextMapping { @@ -55,6 +57,7 @@ export interface AnomalyDetectionSetupDeps { embeddable: EmbeddableSetup; notifications: NotificationsSetup; visAugmenter: VisAugmenterSetup; + dataSourceManagement: DataSourceManagementPluginSetup; //uiActions: UiActionsSetup; } @@ -82,7 +85,12 @@ export class AnomalyDetectionOpenSearchDashboardsPlugin mount: async (params: AppMountParameters) => { const { renderApp } = await import('./anomaly_detection_app'); const [coreStart] = await core.getStartServices(); - return renderApp(coreStart, params); + return renderApp( + coreStart, + params, + plugins.dataSourceManagement, + plugins.dataSource + ); }, }); @@ -116,6 +124,7 @@ export class AnomalyDetectionOpenSearchDashboardsPlugin setNotifications(core.notifications); setUiActions(uiActions); setQueryService(data.query); + setSavedObjectsClient(core.savedObjects.client); return {}; } } diff --git a/public/services.ts b/public/services.ts index ef899307..ec164c14 100644 --- a/public/services.ts +++ b/public/services.ts @@ -39,6 +39,9 @@ export const [getUISettings, setUISettings] = export const [getQueryService, setQueryService] = createGetterSetter('Query'); +export const [getSavedObjectsClient, setSavedObjectsClient] = + createGetterSetter('SavedObjectsClient'); + // This is primarily used for mocking this module and each of its fns in tests. export default { getSavedFeatureAnywhereLoader, @@ -49,4 +52,5 @@ export default { getOverlays, setUISettings, setQueryService, + getSavedObjectsClient, }; diff --git a/server/models/types.ts b/server/models/types.ts index 24fa7bb3..36f6443f 100644 --- a/server/models/types.ts +++ b/server/models/types.ts @@ -89,6 +89,7 @@ export type GetDetectorsQueryParams = { indices?: string; sortDirection: SORT_DIRECTION; sortField: string; + dataSourceId?: string; }; export type GetAdMonitorsQueryParams = { diff --git a/server/plugin.ts b/server/plugin.ts index 88a573cb..8c446e36 100644 --- a/server/plugin.ts +++ b/server/plugin.ts @@ -35,6 +35,13 @@ import SampleDataService, { registerSampleDataRoutes, } from './routes/sampleData'; import { DEFAULT_HEADERS } from './utils/constants'; +import { DataSourcePluginSetup } from '../../../src/plugins/data_source/server/types'; +import { DataSourceManagementPlugin } from '../../../src/plugins/data_source_management/public'; + +export interface ADPluginSetupDependencies { + dataSourceManagement: ReturnType; + dataSource: DataSourcePluginSetup; +} export class AnomalyDetectionOpenSearchDashboardsPlugin implements @@ -50,20 +57,28 @@ export class AnomalyDetectionOpenSearchDashboardsPlugin this.logger = initializerContext.logger.get(); this.globalConfig$ = initializerContext.config.legacy.globalConfig$; } - public async setup(core: CoreSetup) { + public async setup( + core: CoreSetup, + { dataSource }: ADPluginSetupDependencies + ) { // Get any custom/overridden headers const globalConfig = await this.globalConfig$.pipe(first()).toPromise(); const { customHeaders, ...rest } = globalConfig.opensearch; - // Create OpenSearch client w/ relevant plugins and headers - const client: ILegacyClusterClient = core.opensearch.legacy.createClient( - 'anomaly_detection', - { + const dataSourceEnabled = !!dataSource; + + let client: ILegacyClusterClient | undefined = undefined; + + if (!dataSourceEnabled) { + client = core.opensearch.legacy.createClient('anomaly_detection', { plugins: [adPlugin, alertingPlugin], customHeaders: { ...customHeaders, ...DEFAULT_HEADERS }, ...rest, - } - ); + }); + } else { + dataSource.registerCustomApiSchema(adPlugin); + dataSource.registerCustomApiSchema(alertingPlugin); + } // Create router const apiRouter: Router = createRouter( @@ -72,7 +87,7 @@ export class AnomalyDetectionOpenSearchDashboardsPlugin ); // Create services & register with OpenSearch client - const adService = new AdService(client); + const adService = new AdService(client, dataSourceEnabled); const alertingService = new AlertingService(client); const opensearchService = new OpenSearchService(client); const sampleDataService = new SampleDataService(client); diff --git a/server/routes/ad.ts b/server/routes/ad.ts index 4c9eb54e..9b5968dd 100644 --- a/server/routes/ad.ts +++ b/server/routes/ad.ts @@ -24,6 +24,7 @@ import { CUSTOM_AD_RESULT_INDEX_PREFIX, } from '../utils/constants'; import { + getClientBasedOnDataSource, mapKeysDeep, toCamel, toFixedNumberForAnomaly, @@ -103,9 +104,11 @@ export function registerADRoutes(apiRouter: Router, adService: AdService) { export default class AdService { private client: any; + dataSourceEnabled: boolean; - constructor(client: any) { + constructor(client: any, dataSourceEnabled: boolean) { this.client = client; + this.dataSourceEnabled = dataSourceEnabled; } deleteDetector = async ( @@ -579,6 +582,7 @@ export default class AdService { indices = '', sortDirection = SORT_DIRECTION.DESC, sortField = 'name', + dataSourceId = '', } = request.query as GetDetectorsQueryParams; const mustQueries = []; if (search.trim()) { @@ -621,10 +625,16 @@ export default class AdService { }, }, }; - const response: any = await this.client - .asScoped(request) - .callAsCurrentUser('ad.searchDetector', { body: requestBody }); - + const callWithRequest = getClientBasedOnDataSource( + context, + this.dataSourceEnabled, + request, + dataSourceId, + this.client + ); + const response = await callWithRequest('ad.searchDetector', { + body: requestBody, + }); const totalDetectors = get(response, 'hits.total.value', 0); //Get all detectors from search detector API @@ -655,9 +665,9 @@ export default class AdService { resultIndex: CUSTOM_AD_RESULT_INDEX_PREFIX + '*', onlyQueryCustomResultIndex: 'false', } as {}; - const aggregationResult = await this.client - .asScoped(request) - .callAsCurrentUser('ad.searchResultsFromCustomResultIndex', { + const aggregationResult = await callWithRequest( + 'ad.searchResultsFromCustomResultIndex', + { ...requestParams, body: getResultAggregationQuery(allDetectorIds, { from, @@ -667,7 +677,8 @@ export default class AdService { search, indices, }), - }); + } + ); const aggsDetectors = get( aggregationResult, 'aggregations.unique_detectors.buckets', @@ -720,16 +731,12 @@ export default class AdService { let realtimeTasksResponse = {} as any; let historicalTasksResponse = {} as any; try { - realtimeTasksResponse = await this.client - .asScoped(request) - .callAsCurrentUser('ad.searchTasks', { - body: getLatestDetectorTasksQuery(true), - }); - historicalTasksResponse = await this.client - .asScoped(request) - .callAsCurrentUser('ad.searchTasks', { - body: getLatestDetectorTasksQuery(false), - }); + realtimeTasksResponse = await callWithRequest('ad.searchTasks', { + body: getLatestDetectorTasksQuery(true), + }); + historicalTasksResponse = await callWithRequest('ad.searchTasks', { + body: getLatestDetectorTasksQuery(false), + }); } catch (err) { if (!isIndexNotFoundError(err)) { throw err; diff --git a/server/utils/helpers.ts b/server/utils/helpers.ts index 15c80b3e..6233a007 100644 --- a/server/utils/helpers.ts +++ b/server/utils/helpers.ts @@ -20,6 +20,10 @@ import { } from 'lodash'; import { MIN_IN_MILLI_SECS } from './constants'; +import { + LegacyCallAPIOptions, + OpenSearchDashboardsRequest, +} from '../../../../src/core/server'; export const SHOW_DECIMAL_NUMBER_THRESHOLD = 0.01; @@ -81,3 +85,23 @@ export const prettifyErrorMessage = (rawErrorMessage: string) => { return `User ${match[2]} has no permissions to [${match[1]}].`; } }; + +export function getClientBasedOnDataSource( + context: any, + dataSourceEnabled: boolean, + request: OpenSearchDashboardsRequest, + dataSourceId: string, + client: any +): ( + endpoint: string, + clientParams?: Record, + options?: LegacyCallAPIOptions +) => any { + if (dataSourceEnabled && dataSourceId && dataSourceId.trim().length != 0) { + // client for remote cluster + return context.dataSource.opensearch.legacy.getClient(dataSourceId).callAPI; + } else { + // fall back to default local cluster + return client.asScoped(request).callAsCurrentUser; + } +} From 8a94a9b027c2ad32b3a089a3899e04e25157577d Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Thu, 4 Apr 2024 17:55:47 -0700 Subject: [PATCH 4/6] add opensearch_dashboards.json file Signed-off-by: Jackie Han --- opensearch_dashboards.json | 1 + 1 file changed, 1 insertion(+) diff --git a/opensearch_dashboards.json b/opensearch_dashboards.json index 72a48458..c62acf46 100644 --- a/opensearch_dashboards.json +++ b/opensearch_dashboards.json @@ -5,6 +5,7 @@ "configPath": [ "anomaly_detection_dashboards" ], + "optionalPlugins": ["dataSource","dataSourceManagement"], "requiredPlugins": [ "opensearchDashboardsUtils", "expressions", From fdc863699e2efa88fe4172a45acab5e7d90cd9c4 Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Mon, 8 Apr 2024 11:43:58 -0700 Subject: [PATCH 5/6] add error toast when data source id is undefined Signed-off-by: Jackie Han --- .../DetectorsList/containers/List/List.tsx | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/public/pages/DetectorsList/containers/List/List.tsx b/public/pages/DetectorsList/containers/List/List.tsx index ab37fc94..288ae727 100644 --- a/public/pages/DetectorsList/containers/List/List.tsx +++ b/public/pages/DetectorsList/containers/List/List.tsx @@ -576,14 +576,20 @@ export const DetectorList = (props: ListProps) => { }); }; - const handleDataSourceChange = (e) => { - const dataConnectionId = e[0] ? e[0].id : undefined; - - setState({ - ...state, - page: 0, - selectedDataSourceId: dataConnectionId, - }); + const handleDataSourceChange = ([selectedDataSource]) => { + const dataSourceId = selectedDataSource?.id; + + if (!dataSourceId) { + core.notifications.toasts.addDanger( + prettifyErrorMessage('Unable to set data source.') + ); + } else { + setState((prevState) => ({ + ...prevState, + page: 0, + selectedDataSourceId: dataSourceId, + })); + } }; const getConfirmModal = () => { From 44723e7267ffccd002fac57a12abb217763cc6f0 Mon Sep 17 00:00:00 2001 From: Jackie Han Date: Mon, 8 Apr 2024 11:47:54 -0700 Subject: [PATCH 6/6] make data source related plugins as optional dependencies Signed-off-by: Jackie Han --- server/plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/plugin.ts b/server/plugin.ts index 8c446e36..32b4cee5 100644 --- a/server/plugin.ts +++ b/server/plugin.ts @@ -39,8 +39,8 @@ import { DataSourcePluginSetup } from '../../../src/plugins/data_source/server/t import { DataSourceManagementPlugin } from '../../../src/plugins/data_source_management/public'; export interface ADPluginSetupDependencies { - dataSourceManagement: ReturnType; - dataSource: DataSourcePluginSetup; + dataSourceManagement?: ReturnType; + dataSource?: DataSourcePluginSetup; } export class AnomalyDetectionOpenSearchDashboardsPlugin