diff --git a/x-pack/plugins/lens/public/datasources/value_based/text_based_languages.tsx b/x-pack/plugins/lens/public/datasources/value_based/text_based_languages.tsx index fc2be85b2c80f94..12bda489201ad13 100644 --- a/x-pack/plugins/lens/public/datasources/value_based/text_based_languages.tsx +++ b/x-pack/plugins/lens/public/datasources/value_based/text_based_languages.tsx @@ -23,9 +23,9 @@ import { UserMessage, } from '../../types'; import type { - ValueBasedPrivateState, - ValueBasedPersistedState, - ValueBasedLayerColumn, + ValueBasedPrivateState, + ValueBasedPersistedState, + ValueBasedLayerColumn, } from './types'; import type { Datasource } from '../../types'; import { getUniqueLabelGenerator, nonNullable } from '../../utils'; @@ -55,7 +55,6 @@ export function getValueBasedDatasource({ expressions: ExpressionsStart; dataViews: DataViewsPublicPluginStart; }) { - const ValueBasedDatasource: Datasource = { id: 'valueBased', @@ -90,12 +89,7 @@ export function getValueBasedDatasource({ return message; }); }, - initialize( - state?: ValueBasedPersistedState, - savedObjectReferences?, - context?, - ) { - + initialize(state?: ValueBasedPersistedState, savedObjectReferences?, context?) { const initState = state || { layers: {} }; return { ...initState, @@ -169,7 +163,6 @@ export function getValueBasedDatasource({ }, isTimeBased: (state, indexPatterns) => { return false; - }, getUsedDataView: (state: ValueBasedPrivateState, layerId?: string) => { return ''; @@ -268,8 +261,8 @@ export function getValueBasedDatasource({ getDatasourceSuggestionsForVisualizeField: () => { return []; }, - getDatasourceSuggestionsFromCurrentState: () => ([]), - getDatasourceSuggestionsForVisualizeCharts: () => ([]), + getDatasourceSuggestionsFromCurrentState: () => [], + getDatasourceSuggestionsForVisualizeCharts: () => [], isEqual: ( persistableState1: ValueBasedPersistedState, references1: SavedObjectReference[], diff --git a/x-pack/plugins/lens/public/datasources/value_based/to_expression.ts b/x-pack/plugins/lens/public/datasources/value_based/to_expression.ts index 5d32e471662190f..4a2c16602b10767 100644 --- a/x-pack/plugins/lens/public/datasources/value_based/to_expression.ts +++ b/x-pack/plugins/lens/public/datasources/value_based/to_expression.ts @@ -44,13 +44,14 @@ function getExpressionForLayer(layer: ValueBasedLayer, layerId: string): Ast | n arguments: { name: [layerId], }, - },{ + }, + { type: 'function', function: 'lens_map_to_columns', arguments: { idMap: [JSON.stringify(idMapper)], }, - } + }, ], }; } diff --git a/x-pack/plugins/lens/public/embeddable/embeddable.tsx b/x-pack/plugins/lens/public/embeddable/embeddable.tsx index 733edf376e40f08..f22d2e2d1e99469 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable.tsx @@ -39,7 +39,7 @@ import { DefaultInspectorAdapters, ErrorLike, ExpressionValue, - RenderMode + RenderMode, } from '@kbn/expressions-plugin/common'; import { map, distinctUntilChanged, skip, debounceTime } from 'rxjs/operators'; import fastIsEqual from 'fast-deep-equal'; @@ -85,6 +85,7 @@ import { import { DataViewSpec } from '@kbn/data-views-plugin/common'; import { FormattedMessage, I18nProvider } from '@kbn/i18n-react'; import { useEuiFontSize, useEuiTheme, EuiEmptyPrompt } from '@elastic/eui'; +import { ValueBasedPersistedState } from '../datasources/value_based/types'; import { getExecutionContextEvents, trackUiCounterEvents } from '../lens_ui_telemetry'; import { Document } from '../persistence'; import { ExpressionWrapper, ExpressionWrapperProps } from './expression_wrapper'; @@ -142,7 +143,6 @@ import type { LensPluginStartDependencies } from '../plugin'; import { EmbeddableFeatureBadge } from './embeddable_info_badges'; import { getDatasourceLayers } from '../state_management/utils'; import type { EditLensConfigurationProps } from '../app_plugin/shared/edit_on_the_fly/get_edit_lens_configuration'; -import {ValueBasedPersistedState} from "@kbn/lens-plugin/public/datasources/value_based/types"; export type LensSavedObjectAttributes = Omit; @@ -1078,14 +1078,14 @@ export class Embeddable const getInternalTables = (states: Record) => { const result: Record = {}; - const layers = (states['valueBased'] as ValueBasedPersistedState).layers; + const layers = (states.valueBased as ValueBasedPersistedState).layers; if ('valueBased' in states) { - for (let layer in layers) { + for (const layer in layers) { result[layer] = layers[layer].table; } } return result; - } + }; if (this.expression && !blockingErrors.length) { render( @@ -1100,7 +1100,7 @@ export class Embeddable embeddableTitle: this.getTitle(), ...(input.palette ? { theme: { palette: input.palette } } : {}), ...('overrides' in input ? { overrides: input.overrides } : {}), - ...getInternalTables(this.savedVis.state.datasourceStates) + ...getInternalTables(this.savedVis.state.datasourceStates), }} searchSessionId={this.getInput().searchSessionId} handleEvent={this.handleEvent} diff --git a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx index 839f42577632ce2..e38133fa8e5e94a 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable_component.tsx @@ -20,6 +20,7 @@ import { IEmbeddable, useEmbeddableFactory, } from '@kbn/embeddable-plugin/public'; +import { ValueBasedPersistedState } from '../datasources/value_based/types'; import type { LensByReferenceInput, LensByValueInput } from './embeddable'; import type { Document } from '../persistence'; import type { FormBasedPersistedState } from '../datasources/form_based/types'; @@ -37,7 +38,6 @@ import type { DatatableVisualizationState } from '../visualizations/datatable/vi import type { MetricVisualizationState } from '../visualizations/metric/types'; import type { HeatmapVisualizationState } from '../visualizations/heatmap/types'; import type { GaugeVisualizationState } from '../visualizations/gauge/constants'; -import {ValueBasedPersistedState} from "@kbn/lens-plugin/public/datasources/value_based/types"; type LensAttributes = Omit< Document,