-
Notifications
You must be signed in to change notification settings - Fork 88
feat(x2a): pagination and permissions for /projects and /projects/:id #2152
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
base: main
Are you sure you want to change the base?
feat(x2a): pagination and permissions for /projects and /projects/:id #2152
Conversation
8c42f16 to
facbc7f
Compare
Unexpected ChangesetsThe following changeset(s) reference packages that have not been changed in this PR:
Note that only changes that affect the published package require changesets, for example changes to tests and storybook stories do not require changesets. Changed Packages
|
Signed-off-by: Marek Libra <marek.libra@gmail.com>
facbc7f to
8cafda6
Compare
|
elai-shalev
left a comment
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.
overall looks good, some clarifications on pagination
| '@red-hat-developer-hub/backstage-plugin-x2a': patch | ||
| --- | ||
|
|
||
| Adding pagination and filtering by permissions to the GET|POST /projects and GET /project/[id] endpoints. |
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.
Some issues (?) with pagination:
Backend (working correctly):
api returns the correct amount
eshalev x2a (pr-2152) $ curl http://localhost:7007/api/x2a/projects
{
"totalCount": 32,
"items": [
The Frontend is not updated (by design?)
Once you have more that 10 projects,
- no pagination; only one page of 10 projects appear
- wrong count - project count says 10
I see you have " /* TODO: pagination */
" for that, is that for both the actual pagination and the project count?
or is it the "current page count"
Line 95: Shows wrong count:
title={Projects (${projects.length})} // ← Shows 10 instead of total
Should use value?.totalCount from the API 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.
This PR is for BE only.
The FE part follows: #2175
| export const x2aAdminViewPermission = createPermission({ | ||
| name: 'x2a.admin', | ||
| attributes: { | ||
| action: 'read', | ||
| }, | ||
| }); |
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.
is there any way for me to test these permissions? I can only log in as guest, right?
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.
Not externally (curl).
We will need to configure app-config.yaml for that, adding on my TODO list.



Fixes: FLPATH-3032
Hey, I just made a Pull Request!
Adding paginatoin to the GET /projects
Adding privileges checks to the
Implemented on both the DB and router layer.
Depending on the future requirements regarding permission checks flexibility, we might move all checks to the router (plugin) layer but this will be slower and more work around pagination.
✔️ Checklist