Files
graylog2-server/graylog2-web-interface/test/fixtures/entityListLayoutPreferences.ts
Linus Pahl 0536ea4c1a Ensure that newly introduced columns are displayed by default in entity data tables. (#24165)
* Install `@tanstack/react-table`.

* Implement tanstack table for core functionality of `EntityDataTable`.

* Reimplement sorting.

* Include bulk select column in tanstack table columns.

* Cleanup code

* Further cleanup code

* Create seperate component for `TableRow` again to be able to use `React.memo`.

* Cleanup `onSortChange` handler.

* Create separate hook to create react table object.

* Create separate hook for column definition generation.

* Move `useElementsWidth` hook into separate file.

* Start making use of tanstac table for row selection logic.

* Only create accessor columns for columns which exist as attributes in the entities.

* Fix linter hints

* Maintain column visibility in tanstack table.

* Use row id which does not include row index.

* Improve memorization of table rows. Fix issue where table row did not update after changing column visibility.

* Fixing tests

* Make use of tanstack table for logic related to selected entities.

* Align actions to the right.

* Fix name of `useColumnsWidth` hook.

* Add `indeterminate` prop for `Checkbox` component.

* Simplify bulk select col header.

* Remove errorprone `TableRow` memorization.

* Simplify `renderCell` usage.

* Avoid unnessecary unmounts of cell and header components.

* Extending entity list preferences with ability to hide columns + ordering.

* Adding tests.

* Do not return absent values.

* Improve naming of column related variables.

* Cleanup code

* Use only one array for information about column order and visibility. Before the arrays contained redundant information.

* Get rid of small `TableRow` component.

* Reverting accidental change.

* Restructure column definition creation.

* Migrating to JUnit6, fixing `ObjectMapper`.

* Properly type column definition meta.

* Injecting `MongoCollections` directly.

* Reverting accidental change.

* Fix column renderes for lookup table overview.

* Fixing finder query.

* Fix check if entity is selectable.

* Use stable refernece for `renderActions` functions, to fix tests.

* Fixing sort icon description

* Remove not needed file.

* Fix linter hints

* Cleanup code

* Fix issue with absent actions col.

* Update frontend implementation of user table preferences regarding API changes.

* Revert naming `EntityDataTable` prop `visibleColumns` to `visibleColumnOrder`

* Replace `visibleColumns` array prop in `EntityDataTable` for new `columnPreferences` object.

The `columnPreferences` also include information about hidden columns and custom column width.
With this change newly intorduced columns will be displayed by default.

* Update tests.

* Fixing type.

* Update style guide examples

* Remove no longer needed `BulkSelectHead`.

* Only update user column visibility preference for columns which have been explicitly hidden or shown.

* Fixing merge conflicts.

* Remove not needed file.

---------

Co-authored-by: Dennis Oelkers <dennis@graylog.com>
2025-11-18 10:46:35 +01:00

31 lines
1.2 KiB
TypeScript

/*
* Copyright (C) 2020 Graylog, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*/
import type { TableLayoutPreferences, TableLayoutPreferencesJSON } from 'components/common/EntityDataTable/types';
export const layoutPreferences: TableLayoutPreferences = {
attributes: { title: { status: 'show' }, description: { status: 'show' } },
perPage: 50,
sort: { attributeId: 'title', direction: 'asc' } as const,
};
export const layoutPreferencesJSON: TableLayoutPreferencesJSON = {
attributes: { title: { status: 'show' }, description: { status: 'show' } },
per_page: 50,
sort: { field: 'title', order: 'asc' },
};