-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Text based] Configure Lens suggestion on the fly from Discover (#159559
) ## Summary Part of #158802 This PR removes the navigation from Discover to Lens and renders a push flyout instead. ![textbased](https://github.com/elastic/kibana/assets/17003240/92c6f290-6cf9-4daa-920e-f1409595d765) Next tasks (follow-up PRs): - [ ] Remove the text based support from Lens dataview picker. The FTs should be removed from there and possibly moved to discover FTs - [ ] Apply the same flyout in dashboard for text based panels - [ ] Allow drag and drop between dimensions - [ ] Investigate why the Field select doesnt close when you click outside the dropdown ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Andrea Del Rio <[email protected]>
- Loading branch information
1 parent
90b3e71
commit e8b2303
Showing
43 changed files
with
1,477 additions
and
92 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/plugins/unified_histogram/public/__mocks__/lens_table_adapter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* 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 type { Datatable } from '@kbn/expressions-plugin/common'; | ||
|
||
export const lensTablesAdapterMock: Record<string, Datatable> = { | ||
default: { | ||
columns: [ | ||
{ | ||
id: 'col-0-1', | ||
meta: { | ||
dimensionName: 'Slice size', | ||
type: 'number', | ||
}, | ||
name: 'Field 1', | ||
}, | ||
{ | ||
id: 'col-0-2', | ||
meta: { | ||
dimensionName: 'Slice', | ||
type: 'number', | ||
}, | ||
name: 'Field 2', | ||
}, | ||
], | ||
rows: [ | ||
{ | ||
'col-0-1': 0, | ||
'col-0-2': 0, | ||
'col-0-3': 0, | ||
'col-0-4': 0, | ||
}, | ||
], | ||
type: 'datatable', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/plugins/unified_histogram/public/chart/hooks/use_chart_config_panel.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* 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 type { TypedLensByValueInput } from '@kbn/lens-plugin/public'; | ||
import { renderHook } from '@testing-library/react-hooks'; | ||
import { act } from 'react-test-renderer'; | ||
import { setTimeout } from 'timers/promises'; | ||
import { dataViewWithTimefieldMock } from '../../__mocks__/data_view_with_timefield'; | ||
import { unifiedHistogramServicesMock } from '../../__mocks__/services'; | ||
import { lensTablesAdapterMock } from '../../__mocks__/lens_table_adapter'; | ||
import { useChartConfigPanel } from './use_chart_config_panel'; | ||
import type { LensAttributesContext } from '../utils/get_lens_attributes'; | ||
|
||
describe('useChartConfigPanel', () => { | ||
it('should return a jsx element to edit the visualization', async () => { | ||
const lensAttributes = { | ||
visualizationType: 'lnsXY', | ||
title: 'test', | ||
} as TypedLensByValueInput['attributes']; | ||
const hook = renderHook(() => | ||
useChartConfigPanel({ | ||
services: unifiedHistogramServicesMock, | ||
dataView: dataViewWithTimefieldMock, | ||
lensAttributesContext: { | ||
attributes: lensAttributes, | ||
} as unknown as LensAttributesContext, | ||
isFlyoutVisible: true, | ||
setIsFlyoutVisible: jest.fn(), | ||
isPlainRecord: true, | ||
lensTablesAdapter: lensTablesAdapterMock, | ||
query: { | ||
sql: 'Select * from test', | ||
}, | ||
}) | ||
); | ||
await act(() => setTimeout(0)); | ||
expect(hook.result.current).toBeDefined(); | ||
expect(hook.result.current).not.toBeNull(); | ||
}); | ||
|
||
it('should return null if not in text based mode', async () => { | ||
const lensAttributes = { | ||
visualizationType: 'lnsXY', | ||
title: 'test', | ||
} as TypedLensByValueInput['attributes']; | ||
const hook = renderHook(() => | ||
useChartConfigPanel({ | ||
services: unifiedHistogramServicesMock, | ||
dataView: dataViewWithTimefieldMock, | ||
lensAttributesContext: { | ||
attributes: lensAttributes, | ||
} as unknown as LensAttributesContext, | ||
isFlyoutVisible: true, | ||
setIsFlyoutVisible: jest.fn(), | ||
isPlainRecord: false, | ||
}) | ||
); | ||
await act(() => setTimeout(0)); | ||
expect(hook.result.current).toBeNull(); | ||
}); | ||
}); |
Oops, something went wrong.