Skip to content

improvement(pki): provide the option of creating policies from the profile creation form#5294

Merged
saifsmailbox98 merged 3 commits intomainfrom
saif/pki-106-create-in-line-creation-flow-for-certificate-policies-when
Jan 28, 2026
Merged

improvement(pki): provide the option of creating policies from the profile creation form#5294
saifsmailbox98 merged 3 commits intomainfrom
saif/pki-106-create-in-line-creation-flow-for-certificate-policies-when

Conversation

@saifsmailbox98
Copy link
Contributor

@saifsmailbox98 saifsmailbox98 commented Jan 28, 2026

Context

Earlier we had to go back to the policies page to create a policy before using it with a profile. Now with this change, we can create a policy from the profile creation modal itself.

Screenshots

CleanShot.2026-01-28.at.20.28.45.mp4

Steps to verify the change

Open the Create Profile modal and try to create a policy from the dropdown option "+ Add Certificate Policy"

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)
  • Read the contributing guide

@maidul98
Copy link
Collaborator

maidul98 commented Jan 28, 2026

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

Status Scanner 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
Contributor

greptile-apps bot commented Jan 28, 2026

Greptile Overview

Greptile Summary

This PR enables creating certificate policies directly from the certificate profile creation modal, improving user workflow by eliminating the need to navigate back to the policies page.

The implementation:

  • Replaced the standard Select component with FilterableSelect for the certificate policy dropdown
  • Added a custom "+ Add Certificate Policy" option that opens the CreatePolicyModal in a nested modal
  • Added permission checks using ProjectPermissionCertificatePolicyActions.Create to conditionally show the create option
  • Implemented an onComplete callback in CreatePolicyModal that returns the created policy and triggers a query refetch to update the dropdown
  • Used setValue with shouldValidate: true to programmatically set the newly created policy in the form

Minor changes also include:

  • Changed form validation mode to "onChange" (validates on every keystroke)
  • Removed acmeConfig from default values in create mode while keeping apiConfig

Confidence Score: 4/5

  • This PR is safe to merge with minor style considerations
  • The implementation is solid with proper permission checks and no security issues. The score is 4 instead of 5 due to minor inconsistencies in default values and validation mode changes that could impact UX
  • No files require special attention - the changes are straightforward UI improvements

Important Files Changed

Filename Overview
frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificatePolicyOption.tsx New custom select option component for certificate policy dropdown, shows "+ Add Certificate Policy" for create option and check icon for selected policies
frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/CreatePolicyModal.tsx Added optional onComplete callback prop that fires after policy creation with the created policy data
frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx Integrated policy creation into profile form - replaced Select with FilterableSelect, added permission checks, and embedded CreatePolicyModal with query refetch on completion

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@saifsmailbox98 saifsmailbox98 merged commit 62c3d30 into main Jan 28, 2026
8 checks passed
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