From fb3f5900f79eeb60694688a449bf4e8a95891913 Mon Sep 17 00:00:00 2001 From: Amit Galitzky Date: Wed, 28 Jun 2023 15:46:39 -0700 Subject: [PATCH] fixing vis eligibility Signed-off-by: Amit Galitzky --- public/action/ad_dashboard_action.tsx | 4 +++- .../containers/AssociatedDetectors.tsx | 8 +++++++- public/plugin.ts | 6 +----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/public/action/ad_dashboard_action.tsx b/public/action/ad_dashboard_action.tsx index f8bfbb1d..2cde952b 100644 --- a/public/action/ad_dashboard_action.tsx +++ b/public/action/ad_dashboard_action.tsx @@ -16,6 +16,7 @@ import { isReferenceOrValueEmbeddable } from '../../../../src/plugins/embeddable import { EuiIconType } from '@elastic/eui/src/components/icon/icon'; import { VisualizeEmbeddable } from '../../../../src/plugins/visualizations/public'; import { isEligibleForVisLayers } from '../../../../src/plugins/vis_augmenter/public'; +import { getUISettings } from '../services'; export const ACTION_AD = 'ad'; @@ -62,9 +63,10 @@ export const createADAction = ({ const vis = (embeddable as VisualizeEmbeddable).vis; return Boolean( embeddable.parent && + embeddable.getInput()?.viewMode === 'view' && isDashboard(embeddable.parent) && vis !== undefined && - isEligibleForVisLayers(vis) + isEligibleForVisLayers(vis, getUISettings()) ); }, execute: async ({ embeddable }: ActionContext) => { diff --git a/public/components/FeatureAnywhereContextMenu/AssociatedDetectors/containers/AssociatedDetectors.tsx b/public/components/FeatureAnywhereContextMenu/AssociatedDetectors/containers/AssociatedDetectors.tsx index 6421f863..8ab93c76 100644 --- a/public/components/FeatureAnywhereContextMenu/AssociatedDetectors/containers/AssociatedDetectors.tsx +++ b/public/components/FeatureAnywhereContextMenu/AssociatedDetectors/containers/AssociatedDetectors.tsx @@ -281,7 +281,13 @@ function AssociatedDetectors({ embeddable, closeFlyout, setMode }) { }; return (
- +

diff --git a/public/plugin.ts b/public/plugin.ts index 86aeb149..53b9aa9a 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -83,11 +83,7 @@ export class AnomalyDetectionOpenSearchDashboardsPlugin }, }); - // // set embeddable plugin for feature anywhere create flyout - // setEmbeddable(embeddable); - - // // set vis argumenter loader for feature anywhere associated flyout - // setSavedFeatureAnywhereLoader(visAugmenter.savedAugmentVisLoader); + setUISettings(core.uiSettings); // Set the HTTP client so it can be pulled into expression fns to make // direct server-side calls