Skip to content

fix(pki): disable the policy selector with a message that no policies are available#5284

Merged
saifsmailbox98 merged 1 commit intomainfrom
saif/pki-105-fix-dropdown-so-that-it-shows-proper-message-when-no
Jan 27, 2026
Merged

fix(pki): disable the policy selector with a message that no policies are available#5284
saifsmailbox98 merged 1 commit intomainfrom
saif/pki-105-fix-dropdown-so-that-it-shows-proper-message-when-no

Conversation

@saifsmailbox98
Copy link
Contributor

Context

Disabled the policy selector with a message that no policies are available

Screenshots

Screenshot 2026-01-27 at 9 22 01 PM

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

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 27, 2026

Greptile Overview

Greptile Summary

This PR improves the user experience in the Certificate Profile creation modal by disabling the certificate policy selector when no policies are available and displaying a helpful message "No certificate policies available" instead of the generic placeholder.

Changes made:

  • Modified the placeholder prop to conditionally show "No certificate policies available" when certificatePolicies.length === 0
  • Added certificatePolicies.length === 0 to the isDisabled condition alongside the existing isEdit check

Issue identified:
The form validation schema still requires certificatePolicyId to be non-empty (line 55), creating a situation where users can open the modal but cannot submit the form when no policies exist. Consider preventing modal access entirely when no policies are available, or showing a more prominent warning message explaining that certificate profiles cannot be created without policies.

Confidence Score: 4/5

  • This PR is safe to merge with minor UX concerns
  • The change improves user experience by providing clear feedback when no certificate policies are available. However, there's a logical gap where users can still open the modal but cannot submit the form due to validation requirements, which could be confusing. The implementation is sound but would benefit from handling the no-policies scenario at a higher level (e.g., disabling the "Create Profile" button when no policies exist).
  • No files require special attention - the change is localized and straightforward

Important Files Changed

Filename Overview
frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx Improved UX by disabling certificate policy selector when no policies exist and displaying an informative placeholder message

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.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 27, 2026

Additional Comments (1)

frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx
The schema requires certificatePolicyId with .min(1) validation, but the UI now allows the form to render when certificatePolicies.length === 0. Users won't be able to submit the form (it'll fail validation), but they can open the modal and see a disabled field. Consider either:

  1. Preventing the "Create Profile" action entirely when no policies exist (at the button/trigger level)
  2. Making the field optional in the schema when no policies are available and showing a clear error message

This prevents a confusing user experience where the form appears but cannot be submitted.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@maidul98
Copy link
Collaborator

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.

@saifsmailbox98
Copy link
Contributor Author

Additional Comments (1)
frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CreateProfileModal.tsx The schema requires certificatePolicyId with .min(1) validation, but the UI now allows the form to render when certificatePolicies.length === 0. Users won't be able to submit the form (it'll fail validation), but they can open the modal and see a disabled field. Consider either:

  1. Preventing the "Create Profile" action entirely when no policies exist (at the button/trigger level)
  2. Making the field optional in the schema when no policies are available and showing a clear error message

This prevents a confusing user experience where the form appears but cannot be submitted.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This shouldn't matter. They won't be able to submit the form and that's the intended behavior. Once we add the option to create policies in-line, the user will have a way to keep moving forward even if there's no policy available.

@saifsmailbox98 saifsmailbox98 merged commit 4fb67a1 into main Jan 27, 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