-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Lens] Hide column in table #88680
Merged
+762
−385
Merged
[Lens] Hide column in table #88680
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
e3dcee1
migrate data table visualization to data grid
flash1293 a752f4d
memoize as good as possible
flash1293 84c2a9d
improve visuals
flash1293 60ceeba
Merge remote-tracking branch 'upstream/master' into lens/eui-data-grid
flash1293 234891d
clean up and fix tests
flash1293 f298b4d
:truck: Refactor table codebase in modules
dej611 ffe5fd2
Merge remote-tracking branch 'upstream/master' into lens/eui-data-grid
dej611 c233e3b
:truck: Move table component tests to its own folder
dej611 9318950
:bug: Fix deep check for table column header
dej611 79836ae
:label: Fix type check
dej611 3181b88
:globe_with_meridians: Fix locatization tokens
dej611 16b0d90
:bug: Fix functional tests
dej611 eb72077
:globe_with_meridians: Fix unused translation
dej611 07dc9a0
:camera_flash: Fix snapshot tests
dej611 5c0fecf
Merge branch 'master' into lens/eui-data-grid
kibanamachine 1c9ce68
:white_check_mark: Add more functional tests for Lens table
dej611 38fdf2a
Merge branch 'lens/eui-data-grid' of github.com:dej611/kibana into le…
dej611 acc4f92
:sparkles: Add resize reset + add more unit tests
dej611 bc4f37a
Merge branch 'master' into lens/eui-data-grid
kibanamachine 0637948
:lipstick: Make header sticky
dej611 ceea3cf
Merge branch 'lens/eui-data-grid' of github.com:dej611/kibana into le…
dej611 f6fc9a3
:camera_flash: Updated snapshots for sticky header fix
dej611 f27aafe
Merge branch 'master' into lens/eui-data-grid
kibanamachine 3f02cd7
add column toggle functionality
flash1293 a993045
Merge branch 'master' into lens/eui-data-grid
kibanamachine e4e6761
Merge branch 'master' into lens/hidden-column
kibanamachine 2f39d62
Merge branch 'master' into lens/eui-data-grid
kibanamachine ff69cc7
Merge branch 'master' into lens/eui-data-grid
kibanamachine 07967ed
:lipstick: Some css classes clean up
dej611 0fed673
:lipstick: Make truncate work by the datagrid component
dej611 4eef909
Merge remote-tracking branch 'dej611/lens/eui-data-grid' into lens/hi…
flash1293 5a458d9
Merge branch 'lens/hidden-column' of github.com:flash1293/kibana into…
flash1293 9c6f5cf
Merge branch 'master' into lens/eui-data-grid
kibanamachine 90e810b
refactoring
flash1293 8fc5c07
Merge remote-tracking branch 'dej611/lens/eui-data-grid' into lens/hi…
flash1293 e821ca6
add tests and clean up
flash1293 83e3e85
Merge branch 'master' into lens/eui-data-grid
kibanamachine fc4b39d
Merge remote-tracking branch 'dej611/lens/eui-data-grid' into lens/hi…
flash1293 82d7e9f
fix migrations
flash1293 4e1052f
Merge branch 'master' into lens/eui-data-grid
kibanamachine c7240ab
Merge remote-tracking branch 'dej611/lens/eui-data-grid' into lens/hi…
flash1293 00b7ab6
Merge remote-tracking branch 'upstream/master' into lens/hidden-column
flash1293 a17d9d5
Merge remote-tracking branch 'upstream/master' into lens/hidden-column
flash1293 064794b
fix bug
flash1293 db3ab50
Merge remote-tracking branch 'upstream/master' into lens/hidden-column
flash1293 46ec8ac
Merge remote-tracking branch 'upstream/master' into lens/hidden-column
flash1293 0ec8926
Merge remote-tracking branch 'upstream/master' into lens/hidden-column
flash1293 4ebca5f
move hidden flag to dimension editor
flash1293 b2ba6b9
fix i18n
flash1293 7a4befb
Merge branch 'master' into lens/hidden-column
kibanamachine a193204
review comments
flash1293 dfd4e7d
review comments
flash1293 7847e86
simplify
flash1293 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
...ns/lens/public/datatable_visualization/components/__snapshots__/table_basic.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
x-pack/plugins/lens/public/datatable_visualization/components/dimension_editor.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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiSwitch, EuiFormRow } from '@elastic/eui'; | ||
import { VisualizationDimensionEditorProps } from '../../types'; | ||
import { DatatableVisualizationState } from '../visualization'; | ||
|
||
export function TableDimensionEditor( | ||
props: VisualizationDimensionEditorProps<DatatableVisualizationState> | ||
) { | ||
const { state, setState, accessor } = props; | ||
const column = state.columns.find((c) => c.columnId === accessor); | ||
|
||
const visibleColumnsCount = state.columns.filter((c) => !c.hidden).length; | ||
|
||
if (!column) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<EuiFormRow | ||
label={i18n.translate('xpack.lens.table.columnVisibilityLabel', { | ||
defaultMessage: 'Column hidden in table', | ||
})} | ||
display="columnCompressedSwitch" | ||
> | ||
<EuiSwitch | ||
compressed | ||
label={i18n.translate('xpack.lens.table.columnVisibilityLabel', { | ||
defaultMessage: 'Column hidden in table', | ||
})} | ||
showLabel={false} | ||
data-test-subj="lns-table-column-hidden" | ||
checked={Boolean(column?.hidden)} | ||
disabled={!column.hidden && visibleColumnsCount <= 1} | ||
onChange={() => { | ||
const newState = { | ||
...state, | ||
columns: state.columns.map((currentColumn) => { | ||
if (currentColumn.columnId === accessor) { | ||
return { | ||
...currentColumn, | ||
hidden: !column.hidden, | ||
}; | ||
} else { | ||
return currentColumn; | ||
} | ||
}), | ||
}; | ||
setState(newState); | ||
}} | ||
/> | ||
</EuiFormRow> | ||
); | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this does not update the visibility indicators in the main menu: when I use the
Hide
button from the column menu, not from the visualization menu, I get inconsistent results: