diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/external/saved_map.test.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/external/saved_map.test.ts index 88acf0deabb35..6a5beeeac3464 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/external/saved_map.test.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/external/saved_map.test.ts @@ -6,29 +6,6 @@ */ import { savedMap } from './saved_map'; -import { getQueryFilters } from '../../../common/lib/build_embeddable_filters'; -import { ExpressionValueFilter } from '../../../types'; - -const filterContext: ExpressionValueFilter = { - type: 'filter', - and: [ - { - type: 'filter', - and: [], - value: 'filter-value', - column: 'filter-column', - filterType: 'exactly', - }, - { - type: 'filter', - and: [], - column: 'time-column', - filterType: 'time', - from: '2019-06-04T04:00:00.000Z', - to: '2019-06-05T04:00:00.000Z', - }, - ], -}; describe('savedMap', () => { const fn = savedMap().fn; @@ -43,13 +20,18 @@ describe('savedMap', () => { it('accepts null context', () => { const expression = fn(null, args, {} as any); - expect(expression.input.filters).toEqual([]); - }); - - it('accepts filter context', () => { - const expression = fn(filterContext, args, {} as any); - const embeddableFilters = getQueryFilters(filterContext.and); - - expect(expression.input.filters).toEqual(embeddableFilters); + expect(expression.input).toEqual({ + hiddenLayers: [], + hideFilterActions: true, + id: 'some-id', + isLayerTOCOpen: false, + mapCenter: undefined, + savedObjectId: 'some-id', + timeRange: { + from: 'now-15m', + to: 'now', + }, + title: undefined, + }); }); }); diff --git a/x-pack/plugins/canvas/canvas_plugin_src/functions/external/saved_map.ts b/x-pack/plugins/canvas/canvas_plugin_src/functions/external/saved_map.ts index fd40c8223d44e..41ea76e4905cc 100644 --- a/x-pack/plugins/canvas/canvas_plugin_src/functions/external/saved_map.ts +++ b/x-pack/plugins/canvas/canvas_plugin_src/functions/external/saved_map.ts @@ -8,7 +8,6 @@ import { ExpressionFunctionDefinition } from '@kbn/expressions-plugin/common'; import type { MapSerializedState } from '@kbn/maps-plugin/public'; import { SavedObjectReference } from '@kbn/core/types'; -import { getQueryFilters } from '../../../common/lib/build_embeddable_filters'; import { ExpressionValueFilter, MapCenter, TimeRange as TimeRangeArg } from '../../../types'; import { EmbeddableTypes, @@ -72,30 +71,19 @@ export function savedMap(): ExpressionFunctionDefinition< }, type: EmbeddableExpressionType, fn: (input, args) => { - const filters = input ? input.and : []; - - const center = args.center - ? { - lat: args.center.lat, - lon: args.center.lon, - zoom: args.center.zoom, - } - : undefined; - return { type: EmbeddableExpressionType, input: { id: args.id, - attributes: { title: '' }, savedObjectId: args.id, - filters: getQueryFilters(filters), timeRange: args.timerange || defaultTimeRange, - refreshConfig: { - pause: false, - value: 0, - }, - - mapCenter: center, + mapCenter: args.center + ? { + lat: args.center.lat, + lon: args.center.lon, + zoom: args.center.zoom, + } + : undefined, hideFilterActions: true, title: args.title === null ? undefined : args.title, isLayerTOCOpen: false,