-
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.
[ES|QL] Enables the addition of columns from the doc viewer (#171083)
## Summary From our user sessions we found out that many users on the ES|QL mode they are adding columns to the Document view from the Document viewer but the ES|QL mode is missing this functionality. This PR enables this action. We haven't decided what we are going to do with filtering yet so I disable all the filtering related actions. <img width="1886" alt="image" src="https://github.com/elastic/kibana/assets/17003240/61f93e53-c1e4-4581-bc89-41c8422ef4f3"> ### Checklist - [ ] [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
- Loading branch information
Showing
8 changed files
with
88 additions
and
17 deletions.
There are no files selected for viewing
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
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
61 changes: 61 additions & 0 deletions
61
...plugins/unified_doc_viewer/public/components/doc_viewer_table/table_cell_actions.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,61 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { TableActions } from './table_cell_actions'; | ||
import { DataViewField } from '@kbn/data-views-plugin/common'; | ||
|
||
describe('TableActions', () => { | ||
it('should render the panels correctly for undefined onFilter function', () => { | ||
render( | ||
<TableActions | ||
mode="inline" | ||
field="message" | ||
pinned={false} | ||
fieldMapping={undefined} | ||
flattenedField="message" | ||
onFilter={undefined} | ||
onToggleColumn={jest.fn()} | ||
ignoredValue={false} | ||
onTogglePinned={jest.fn()} | ||
/> | ||
); | ||
expect(screen.getByTestId('addFilterForValueButton-message')).toBeDisabled(); | ||
expect(screen.getByTestId('addFilterOutValueButton-message')).toBeDisabled(); | ||
expect(screen.getByTestId('addExistsFilterButton-message')).toBeDisabled(); | ||
expect(screen.getByTestId('toggleColumnButton-message')).not.toBeDisabled(); | ||
expect(screen.getByTestId('togglePinFilterButton-message')).not.toBeDisabled(); | ||
}); | ||
|
||
it('should render the panels correctly for defined onFilter function', () => { | ||
render( | ||
<TableActions | ||
mode="inline" | ||
field="message" | ||
pinned={false} | ||
fieldMapping={ | ||
{ | ||
name: 'message', | ||
type: 'string', | ||
filterable: true, | ||
} as DataViewField | ||
} | ||
flattenedField="message" | ||
onFilter={jest.fn()} | ||
onToggleColumn={jest.fn()} | ||
ignoredValue={false} | ||
onTogglePinned={jest.fn()} | ||
/> | ||
); | ||
expect(screen.getByTestId('addFilterForValueButton-message')).not.toBeDisabled(); | ||
expect(screen.getByTestId('addFilterOutValueButton-message')).not.toBeDisabled(); | ||
expect(screen.getByTestId('addExistsFilterButton-message')).not.toBeDisabled(); | ||
expect(screen.getByTestId('toggleColumnButton-message')).not.toBeDisabled(); | ||
expect(screen.getByTestId('togglePinFilterButton-message')).not.toBeDisabled(); | ||
}); | ||
}); |
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