-
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.
move hidden flag to dimension editor
- Loading branch information
Showing
5 changed files
with
68 additions
and
79 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
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,57 @@ | ||
/* | ||
* 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 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); | ||
|
||
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', | ||
})} | ||
showLabel={false} | ||
data-test-subj="lns-table-column-hidden" | ||
checked={Boolean(column?.hidden)} | ||
onChange={() => { | ||
const newState = { | ||
...state, | ||
columns: state.columns.map((currentColumn) => { | ||
if (currentColumn.columnId === accessor) { | ||
return { | ||
...currentColumn, | ||
hidden: !column.hidden, | ||
}; | ||
} else { | ||
return currentColumn; | ||
} | ||
}), | ||
}; | ||
setState(newState); | ||
}} | ||
/> | ||
</EuiFormRow> | ||
); | ||
} |
69 changes: 0 additions & 69 deletions
69
x-pack/plugins/lens/public/datatable_visualization/components/toolbar.tsx
This file was deleted.
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
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