2020-10-06 10:15:41 +02:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2021-02-04 03:12:39 +01:00
|
|
|
* 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.
|
2020-10-06 10:15:41 +02:00
|
|
|
*/
|
2021-02-04 03:12:39 +01:00
|
|
|
|
2020-10-06 10:15:41 +02:00
|
|
|
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) =>
|
2021-01-05 10:11:05 +01:00
|
|
|
createAction<VisualizeFieldContext>({
|
2020-10-06 10:15:41 +02:00
|
|
|
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 },
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|