Skip to content

Controls > OS settings > Certificates: View certificates - #48460

Merged
mostlikelee merged 6 commits into
mainfrom
39346-certificates-list
Jul 8, 2026
Merged

Controls > OS settings > Certificates: View certificates#48460
mostlikelee merged 6 commits into
mainfrom
39346-certificates-list

Conversation

@mostlikelee

@mostlikelee mostlikelee commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Related issue: Resolves #39346

Adds a View certificate modal to Controls > OS settings > Certificates so admins can inspect (and copy) an existing certificate's details. Also adds a "no custom SCEP CA configured" empty state, switches each row to an Actions dropdown (View/Delete), and moves the CA field to the top of the Add form. Frontend-only; no API changes.

Checklist for submitter

  • Changes file added for user-visible changes in changes/.
  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented, JS inline code is prevented, and untrusted data interpolated into shell scripts/commands is validated.

Testing

  • Added/updated automated tests
  • QA'd all new/changed functionality manually

https://claude.ai/code/session_01J77VQSSuPptxpoZDrFQxdj

Summary by CodeRabbit

  • New Features

    • Added a “View certificate” option to inspect certificate details in a modal.
    • Added a new empty state for environments without a custom SCEP certificate authority, with a shortcut to add one.
  • Improvements

    • Certificate actions are now shown in a dropdown, with delete disabled in GitOps mode.
    • Certificate lists now display updated-time information and handle loading or error states more clearly.
    • The add-certificate form now shows the certificate authority field before the name field.

@mostlikelee

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.44%. Comparing base (9a6d575) to head (2fe45e4).
⚠️ Report is 204 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #48460      +/-   ##
==========================================
+ Coverage   67.39%   67.44%   +0.04%     
==========================================
  Files        3676     3699      +23     
  Lines      233631   233853     +222     
  Branches    12298    12354      +56     
==========================================
+ Hits       157463   157712     +249     
+ Misses      62058    62030      -28     
- Partials    14110    14111       +1     
Flag Coverage Δ
frontend 59.29% <100.00%> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1b698932-d563-46e1-8d11-54f3fba522cb

📥 Commits

Reviewing files that changed from the base of the PR and between 270e52c and 2fe45e4.

📒 Files selected for processing (2)
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertAuthorityCard/_styles.scss
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/ViewCertificateModal/_styles.scss
✅ Files skipped from review due to trivial changes (1)
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertAuthorityCard/_styles.scss

Walkthrough

This change adds a "View certificate" modal to the Controls > OS settings > Certificates page, allowing admins to inspect certificate details including subject name and subject alternative name. It introduces an "Add certificate authority" empty-state card shown when no custom SCEP CA is configured. The certificates list now uses an actions dropdown (View/Delete) instead of a standalone delete button, displays "Updated" instead of "Added" timestamps, and reorders the add-certificate form so the CA field precedes the name field. The ICertificate type gains a subject_name field, and corresponding tests and styles were added.

Possibly related PRs

  • fleetdm/fleet#47242: Both PRs modify the AddCertificateModal component's field validation and rendering logic in the same file.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: viewing certificates in OS settings.
Description check ✅ Passed The description includes the related issue, core changes, and testing checklist, matching the repository template well.
Linked Issues check ✅ Passed The PR implements the certificate view modal, no-custom-SCEP-CA empty state, actions dropdown, and add-form CA reorder requested by #39346.
Out of Scope Changes check ✅ Passed The modified files stay focused on the certificates UI and supporting mocks/types, with no clear unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 39346-certificates-list

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/Certificates.tsx`:
- Around line 200-201: The Certificates row label is misleading because the UI
still uses created_at but now says “Updated”. In Certificates.tsx, keep the
existing formatting around formatDistanceToNow(new Date(created_at)) and change
the label back to “Added” unless ICertificate and the API are extended to
provide a real updated_at field. Use the Certificates component and the
created_at display logic to locate the change.
- Around line 163-173: The Certificates page is incorrectly using the CA query
state to block the entire view, which hides already-fetched certificates in the
main flow. Update the logic in Certificates so the CA result only affects the
empty-state path: keep rendering the existing certificate list whenever
certs.length is non-zero, and only consult hasCustomScepCA when there are no
certificates to decide whether to show AddCertAuthorityCard. Preserve the
Spinner and DataError handling for the certificates fetch, but do not let
isLoadingCAs or isErrorCAs replace the full page once certificates are
available.

In
`@frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/ViewCertificateModal/_styles.scss`:
- Around line 13-15: The stylesheet for ViewCertificateModal currently uses a
quoted custom font family in the textarea rule, which violates Stylelint’s
font-family-name-quotes rule. Update the font-family declaration in _styles.scss
to reference SourceCodePro without quotes while keeping the monospace fallback,
and leave the textarea selector and related styling unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5b778472-fe4b-4cc6-8e30-a331530f6e20

📥 Commits

Reviewing files that changed from the base of the PR and between 9a6d575 and d1d83dd.

📒 Files selected for processing (14)
  • frontend/__mocks__/certificatesMock.ts
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/Certificates.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertAuthorityCard/AddCertAuthorityCard.tests.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertAuthorityCard/AddCertAuthorityCard.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertAuthorityCard/_styles.scss
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertAuthorityCard/index.ts
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertificateCard/_styles.scss
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertificateModal/AddCertificateModal.tests.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertificateModal/AddCertificateModal.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/ViewCertificateModal/ViewCertificateModal.tests.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/ViewCertificateModal/ViewCertificateModal.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/ViewCertificateModal/_styles.scss
  • frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/ViewCertificateModal/index.ts
  • frontend/services/entities/certificates.ts

Comment thread frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/Certificates.tsx Outdated
@mostlikelee
mostlikelee marked this pull request as ready for review June 30, 2026 16:52
@mostlikelee
mostlikelee requested a review from a team as a code owner June 30, 2026 16:52
Copilot AI review requested due to automatic review settings June 30, 2026 16:52

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds UI support in Controls → OS settings → Certificates to view an existing certificate’s details in a modal, introduces an empty state when no custom SCEP CA is configured, and updates the certificates list row actions and add-certificate form layout. This fits into the MDM/OS Settings controls UI by improving certificate inspection and related setup flows without changing APIs.

Changes:

  • Added a View certificate modal (with tests) to inspect certificate details (CA, added time, SN, optional SAN).
  • Added a “no custom SCEP CA configured” empty state card that routes admins to Certificate Authorities settings.
  • Switched certificate row actions to an Actions dropdown (View/Delete) and reordered the Add Certificate form to show CA selection first.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/services/entities/certificates.ts Extends ICertificate to include subject_name for display in the view modal.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/Certificates.tsx Adds CA presence check + empty state, Actions dropdown (View/Delete), and view modal wiring.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/ViewCertificateModal/ViewCertificateModal.tsx Implements the certificate details modal UI.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/ViewCertificateModal/ViewCertificateModal.tests.tsx Adds unit tests for view modal rendering and exit behavior.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/ViewCertificateModal/index.ts Barrel export for the view modal component.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/ViewCertificateModal/_styles.scss Styles view modal layout and textarea font.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertificateModal/AddCertificateModal.tsx Reorders fields so CA selection appears above the Name field.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertificateModal/AddCertificateModal.tests.tsx Adds test coverage to enforce the new CA-before-Name layout.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertificateCard/_styles.scss Adjusts empty-state heading font size.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertAuthorityCard/AddCertAuthorityCard.tsx Adds new empty-state card prompting admins to add a certificate authority.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertAuthorityCard/AddCertAuthorityCard.tests.tsx Tests the empty-state copy and routing behavior.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertAuthorityCard/index.ts Barrel export for the CA empty-state card.
frontend/pages/ManageControlsPage/OSSettings/cards/Certificates/components/AddCertAuthorityCard/_styles.scss Styles the CA empty-state card layout.
frontend/mocks/certificatesMock.ts Updates certificate mock data to include subject_name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The CA list query only decides which empty state to show; render the
certificate list whenever certs exist, regardless of CA load/error.

Claude-Session: https://claude.ai/code/session_01J77VQSSuPptxpoZDrFQxdj
@dantecatalfamo

Copy link
Copy Markdown
Member

@mostlikelee Changes file?

@juan-fdz-hawa

Copy link
Copy Markdown
Contributor

The timestamp label should say "Added", right?
Screenshot 2026-07-07 at 10 30 05 AM

@juan-fdz-hawa

Copy link
Copy Markdown
Contributor

While testing this I found two bugs unrelated to your changes but that should be easy fixes, up to you if you want to patch them here or open new tickets:

  1. Overflow on the delete modal:
Screenshot 2026-07-07 at 10 55 57 AM 2. The Add Certificate modal is including non-SCEP CAs: Screenshot 2026-07-07 at 10 57 56 AM

@mostlikelee

Copy link
Copy Markdown
Contributor Author

The timestamp label should say "Added", right? Screenshot 2026-07-07 at 10 30 05 AM

This was an explicit change in the Figma

- Use $small font-size token in Add cert cards instead of px-to-rem(16)
- Replace duplicated flex column rules with @include vertical-modal-layout

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xm8MLdcjgXMdLuB29KNP3K
@mostlikelee

Copy link
Copy Markdown
Contributor Author

While testing this I found two bugs unrelated to your changes but that should be easy fixes, up to you if you want to patch them here or open new tickets:

  1. Overflow on the delete modal:

Screenshot 2026-07-07 at 10 55 57 AM 2. The Add Certificate modal is including non-SCEP CAs: Screenshot 2026-07-07 at 10 57 56 AM

Good catches. These are both pre-exisiting issues so i filed new bugs for them
#48948
#48951

@mostlikelee

Copy link
Copy Markdown
Contributor Author

@juan-fdz-hawa great catches. I made some updates and filed some bugs. Ready for another review

@mostlikelee
mostlikelee merged commit 496d4f5 into main Jul 8, 2026
26 checks passed
@mostlikelee
mostlikelee deleted the 39346-certificates-list branch July 8, 2026 15:59
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.

Controls > OS settings > Certificates: View certificates

4 participants