kibana/x-pack/plugins/lens/public/trigger_actions/visualize_field_actions.ts
Stratoula Kalafateli 08a4586b14
[Lens] Navigate from discover to lens (#77873)
* Create lens action and unregister the visualize one

* remove console

* Implement Discover to Lens, wip, missing tests

* Add unit tests

* fix embed lens to empty dashboard functional tests

* fix suggestions on save

* Fix bug on save button, query and filters should be transferred from discover

* Add functional test for the navigation from Discover to Lens

* PR update after code review

* unregister visualize action only if the action exists

* Change the test to not be flaky

* Move suggestions to editor frame and hide the emptyWorkspace for visualize field

* Update ui actions docs

* Add a retry to remove test flakiness

* Fix bug of infinite loader when removing the y axis dimension

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-10-06 11:15:41 +03: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<typeof ACTION_VISUALIZE_LENS_FIELD>({
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 },
});
},
});