Skip to content
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

[Roles] Fix bug with roles grid not sorting on clicking table header #194196

Merged
merged 7 commits into from
Sep 27, 2024

Conversation

SiddharthMantri
Copy link
Contributor

@SiddharthMantri SiddharthMantri commented Sep 26, 2024

Fixes #193786

Summary

Reverts a few changes made when the Roles grid page was moved to a functional component. Fixes regression in table sorting.

Notes

When preparing for the Query Roles API, we had moved the roles grid page to be a functional component. In doing so, we also migrated away from the In Memory table in favor of the basic table. EUIBasicTable does not support sorting out of the box and is meant to be used for server-side sorting, etc (unless we implement custom sorting logic). I've made a few changes:

  • Bring back the InMemoryTable but keep the Search Bar.
  • Remove few (now) unused functions which are to be brought back whenever the Query Roles API is ready.
  • Update tests

Screen recording

Screen.Recording.2024-09-27.at.00.00.17.mov

Release notes

Fixes UI regression in Roles listing page where users could not sort table by using the headers.

@SiddharthMantri SiddharthMantri added bug Fixes for quality problems that affect the customer experience regression Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! Feature:Users/Roles/API Keys labels Sep 26, 2024
@SiddharthMantri SiddharthMantri marked this pull request as ready for review September 26, 2024 21:58
@SiddharthMantri SiddharthMantri requested a review from a team as a code owner September 26, 2024 21:58
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@SiddharthMantri
Copy link
Contributor Author

@elasticmachine merge upstream

@SiddharthMantri SiddharthMantri added backport:prev-major Backport to (8.x, 8.17, 8.16) the previous major branch and other branches in development release_note:fix labels Sep 26, 2024
Copy link
Contributor

@jeramysoucy jeramysoucy left a comment

Choose a reason for hiding this comment

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

LGTM! Just some suggestions on the unit tests.

I tested in stateful and serverless with custom roles enabled. I found it interesting that the default sort puts lowercase after uppercase. Not shocking, but not what I would expect. Nothing we're doing, but maybe worth pinging EUI to see if this is the intended sort order.

Screenshot 2024-09-27 at 9 19 06 AM

base: [],
spaces: [],
feature: {},
expect(wrapper.find(EuiBasicTable).props().items).toEqual(
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that you switched to expect.arrayContaining rather than matching an explicit array. Shouldn't these be looking for an EuiInMemoryTable now? If the EUI type is updated, it seems you can switch back to matching explicit values.

Suggested change
expect(wrapper.find(EuiBasicTable).props().items).toEqual(
expect(wrapper.find(EuiInMemoryTable).props().items).toEqual(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test originally used EuiBasicTable even before I switched in this PR. I think we can switch to EuiInMemoryTable and then bring back basic table whenever the server side API is ready.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in: 2775e0c

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: should we consider adding a test that confirms the rows can be sorted by each of the columns?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in 2775e0c

@SiddharthMantri
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #74 / console app text input console history can restore and execute a request from history

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
security 591.1KB 590.8KB -314.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@SiddharthMantri SiddharthMantri merged commit f4ca9e4 into elastic:main Sep 27, 2024
21 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.15, 8.x

https://github.com/elastic/kibana/actions/runs/11069406268

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 27, 2024
…lastic#194196)

Fixes elastic#193786

## Summary
Reverts a few changes made when the Roles grid page was moved to a
functional component. Fixes regression in table sorting.

### Notes

When preparing for the Query Roles API, we had moved the roles grid page
to be a functional component. In doing so, we also migrated away from
the In Memory table in favor of the basic table. EUIBasicTable does not
support sorting out of the box and is meant to be used for server-side
sorting, etc (unless we implement custom sorting logic). I've made a few
changes:
-  Bring back the InMemoryTable but keep the Search Bar.
- Remove few (now) unused functions which are to be brought back
whenever the Query Roles API is ready.
- Update tests

### Screen recording

https://github.com/user-attachments/assets/4ac4f771-e7d1-4e17-807e-d6262767d100

### Release notes
Fixes UI regression in Roles listing page where users could not sort
table by using the headers.

---------

Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit f4ca9e4)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 27, 2024
…lastic#194196)

Fixes elastic#193786

## Summary
Reverts a few changes made when the Roles grid page was moved to a
functional component. Fixes regression in table sorting.

### Notes

When preparing for the Query Roles API, we had moved the roles grid page
to be a functional component. In doing so, we also migrated away from
the In Memory table in favor of the basic table. EUIBasicTable does not
support sorting out of the box and is meant to be used for server-side
sorting, etc (unless we implement custom sorting logic). I've made a few
changes:
-  Bring back the InMemoryTable but keep the Search Bar.
- Remove few (now) unused functions which are to be brought back
whenever the Query Roles API is ready.
- Update tests

### Screen recording

https://github.com/user-attachments/assets/4ac4f771-e7d1-4e17-807e-d6262767d100

### Release notes
Fixes UI regression in Roles listing page where users could not sort
table by using the headers.

---------

Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit f4ca9e4)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.15
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Sep 27, 2024
…header (#194196) (#194282)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[Roles] Fix bug with roles grid not sorting on clicking table header
(#194196)](#194196)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Sid","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-27T10:59:28Z","message":"[Roles]
Fix bug with roles grid not sorting on clicking table header
(#194196)\n\nFixes
https://github.com/elastic/kibana/issues/193786\r\n\r\n##
Summary\r\nReverts a few changes made when the Roles grid page was moved
to a\r\nfunctional component. Fixes regression in table
sorting.\r\n\r\n### Notes\r\n\r\nWhen preparing for the Query Roles API,
we had moved the roles grid page\r\nto be a functional component. In
doing so, we also migrated away from\r\nthe In Memory table in favor of
the basic table. EUIBasicTable does not\r\nsupport sorting out of the
box and is meant to be used for server-side\r\nsorting, etc (unless we
implement custom sorting logic). I've made a few\r\nchanges:\r\n- Bring
back the InMemoryTable but keep the Search Bar.\r\n- Remove few (now)
unused functions which are to be brought back\r\nwhenever the Query
Roles API is ready.\r\n- Update tests\r\n\r\n### Screen
recording\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4ac4f771-e7d1-4e17-807e-d6262767d100\r\n\r\n\r\n\r\n###
Release notes\r\nFixes UI regression in Roles listing page where users
could not sort\r\ntable by using the
headers.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"f4ca9e4730ee6b13d19808be9fcc633dce9087d5","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","regression","release_note:fix","Team:Security","Feature:Users/Roles/API
Keys","v9.0.0","backport:prev-major"],"title":"[Roles] Fix bug with
roles grid not sorting on clicking table
header","number":194196,"url":"https://github.com/elastic/kibana/pull/194196","mergeCommit":{"message":"[Roles]
Fix bug with roles grid not sorting on clicking table header
(#194196)\n\nFixes
https://github.com/elastic/kibana/issues/193786\r\n\r\n##
Summary\r\nReverts a few changes made when the Roles grid page was moved
to a\r\nfunctional component. Fixes regression in table
sorting.\r\n\r\n### Notes\r\n\r\nWhen preparing for the Query Roles API,
we had moved the roles grid page\r\nto be a functional component. In
doing so, we also migrated away from\r\nthe In Memory table in favor of
the basic table. EUIBasicTable does not\r\nsupport sorting out of the
box and is meant to be used for server-side\r\nsorting, etc (unless we
implement custom sorting logic). I've made a few\r\nchanges:\r\n- Bring
back the InMemoryTable but keep the Search Bar.\r\n- Remove few (now)
unused functions which are to be brought back\r\nwhenever the Query
Roles API is ready.\r\n- Update tests\r\n\r\n### Screen
recording\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4ac4f771-e7d1-4e17-807e-d6262767d100\r\n\r\n\r\n\r\n###
Release notes\r\nFixes UI regression in Roles listing page where users
could not sort\r\ntable by using the
headers.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"f4ca9e4730ee6b13d19808be9fcc633dce9087d5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194196","number":194196,"mergeCommit":{"message":"[Roles]
Fix bug with roles grid not sorting on clicking table header
(#194196)\n\nFixes
https://github.com/elastic/kibana/issues/193786\r\n\r\n##
Summary\r\nReverts a few changes made when the Roles grid page was moved
to a\r\nfunctional component. Fixes regression in table
sorting.\r\n\r\n### Notes\r\n\r\nWhen preparing for the Query Roles API,
we had moved the roles grid page\r\nto be a functional component. In
doing so, we also migrated away from\r\nthe In Memory table in favor of
the basic table. EUIBasicTable does not\r\nsupport sorting out of the
box and is meant to be used for server-side\r\nsorting, etc (unless we
implement custom sorting logic). I've made a few\r\nchanges:\r\n- Bring
back the InMemoryTable but keep the Search Bar.\r\n- Remove few (now)
unused functions which are to be brought back\r\nwhenever the Query
Roles API is ready.\r\n- Update tests\r\n\r\n### Screen
recording\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4ac4f771-e7d1-4e17-807e-d6262767d100\r\n\r\n\r\n\r\n###
Release notes\r\nFixes UI regression in Roles listing page where users
could not sort\r\ntable by using the
headers.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"f4ca9e4730ee6b13d19808be9fcc633dce9087d5"}}]}]
BACKPORT-->

Co-authored-by: Sid <[email protected]>
kibanamachine added a commit that referenced this pull request Sep 27, 2024
…eader (#194196) (#194283)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Roles] Fix bug with roles grid not sorting on clicking table header
(#194196)](#194196)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Sid","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-27T10:59:28Z","message":"[Roles]
Fix bug with roles grid not sorting on clicking table header
(#194196)\n\nFixes
https://github.com/elastic/kibana/issues/193786\r\n\r\n##
Summary\r\nReverts a few changes made when the Roles grid page was moved
to a\r\nfunctional component. Fixes regression in table
sorting.\r\n\r\n### Notes\r\n\r\nWhen preparing for the Query Roles API,
we had moved the roles grid page\r\nto be a functional component. In
doing so, we also migrated away from\r\nthe In Memory table in favor of
the basic table. EUIBasicTable does not\r\nsupport sorting out of the
box and is meant to be used for server-side\r\nsorting, etc (unless we
implement custom sorting logic). I've made a few\r\nchanges:\r\n- Bring
back the InMemoryTable but keep the Search Bar.\r\n- Remove few (now)
unused functions which are to be brought back\r\nwhenever the Query
Roles API is ready.\r\n- Update tests\r\n\r\n### Screen
recording\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4ac4f771-e7d1-4e17-807e-d6262767d100\r\n\r\n\r\n\r\n###
Release notes\r\nFixes UI regression in Roles listing page where users
could not sort\r\ntable by using the
headers.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"f4ca9e4730ee6b13d19808be9fcc633dce9087d5","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","regression","release_note:fix","Team:Security","Feature:Users/Roles/API
Keys","v9.0.0","backport:prev-major"],"title":"[Roles] Fix bug with
roles grid not sorting on clicking table
header","number":194196,"url":"https://github.com/elastic/kibana/pull/194196","mergeCommit":{"message":"[Roles]
Fix bug with roles grid not sorting on clicking table header
(#194196)\n\nFixes
https://github.com/elastic/kibana/issues/193786\r\n\r\n##
Summary\r\nReverts a few changes made when the Roles grid page was moved
to a\r\nfunctional component. Fixes regression in table
sorting.\r\n\r\n### Notes\r\n\r\nWhen preparing for the Query Roles API,
we had moved the roles grid page\r\nto be a functional component. In
doing so, we also migrated away from\r\nthe In Memory table in favor of
the basic table. EUIBasicTable does not\r\nsupport sorting out of the
box and is meant to be used for server-side\r\nsorting, etc (unless we
implement custom sorting logic). I've made a few\r\nchanges:\r\n- Bring
back the InMemoryTable but keep the Search Bar.\r\n- Remove few (now)
unused functions which are to be brought back\r\nwhenever the Query
Roles API is ready.\r\n- Update tests\r\n\r\n### Screen
recording\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4ac4f771-e7d1-4e17-807e-d6262767d100\r\n\r\n\r\n\r\n###
Release notes\r\nFixes UI regression in Roles listing page where users
could not sort\r\ntable by using the
headers.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"f4ca9e4730ee6b13d19808be9fcc633dce9087d5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194196","number":194196,"mergeCommit":{"message":"[Roles]
Fix bug with roles grid not sorting on clicking table header
(#194196)\n\nFixes
https://github.com/elastic/kibana/issues/193786\r\n\r\n##
Summary\r\nReverts a few changes made when the Roles grid page was moved
to a\r\nfunctional component. Fixes regression in table
sorting.\r\n\r\n### Notes\r\n\r\nWhen preparing for the Query Roles API,
we had moved the roles grid page\r\nto be a functional component. In
doing so, we also migrated away from\r\nthe In Memory table in favor of
the basic table. EUIBasicTable does not\r\nsupport sorting out of the
box and is meant to be used for server-side\r\nsorting, etc (unless we
implement custom sorting logic). I've made a few\r\nchanges:\r\n- Bring
back the InMemoryTable but keep the Search Bar.\r\n- Remove few (now)
unused functions which are to be brought back\r\nwhenever the Query
Roles API is ready.\r\n- Update tests\r\n\r\n### Screen
recording\r\n\r\n\r\nhttps://github.com/user-attachments/assets/4ac4f771-e7d1-4e17-807e-d6262767d100\r\n\r\n\r\n\r\n###
Release notes\r\nFixes UI regression in Roles listing page where users
could not sort\r\ntable by using the
headers.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"f4ca9e4730ee6b13d19808be9fcc633dce9087d5"}}]}]
BACKPORT-->

Co-authored-by: Sid <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-major Backport to (8.x, 8.17, 8.16) the previous major branch and other branches in development bug Fixes for quality problems that affect the customer experience Feature:Users/Roles/API Keys regression release_note:fix Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v8.15.3 v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Roles table does not sort
5 participants