Skip to content

improvement(pam): swap resources table to card grid and add favorites#5701

Merged
saifsmailbox98 merged 13 commits intomainfrom
saif/pam-124-pam-125-resource-cards-with-favorites
Mar 17, 2026
Merged

improvement(pam): swap resources table to card grid and add favorites#5701
saifsmailbox98 merged 13 commits intomainfrom
saif/pam-124-pam-125-resource-cards-with-favorites

Conversation

@saifsmailbox98
Copy link
Copy Markdown
Contributor

Context

  1. Swaps PAM resources view from table to card grid
  2. Adds option to favorite PAM resources

Screenshots

CleanShot 2026-03-15 at 06 58 40@2x

Steps to verify the change

Type

  • Fix
  • Feature
  • Improvement
  • Breaking
  • Docs
  • Chore

Checklist

  • Title follows the conventional commit format: type(scope): short description (scope is optional, e.g., fix: prevent crash on sync or fix(api): handle null response).
  • Tested locally
  • Updated docs (if needed)
  • Updated CLAUDE.md files (if needed)
  • Read the contributing guide

@linear
Copy link
Copy Markdown

linear bot commented Mar 15, 2026

@maidul98
Copy link
Copy Markdown
Collaborator

maidul98 commented Mar 15, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 15, 2026

Greptile Summary

This PR replaces the PAM resources table view with a card grid layout and adds the ability to favorite/unfavorite resources. Favorited resources are sorted to the top of the list.

  • New pam_resource_favorites table with a unique constraint on (userId, pamResourceId) and a composite index on (userId, projectId) for efficient lookups. Migration is idempotent.
  • Backend: findByProjectId DAL query gains an optional LEFT JOIN to the favorites table (conditioned on userId) to compute isFavorite and sort favorites first. The countQuery is correctly cloned before the isFavorite SELECT to avoid GROUP BY conflicts. A new PUT /favorites endpoint handles toggling favorite status via upsert/delete.
  • Frontend: The table view (PamResourceRow) is replaced by a responsive 3-column card grid (PamResourceCard). Sorting controls are removed in favor of server-side favorite-first ordering. Optimistic updates with rollback are implemented for the favorite toggle mutation.
  • The internal-certificate-authorities schema change (auto-renewal fields) appears unrelated—likely picked up during schema generation.

Confidence Score: 4/5

  • This PR is safe to merge — no breaking API changes, idempotent migration, proper auth checks, and well-structured code.
  • Score reflects clean implementation with proper security boundaries (JWT auth, permission checks, parameterized queries, unique constraint preventing count inflation). Minor suggestions around permission granularity and validation symmetry are non-blocking style improvements.
  • backend/src/ee/services/pam-resource/pam-resource-service.ts — the setUserResourceFavorite permission check and unfavorite validation path have minor authorization gaps worth reviewing.

Important Files Changed

Filename Overview
backend/src/db/migrations/20260315060701_pam-resource-favorites.ts Idempotent migration creating pam_resource_favorites table with proper foreign keys, unique constraint on (userId, pamResourceId), and composite index.
backend/src/ee/services/pam-resource/pam-resource-dal.ts Adds LEFT JOIN to favorites table for isFavorite flag and ordering. The isFavorite SELECT is correctly placed after the countQuery clone to avoid GROUP BY conflicts. Column references are properly qualified.
backend/src/ee/services/pam-resource/pam-resource-service.ts Adds setUserResourceFavorite method with proper auth checks and resource validation. Passes userId to DAL queries. Uses type assertion helper for isFavorite extraction.
backend/src/ee/routes/v1/pam-resource-routers/pam-resource-router.ts Adds PUT /favorites endpoint with proper schema validation and rate limiting. Response schemas updated to include isFavorite.
frontend/src/hooks/api/pam/mutations.tsx Adds useSetPamResourceFavorite mutation with optimistic UI updates and proper rollback on error.
frontend/src/pages/pam/PamResourcesPage/components/PamResourceCard.tsx New card component replacing the table row. Includes favorite toggle, dropdown menu, and proper event handling with stopPropagation.
frontend/src/pages/pam/PamResourcesPage/components/PamResourcesTable.tsx Refactored from table to grid layout. Removed sorting controls. Added favorite toggle integration. Changed default perPage from 20 to 9 for grid layout.

Last reviewed commit: 812ae59

Validate resource belongs to the claimed project and check conditional
read permissions with subject() on both favorite and unfavorite paths.
@saifsmailbox98 saifsmailbox98 requested a review from x032205 March 15, 2026 01:54
@saifsmailbox98 saifsmailbox98 requested a review from x032205 March 17, 2026 18:49
@saifsmailbox98 saifsmailbox98 merged commit 8933ad5 into main Mar 17, 2026
13 of 14 checks passed
jshimko added a commit to jshimko/infisical that referenced this pull request Mar 19, 2026
* main: (1418 commits)
  Minor UI improvements on code signing
  Update docs/documentation/getting-started/introduction.mdx
  Added what is infisical video to the corresponding docs page
  fix: correct audit log spread ordering to prevent org id being set undefined
  chore: update static IP for US and EU shared cloud
  Doc improvements
  fix: correct operator subset check to be more restrictive and add tests
  fix: specify down length
  improvement(auth): increase azure spid field length
  feat(pam): redis web access, arrow key support (Infisical#5688)
  Address PR comments
  fix: lint issue
  CA Certificate Support for LDAPS
  refactor(api): consolidate deletedSecretKeys population and remove TSyncSecretsResult annotation in AWS PS sync
  refactor(api): remove redundant TSyncSecretsResult return type annotation in AWS SM sync
  fix: replace empty .catch() with logger.error for telemetry event error handling
  improvement: make index creation concurrent
  Reduce Jargon
  improvement(pam): swap resources table to card grid and add favorites (Infisical#5701)
  Show dependencies on resources
  ...

# Conflicts:
#	helm-charts/infisical-standalone-postgres/templates/infisical.yaml
#	helm-charts/infisical-standalone-postgres/values.yaml
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.

3 participants