-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Switch ListRoles to the paginated API
#40165
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0ca44c3
Switch "get roles" endpoint to the paginated version
gzdunek c3b6be5
Use the paginated API in the roles screen
gzdunek 67c55f1
Use the paginated API in the locks screen
gzdunek e603366
Switch select components for roles to an async version
gzdunek 3080f80
Do not break backward compatibility of list roles endpoint
gzdunek fe78e97
Allow the new web UI to handle old response types
gzdunek 00ed28f
Disable pagination buttons in the serverside table when loading data
gzdunek b2d76c4
Add TODO item about rename
gzdunek 0c7daff
Add `UrlListRolesParams`
gzdunek 3363073
Remove pagination config
gzdunek 9a62dab
Remove unused `UrlIntegrationExecuteRequestParams`
gzdunek 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
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
We need to be able to handle requests from an old webclient (in the case of two different proxies running together) which would still expect a response that is only an array of items, rather than this paginated object.
Without having to resort to a larger refactor that can version this endpoint, we can just use the existence of one of these new parameters to determine between old/new clients. For example "if
limitexists, send new response. otherwise, send onlyuiRoles"We did something similar here
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.
Also, make sure the
TODOi left inuseKeyBasedPaginationwould fix this from the frontend side as well please (new webclient being able to handle "old" response types).Uh oh!
There was an error while loading. Please reload this page.
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.
Oh, I completely forgot that we can have proxies running different versions.
I added a check on the parameters to determine what response type should be returned. It's not beautiful but works.
The thing I could do to allow new webclient being able to handle "old" response types, would be to wrap the response in the service layer if I detect that I didn't receive the paginated object. But I'm not sure if it makes any sense, things like
limitorsearchwould not work at all.I don't know how to handle this, to be honest. If I have a server-side table, how can I make it work with both paginated and non-paginated responses?
Maybe instead of modifying the existing endpoint I should add a new one? At least the request would fail with 404 error instead of something like
res.map is not a function.EDIT: I could also throw an error in
resource.tssaying...please update your Teleport Proxy to version ...if I detect a non-paginated response.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.
The worst case scenario is we receive a very large dataset from the "old" api. I don't have any answer for this yet. An upcoming project will be to add a properly versioned API. I don't know exactly how it would work yet for newer web clients receiving 404s but my guess is there would have to be a fallback to a previous version or just accept the 404. I want to discuss this with the team with an RFD once we get the greenlight for the project.
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.
Actually, we can support the "new webclient being able to handle old response types" case too.
I added a compatibility layer in
resource.ts: if we detect that we received a non-paginated response, we can "paginate" it locally, in the browser. I added support forsearch,limitandstartKey.Let me know what you think about this.
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.
i LOVE this. amazing work!!