Skip to content

Conversation

@mareklibra
Copy link
Member

Fixes: FLPATH-3032

Hey, I just made a Pull Request!

Adding paginatoin to the GET /projects
Adding privileges checks to the

  • GET /projects
  • GET /projects/:id
  • DELETE /projects/:id

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

  • A changeset describing the change and affected packages. (more info)
  • Added or Updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)

@mareklibra mareklibra marked this pull request as draft January 26, 2026 13:46
@mareklibra mareklibra force-pushed the FLPATH-3032.projectsEndpoint branch from 8c42f16 to facbc7f Compare January 26, 2026 13:47
@rhdh-gh-app
Copy link

rhdh-gh-app bot commented Jan 26, 2026

Unexpected Changesets

The following changeset(s) reference packages that have not been changed in this PR:

  • /home/runner/work/rhdh-plugins/rhdh-plugins/workspaces/x2a/.changeset/proud-months-smash.md: @red-hat-developer-hub/backstage-plugin-x2a

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

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-x2a-backend workspaces/x2a/plugins/x2a-backend patch v0.1.0
@red-hat-developer-hub/backstage-plugin-x2a-common workspaces/x2a/plugins/x2a-common patch v0.1.0

@mareklibra mareklibra force-pushed the FLPATH-3032.projectsEndpoint branch 2 times, most recently from facbc7f to 8cafda6 Compare January 26, 2026 13:54
@sonarqubecloud
Copy link

@mareklibra mareklibra marked this pull request as ready for review January 26, 2026 13:57
Copy link

@elai-shalev elai-shalev left a 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.

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.

Copy link
Member Author

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

Comment on lines +24 to +29
export const x2aAdminViewPermission = createPermission({
name: 'x2a.admin',
attributes: {
action: 'read',
},
});

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?

Copy link
Member Author

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.

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.

2 participants