Skip to content

Commit

Permalink
Allow queryStart to be passed into fetchVisEmbeddable (#4336)
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Agrawal <[email protected]>
  • Loading branch information
lezzago authored Jun 21, 2023
1 parent 12b6d44 commit 4536bb8
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
VisLayer,
} from '../../types';
import { EventVisEmbeddableItem, EventVisEmbeddablesMap } from './types';
import { QueryStart } from '../../../../data/public';

export function getErrorMessage(errorEmbeddable: ErrorEmbeddable): string {
return errorEmbeddable.error instanceof Error
Expand Down Expand Up @@ -48,17 +49,20 @@ function getValueAxisPositions(embeddable: VisualizeEmbeddable): { left: boolean
* 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
* @param queryServiceLoader Optional QueryStart passed in for plugins to utilize the function
*/
export async function fetchVisEmbeddable(
savedObjectId: string,
embeddableStart?: EmbeddableStart
embeddableStart?: EmbeddableStart,
queryStart?: QueryStart
): Promise<VisualizeEmbeddable> {
const embeddableLoader = embeddableStart ?? getEmbeddable();
const embeddableVisFactory = embeddableLoader.getEmbeddableFactory('visualization');
const queryService = queryStart ?? getQueryService();
const contextInput = {
filters: getQueryService().filterManager.getFilters(),
query: getQueryService().queryString.getQuery(),
timeRange: getQueryService().timefilter.timefilter.getTime(),
filters: queryService.filterManager.getFilters(),
query: queryService.queryString.getQuery(),
timeRange: queryService.timefilter.timefilter.getTime(),
};

const embeddable = (await embeddableVisFactory?.createFromSavedObject(savedObjectId, {
Expand Down

0 comments on commit 4536bb8

Please sign in to comment.