kibana/x-pack/plugins/lens/public/trigger_actions/visualize_field_actions.ts
Alexey Antonov e2c6a039f6
lens should register expression functions in setup contract (#110639)
* lens should register expression functions in setup contract

Closes: #106510

* fix CI

* build optimization

* build optimizations - step 3

* fix CI

* try to optimize bundle

* Update x-pack/plugins/lens/common/expressions/time_scale/types.ts

Co-authored-by: Marta Bondyra <marta.bondyra@gmail.com>

* Update types.ts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marta Bondyra <marta.bondyra@gmail.com>
2021-09-07 10:32:30 +03:00

31 lines
1.1 KiB
TypeScript

/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { i18n } from '@kbn/i18n';
import {
createAction,
ACTION_VISUALIZE_LENS_FIELD,
VisualizeFieldContext,
} from '../../../../../src/plugins/ui_actions/public';
import type { ApplicationStart } from '../../../../../src/core/public';
export const visualizeFieldAction = (application: ApplicationStart) =>
createAction<VisualizeFieldContext>({
type: ACTION_VISUALIZE_LENS_FIELD,
id: ACTION_VISUALIZE_LENS_FIELD,
getDisplayName: () =>
i18n.translate('xpack.lens.discover.visualizeFieldLegend', {
defaultMessage: 'Visualize field',
}),
isCompatible: async () => !!application.capabilities.visualize.show,
execute: async (context: VisualizeFieldContext) => {
application.navigateToApp('lens', {
state: { type: ACTION_VISUALIZE_LENS_FIELD, payload: context },
});
},
});