Add frontend support for enrollment profile renewal failed activity#44530
Add frontend support for enrollment profile renewal failed activity#44530MagnusHJensen wants to merge 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
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.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #44530 +/- ##
==========================================
- Coverage 66.79% 66.78% -0.02%
==========================================
Files 2637 2639 +2
Lines 212132 212175 +43
Branches 9555 9574 +19
==========================================
+ Hits 141690 141695 +5
- Misses 57576 57614 +38
Partials 12866 12866
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds UI support for the new failed_enrollment_profile_renewal activity across host and global activity feeds, including a dedicated details modal that surfaces MDM command result details.
Changes:
- Adds host activity item rendering for
failed_enrollment_profile_renewaland wires it into the host activity config. - Adds global activity feed template + “has details” handling for the new activity type.
- Introduces
FailedEnrollmentProfileModalleveraging a more flexibleCommandResultsModal(custom title/body; can fetch by command UUID without host UUID).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/pages/hosts/details/cards/Activity/ActivityItems/FailedEnrollmentProfileRenewalActivityItem/index.ts | Re-export for new host activity item. |
| frontend/pages/hosts/details/cards/Activity/ActivityItems/FailedEnrollmentProfileRenewalActivityItem/FailedEnrollmentProfileRenewalActivityItem.tsx | New host activity item UI for renewal-failed activity. |
| frontend/pages/hosts/details/cards/Activity/ActivityConfig.tsx | Registers new activity item in host past activity map. |
| frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx | Opens new failed-enrollment-profile modal from host activity details handler. |
| frontend/pages/hosts/components/CommandDetailsModal/index.ts | Re-exports helpers/types from CommandResultsModal. |
| frontend/pages/hosts/components/CommandDetailsModal/CommandDetailsModal.tsx | Adds customizable modal title/body and supports fetching results without host_uuid. |
| frontend/pages/DashboardPage/cards/ActivityFeed/GlobalActivityItem/GlobalActivityItem.tsx | Adds global activity template + enables details for new activity type. |
| frontend/pages/DashboardPage/cards/ActivityFeed/ActivityFeed.tsx | Opens new failed-enrollment-profile modal from global activity details handler. |
| frontend/interfaces/activity.ts | Adds new ActivityType value and filter label mapping. |
| frontend/components/modals/FailedEnrollmentProfileModal/index.ts | Re-export for new modal. |
| frontend/components/modals/FailedEnrollmentProfileModal/FailedEnrollmentProfileModal.tsx | New modal wrapping CommandResultsModal with custom body text. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
WalkthroughAdds a new activity type 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/pages/hosts/components/CommandDetailsModal/CommandDetailsModal.tsx (1)
194-206:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winGuard query execution when
command_uuidis empty.On Line 204,
command_uuidcan still be an empty string from upstream fallback paths, which causes a request with invalid query params and a noisy error state. Add anenabledguard.Suggested fix
{ ...DEFAULT_USE_QUERY_OPTIONS, + enabled: !!command_uuid, keepPreviousData: true, staleTime: 2000, }Also applies to: 227-231
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/pages/hosts/components/CommandDetailsModal/CommandDetailsModal.tsx` around lines 194 - 206, The useQuery calls that fetch command results (the call using useQuery with the key object containing scope: "command_results", host_identifier and command_uuid) should be guarded so they don't run when command_uuid is empty; add an enabled option (e.g., enabled: Boolean(command_uuid)) to the query options to prevent execution with invalid params, and apply the same enabled guard to the other useQuery instance that references command_uuid around lines 227-231 so both queries only run when command_uuid is non-empty.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@frontend/components/modals/FailedEnrollmentProfileModal/FailedEnrollmentProfileModal.tsx`:
- Around line 27-30: The status message in FailedEnrollmentProfileModal uses
result.name which can be null and yields an empty bold segment; update the
rendering to use a safe fallback (e.g., "Unnamed profile" or "Unknown profile")
when result.name is falsy so the copy is never blank — modify the JSX that
currently renders <b>{result.name}</b> to render <b>{result.name || "Unnamed
profile"}</b> (or equivalent), keeping displayTime and surrounding text
unchanged.
In `@frontend/pages/hosts/components/CommandDetailsModal/CommandDetailsModal.tsx`:
- Around line 208-212: The code calls
commandApi.getHostCommandResults(queryKey[0]) unconditionally which triggers the
host-specific request even when queryKey[0].host_identifier is empty; change the
logic to check queryKey[0].host_identifier first and only call
commandApi.getHostCommandResults when host_identifier is non-empty, otherwise
call commandApi.getCommandResults(queryKey[0].command_uuid), so only the
intended endpoint is invoked (refer to commandApi.getHostCommandResults,
commandApi.getCommandResults and queryKey[0].host_identifier).
In `@frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx`:
- Around line 880-886: The handler for
ActivityType.FailedEnrollmentProfileRenewal is setting
enrollmentProfileFailedDetails with an empty command_uuid which can trigger the
failed-renewal modal and a subsequent failed request; update the logic in
HostDetailsPage to guard on details?.command_uuid (or truthy
details.command_uuid) before calling setEnrollmentProfileFailedDetails so the
modal is only opened when a valid command_uuid exists (leave state unchanged or
ensure modal remains closed when command_uuid is missing).
---
Outside diff comments:
In `@frontend/pages/hosts/components/CommandDetailsModal/CommandDetailsModal.tsx`:
- Around line 194-206: The useQuery calls that fetch command results (the call
using useQuery with the key object containing scope: "command_results",
host_identifier and command_uuid) should be guarded so they don't run when
command_uuid is empty; add an enabled option (e.g., enabled:
Boolean(command_uuid)) to the query options to prevent execution with invalid
params, and apply the same enabled guard to the other useQuery instance that
references command_uuid around lines 227-231 so both queries only run when
command_uuid is non-empty.
🪄 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: 2b8c803a-e29c-4b60-bb5c-16d4dba2586e
📒 Files selected for processing (11)
frontend/components/modals/FailedEnrollmentProfileModal/FailedEnrollmentProfileModal.tsxfrontend/components/modals/FailedEnrollmentProfileModal/index.tsfrontend/interfaces/activity.tsfrontend/pages/DashboardPage/cards/ActivityFeed/ActivityFeed.tsxfrontend/pages/DashboardPage/cards/ActivityFeed/GlobalActivityItem/GlobalActivityItem.tsxfrontend/pages/hosts/components/CommandDetailsModal/CommandDetailsModal.tsxfrontend/pages/hosts/components/CommandDetailsModal/index.tsfrontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsxfrontend/pages/hosts/details/cards/Activity/ActivityConfig.tsxfrontend/pages/hosts/details/cards/Activity/ActivityItems/FailedEnrollmentProfileRenewalActivityItem/FailedEnrollmentProfileRenewalActivityItem.tsxfrontend/pages/hosts/details/cards/Activity/ActivityItems/FailedEnrollmentProfileRenewalActivityItem/index.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@frontend/components/modals/FailedEnrollmentProfileModal/FailedEnrollmentProfileModal.tsx`:
- Around line 26-30: The message currently uses result.hostname via
hostDisplayName in messageText which incorrectly references the device; replace
that with the enrollment profile label (e.g., result.enrollmentProfileLabel or
result.enrollment_profile_label) and rename hostDisplayName to something like
profileDisplayName (fallback "this enrollment profile") so messageText reads
"Fleet enrollment profile renewal failed for
<b>{profileDisplayName}</b>{displayTime}"; update any references to
hostDisplayName to the new profileDisplayName.
🪄 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: 2b3bea83-6f1a-4351-8604-960825b871c7
📒 Files selected for processing (2)
frontend/components/modals/FailedEnrollmentProfileModal/FailedEnrollmentProfileModal.tsxfrontend/pages/hosts/components/CommandDetailsModal/CommandDetailsModal.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/pages/hosts/components/CommandDetailsModal/CommandDetailsModal.tsx
Related issue: Resolves #41422
Checklist for submitter
If some of the following don't apply, delete the relevant line.
Changes file added for user-visible changes in
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information. Part of backend PR
Input data is properly validated,
SELECT *is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters.Timeouts are implemented and retries are limited to avoid infinite loops
If paths of existing endpoints are modified without backwards compatibility, checked the frontend/CLI for any necessary changes
Testing
Summary by CodeRabbit