From 693f579feebd81807a7c8c65c5db9c7c85873352 Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Tue, 24 Jun 2025 16:45:12 -0700 Subject: [PATCH] Restrict Suggest anomaly detector to only show for OpenSearch datasets (#1001) Signed-off-by: Joshua Li (cherry picked from commit 8fe0214dc49ca2b48078ee033ea20bedf5f9173c) --- public/utils/contextMenu/getActions.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/utils/contextMenu/getActions.tsx b/public/utils/contextMenu/getActions.tsx index e0745a17d..f00a113f9 100644 --- a/public/utils/contextMenu/getActions.tsx +++ b/public/utils/contextMenu/getActions.tsx @@ -7,6 +7,7 @@ import React from 'react'; import { i18n } from '@osd/i18n'; import { EuiIconType } from '@elastic/eui'; import { toMountPoint } from '../../../../../src/plugins/opensearch_dashboards_react/public'; +import { DEFAULT_DATA } from '../../../../../src/plugins/data/common'; import { Action, createAction, @@ -121,7 +122,11 @@ export const getSuggestAnomalyDetectorAction = () => { getIconType: () => ANOMALY_DETECTION_ICON, // suggestAD is only compatible with data sources that have certain agents configured isCompatible: async (context) => { - if (context.datasetId) { + if ( + context.datasetId && + (context.datasetType === DEFAULT_DATA.SET_TYPES.INDEX_PATTERN || + context.datasetType === DEFAULT_DATA.SET_TYPES.INDEX) + ) { const assistantClient = getAssistantClient(); const res = await assistantClient.agentConfigExists( SUGGEST_ANOMALY_DETECTOR_CONFIG_ID,