Skip to content

feat/tables default ordering#2019

Open
alanpeixinho wants to merge 1 commit into
kernelci:mainfrom
profusion:feat/tables-default-ordering
Open

feat/tables default ordering#2019
alanpeixinho wants to merge 1 commit into
kernelci:mainfrom
profusion:feat/tables-default-ordering

Conversation

@alanpeixinho

Copy link
Copy Markdown
Contributor

What it is

  • Hardware sorting no longer clears to an unsorted state, so Platform stays asc or desc.
  • TableHeader now uses TanStack’s getToggleSortingHandler(), so table sorting options (including enableSortingRemoval) are respected everywhere.
  • Removes redundant page-level sorts on hardware and tree listing; trees still use pinned-first ordering when unsorted.

How to test

Hardware

  • Go to /hardware page
  • Platform shows asc order; rows using asc order by platform.
  • Click Platform
  • Platform shows desc order; rows using desc order by platform.
  • Click Platform
  • Platform shows again asc (not unsorted).
  • Click another column (e.g. Builds) → sorts; cycle asc/desc/clear as usual.

Trees

  • Go to /tree page
  • Unsorted keeps pinned trees first (mainline/master, next/master, stable/*);
  • Click Tree
  • Column sort overrides; clear restores pinned-first.

Closes #2004

* Make the hardware table start sorted by platform and keep that column
active via enableSortingRemoval.
* Use TanStack's toggle handler in TableHeader so sorting options are respected, and drop redundant
page-level sorts.

Closes kernelci#2004

Signed-off-by: Alan Peixinho <alan.peixinho@profusion.mobi>
@alanpeixinho
alanpeixinho force-pushed the feat/tables-default-ordering branch from ca3cc0f to cbf026b Compare July 22, 2026 17:40

@mentonin mentonin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks great. I wonder if you can add the changes to our other sortable tables as well?
Builds/Boots/Tests/Tests(grouped) tables under /tree/mainline/<tree_name>/<git_branch>/<git_commit_hash>, /hardware/<platform_id>, /build/<build_id>, /issue/<issue_id>, are the ones I can recall

treeTableRows: T[],
): T[] => {
return treeTableRows.sort((a, b) => {
return [...treeTableRows].sort((a, b) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have to spread it if it is already an array (as per treeTableRows: T[] on old line 89)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might have been overzealous here. It was mostly because javascript sort in done inplace, and I wanted to avoid side effects here.

Comment on lines -407 to -409
const data = useMemo(() => {
return treeTableRows;
}, [treeTableRows]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... 😅

@alanpeixinho

Copy link
Copy Markdown
Contributor Author

This PR looks great. I wonder if you can add the changes to our other sortable tables as well? Builds/Boots/Tests/Tests(grouped) tables under /tree/mainline/<tree_name>/<git_branch>/<git_commit_hash>, /hardware/<platform_id>, /build/<build_id>, /issue/<issue_id>, are the ones I can recall

Yeah, I considered changing all tables available.
The point with this is, those other tables are not being (right now) sorted on the frontend, and we are using the order provided on the backend.

Do you consider a good approach to just sort all of them by their some column (by default) as well?

@mentonin

Copy link
Copy Markdown
Contributor

Do you consider a good approach to just sort all of them by their some column (by default) as well?

I would think so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display default sort on table views

3 participants