diff --git a/src/plugins/vis_augmenter/public/utils/utils.ts b/src/plugins/vis_augmenter/public/utils/utils.ts index ef643d87c21e..77aa14a204c8 100644 --- a/src/plugins/vis_augmenter/public/utils/utils.ts +++ b/src/plugins/vis_augmenter/public/utils/utils.ts @@ -23,7 +23,7 @@ import { PLUGIN_AUGMENTATION_ENABLE_SETTING } from '../../common/constants'; import { getUISettings } from '../services'; import { IUiSettingsClient } from '../../../../core/public'; -export const isEligibleForVisLayers = (vis: Vis): boolean => { +export const isEligibleForVisLayers = (vis: Vis, uiSettingsClient?: IUiSettingsClient): boolean => { // Only support date histogram and ensure there is only 1 x-axis and it has to be on the bottom. // Additionally to have a valid x-axis, there needs to be a segment aggregation const hasValidXaxis = @@ -45,8 +45,9 @@ export const isEligibleForVisLayers = (vis: Vis): boolean => { (seriesParam: { type: string }) => seriesParam.type === 'line' ) && vis.params?.type === 'line'; + // Checks if the augmentation setting is enabled - const config = getUISettings(); + const config = uiSettingsClient ?? getUISettings(); const isAugmentationEnabled = config.get(PLUGIN_AUGMENTATION_ENABLE_SETTING); return isAugmentationEnabled && hasValidXaxis && hasCorrectAggregationCount && hasOnlyLineSeries; }; diff --git a/src/plugins/vis_augmenter/public/view_events_flyout/actions/view_events_option_action.tsx b/src/plugins/vis_augmenter/public/view_events_flyout/actions/view_events_option_action.tsx index bb8774306d47..6410e8a13634 100644 --- a/src/plugins/vis_augmenter/public/view_events_flyout/actions/view_events_option_action.tsx +++ b/src/plugins/vis_augmenter/public/view_events_flyout/actions/view_events_option_action.tsx @@ -20,6 +20,16 @@ export class ViewEventsOptionAction implements Action { public readonly id = VIEW_EVENTS_OPTION_ACTION; public order = 1; + public grouping: Action['grouping'] = [ + { + id: VIEW_EVENTS_OPTION_ACTION, + getDisplayName: this.getDisplayName, + getIconType: this.getIconType, + category: 'vis_augmenter', + order: 10, + }, + ]; + constructor() {} public getIconType(): EuiIconType { diff --git a/src/plugins/vis_augmenter/public/view_events_flyout/components/utils.tsx b/src/plugins/vis_augmenter/public/view_events_flyout/components/utils.tsx index 7e1c8900d64b..aa07c497fcad 100644 --- a/src/plugins/vis_augmenter/public/view_events_flyout/components/utils.tsx +++ b/src/plugins/vis_augmenter/public/view_events_flyout/components/utils.tsx @@ -4,7 +4,7 @@ */ import { get } from 'lodash'; -import { ErrorEmbeddable } from '../../../../embeddable/public'; +import { EmbeddableStart, ErrorEmbeddable } from '../../../../embeddable/public'; import { VisualizeEmbeddable, VisualizeInput } from '../../../../visualizations/public'; import { getEmbeddable, getQueryService } from '../../services'; import { @@ -47,9 +47,14 @@ function getValueAxisPositions(embeddable: VisualizeEmbeddable): { left: boolean * Fetching the base vis to show in the flyout, based on the saved object ID. Add constraints * such that it is static and won't auto-refresh within the flyout. * @param savedObjectId the saved object id of the base vis + * @param embeddableStart Optional EmbeddableStart passed in for plugins to utilize the function */ -export async function fetchVisEmbeddable(savedObjectId: string): Promise { - const embeddableVisFactory = getEmbeddable().getEmbeddableFactory('visualization'); +export async function fetchVisEmbeddable( + savedObjectId: string, + embeddableStart?: EmbeddableStart +): Promise { + const embeddableLoader = embeddableStart ?? getEmbeddable(); + const embeddableVisFactory = embeddableLoader.getEmbeddableFactory('visualization'); const contextInput = { filters: getQueryService().filterManager.getFilters(), query: getQueryService().queryString.getQuery(),