Skip to content

Commit

Permalink
enable embeddable for useVega
Browse files Browse the repository at this point in the history
Signed-off-by: Anan Zhuang <[email protected]>
  • Loading branch information
ananzh committed Jul 22, 2024
1 parent f2ac5cf commit e695b45
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ import {
getIndexPatterns,
getTypeService,
getUIActions,
getUISettings,
} from '../plugin_services';
import { PersistedState, prepareJson } from '../../../visualizations/public';
import { VisBuilderSavedVis } from '../saved_visualizations/transforms';
import { handleVisEvent } from '../application/utils/handle_vis_event';
import { VisBuilderEmbeddableFactoryDeps } from './vis_builder_embeddable_factory';
import { VISBUILDER_ENABLE_VEGA_SETTING } from '../../common/constants';

// Apparently this needs to match the saved object type for the clone and replace panel actions to work
export const VISBUILDER_EMBEDDABLE = VISBUILDER_SAVED_OBJECT;
Expand Down Expand Up @@ -150,11 +152,16 @@ export class VisBuilderEmbeddable extends Embeddable<VisBuilderInput, VisBuilder

if (!valid && errorMsg) throw new Error(errorMsg);

const exp = await toExpression(renderState, {
filters: this.filters,
query: this.query,
timeRange: this.timeRange,
});
const useVega = getUISettings().get(VISBUILDER_ENABLE_VEGA_SETTING);
const exp = await toExpression(
renderState,
{
filters: this.filters,
query: this.query,
timeRange: this.timeRange,
},
useVega
);
return exp;
} catch (error) {
this.onContainerError(error as Error);
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/vis_builder/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { IOsdUrlStateStorage } from '../../opensearch_dashboards_utils/public';
import { DataPublicPluginSetup } from '../../data/public';
import { UiActionsStart } from '../../ui_actions/public';
import { Capabilities } from '../../../core/public';
import { IUiSettingsClient } from '../../../core/public';

export type VisBuilderSetup = TypeServiceSetup;
export interface VisBuilderStart extends TypeServiceStart {
Expand All @@ -38,6 +39,7 @@ export interface VisBuilderPluginStartDependencies {
dashboard: DashboardStart;
expressions: ExpressionsStart;
uiActions: UiActionsStart;
uiSettings: IUiSettingsClient;
}

export interface VisBuilderServices extends CoreStart {
Expand Down

0 comments on commit e695b45

Please sign in to comment.