Skip to content

Commit

Permalink
Fixed bundle size.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuznietsov committed Sep 23, 2022
1 parent 45a165c commit a920eac
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
20 changes: 20 additions & 0 deletions src/plugins/visualizations/public/convert_to_lens/datasource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';

export const getDataViewByIndexPatternId = async (
indexPatternId: string | undefined,
dataViews: DataViewsPublicPluginStart
) => {
try {
return indexPatternId ? await dataViews.get(indexPatternId) : await dataViews.getDefault();
} catch (err) {
return null;
}
};
12 changes: 0 additions & 12 deletions src/plugins/visualizations/public/convert_to_lens/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import type { DataView } from '@kbn/data-views-plugin/common';
import { METRIC_TYPES } from '@kbn/data-plugin/public';
import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import { AggBasedColumn, SchemaConfig, SupportedAggregation } from '../../common';
import { convertBucketToColumns } from '../../common/convert_to_lens/lib/buckets';
import { isSiblingPipeline } from '../../common/convert_to_lens/lib/utils';
Expand Down Expand Up @@ -122,14 +121,3 @@ export const sortColumns = (
};

export const getColumnIds = (columns: AggBasedColumn[]) => columns.map(({ columnId }) => columnId);

export const getDataViewByIndexPatternId = async (
indexPatternId: string | undefined,
dataViews: DataViewsPublicPluginStart
) => {
try {
return indexPatternId ? await dataViews.get(indexPatternId) : await dataViews.getDefault();
} catch (err) {
return null;
}
};
2 changes: 1 addition & 1 deletion src/plugins/visualizations/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ export {
} from './triggers';

export const convertToLensModule = import('./convert_to_lens');
export { getDataViewByIndexPatternId } from './convert_to_lens/utils';
export { getDataViewByIndexPatternId } from './convert_to_lens/datasource';

0 comments on commit a920eac

Please sign in to comment.