Skip to content

Commit

Permalink
add async cc joshuali
Browse files Browse the repository at this point in the history
Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla committed Nov 22, 2024
1 parent 65a2659 commit d8d59b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/plugins/vis_augmenter/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
setUiActions,
setEmbeddable,
setQueryService,
setIndexPatterns,
setVisualizations,
setCore,
} from './services';
Expand Down Expand Up @@ -62,6 +63,7 @@ export class VisAugmenterPlugin
setUiActions(uiActions);
setEmbeddable(embeddable);
setQueryService(data.query);
setIndexPatterns(data.indexPatterns);
setVisualizations(visualizations);
setCore(core);
setFlyoutState(VIEW_EVENTS_FLYOUT_STATE.CLOSED);
Expand Down
7 changes: 5 additions & 2 deletions src/plugins/vis_augmenter/public/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import { PLUGIN_AUGMENTATION_ENABLE_SETTING } from '../../common/constants';
import { getUISettings, getIndexPatterns } from '../services';
import { IUiSettingsClient } from '../../../../core/public';

export const isEligibleForVisLayers = (vis: Vis, uiSettingsClient?: IUiSettingsClient): boolean => {
export const isEligibleForVisLayers = async (
vis: Vis,
uiSettingsClient?: IUiSettingsClient
): Promise<boolean> => {
// Only support a date histogram
const dateHistograms = vis.data?.aggs?.byTypeName?.('date_histogram');
if (!Array.isArray(dateHistograms) || dateHistograms.length !== 1) return false;
Expand Down Expand Up @@ -55,7 +58,7 @@ export const isEligibleForVisLayers = (vis: Vis, uiSettingsClient?: IUiSettingsC
return false;

// Check if the vis datasource is eligible for the augmentation
if (!isEligibleForDataSource(vis)) return false;
if (!(await isEligibleForDataSource(vis))) return false;

// Checks if the augmentation setting is enabled
const config = uiSettingsClient ?? getUISettings();
Expand Down

0 comments on commit d8d59b9

Please sign in to comment.