kibana/x-pack/plugins/lens/public/trigger_actions/visualize_field_actions.ts
Josh Dover 0af81310b6
Remove dynamic mapped types from UiActions (#87075)
* Remove dynamic mapped types from UiActions

* Remove import between data <-> embeddables

* remove outdated comments, export action types from discover_enhanced

* fix notice.txt

Co-authored-by: restrry <restrry@gmail.com>
2021-01-05 10:11:05 +01:00

29 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;
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';
import {
createAction,
ACTION_VISUALIZE_LENS_FIELD,
VisualizeFieldContext,
} from '../../../../../src/plugins/ui_actions/public';
import { 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 },
});
},
});