Add UI for assets#49071
Conversation
|
@coderabbitai review |
✅ Action performedReview finished.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #49071 +/- ##
==========================================
- Coverage 68.11% 68.10% -0.01%
==========================================
Files 3732 3739 +7
Lines 235793 236029 +236
Branches 12520 12436 -84
==========================================
+ Hits 160602 160759 +157
- Misses 60771 60850 +79
Partials 14420 14420
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a new “Assets” UI surface under Controls → OS settings → Configuration profiles to manage Apple DDM assets, including frontend API wiring, routing, and supporting components (list items, modals, icons), plus a user-scope indicator in the Profiles list.
Changes:
- Add assets API endpoints + client methods (list/upload/download/delete) and an “Assets” secondary tab routed via
/controls/os-settings/assets. - Implement Assets tab UI (empty/populated states, add/delete modals, identifier copy + download).
- Add user-scope icon for user-scoped profiles and fix icon alignment in related UI.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/utilities/endpoints.ts | Adds REST endpoint builders for Apple DDM assets. |
| frontend/services/entities/mdm.ts | Adds MDM entity methods and types for assets CRUD + download. |
| frontend/router/paths.ts | Adds route constant for the assets sub-tab. |
| frontend/pages/ManageControlsPage/OSSettings/OSSettings.tsx | Maps /assets route to configuration-profiles card while selecting the Assets sub-tab. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/ConfigurationProfiles.tsx | Adds Profiles/Assets secondary tabs and routes between them. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/ProfileListItem/ProfileListItem.tsx | Renders user-scope icon for user-scoped profiles (non-iOS/iPadOS). |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/ProfileListItem/ProfileListItem.tests.tsx | Tests user-scope icon visibility rules. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/ProfileListItem/_styles.scss | Styles title row + scope icon alignment/truncation behavior. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/index.ts | Barrel export for DeleteAssetModal. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/DeleteAssetModal.tsx | Implements delete confirmation modal and copy. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/DeleteAssetModal.tests.tsx | Tests delete modal copy and callbacks. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/_styles.scss | Styles delete asset modal layout. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/index.ts | Barrel export for AssetsTab. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/AssetsTab.tsx | Implements assets tab states, list rendering, and modal orchestration. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/AssetsTab.tests.tsx | Tests premium gating, MDM-off state, empty state, and populated list behavior. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/_styles.scss | Styles for Assets tab empty technician state. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/index.ts | Barrel export for AssetListItem. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/AssetListItem.tsx | Implements asset row UI (uploaded time, identifier copy, download/delete actions). |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/AssetListItem.tests.tsx | Tests asset row rendering and delete action visibility/callback. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/_styles.scss | Styles asset row truncation, details layout, and action buttons. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/index.ts | Barrel export for AddAssetModal. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/AddAssetModal.tsx | Implements add/upload asset modal with file chooser and copy. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/AddAssetModal.tests.tsx | Tests add modal copy, upload flow, and error surfacing. |
| frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/_styles.scss | Styles file chooser and selected-file preview. |
| frontend/pages/hosts/details/OSSettingsModal/OSSettingsTable/OSSettingsNameCell/_styles.scss | Aligns scope icon vertically in host OS settings table cell. |
| frontend/interfaces/mdm.ts | Adds IMdmAsset + PayloadScope types and scope on IMdmProfile. |
| frontend/components/ListItem/ListItem.tsx | Extends supported graphics to include file-json. |
| frontend/components/graphics/index.ts | Registers the new file-json graphic. |
| frontend/components/graphics/FileJson.tsx | Adds JSON file graphic SVG component. |
| frontend/components/CommandPalette/groups/controls.ts | Adds premium-only command palette entry for Assets. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughThis PR adds Apple DDM asset support to the Controls page. It introduces asset-related types, endpoints, and Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/AssetsTab.tests.tsx (1)
1-103: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd tests for delete flow, error state, and loading state.
Current tests cover premium gating, MDM-off prompt, empty state, and list rendering. Missing coverage for: the delete asset flow (clicking delete → modal → confirm →
mdmAPI.deleteAssetcalled → refetch), the error state (isErrorAssetsrendering<DataError />), and the loading state (isLoadingAssetsrendering<Spinner />). Adding these would protect the most interactive user paths.🤖 Prompt for 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. In `@frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/AssetsTab.tests.tsx` around lines 1 - 103, Add coverage in AssetsTab.tests.tsx for the missing user paths in AssetsTab: verify the delete flow triggers the delete action and refetches assets, confirm the error branch renders DataError when isErrorAssets is true, and confirm the loading branch renders Spinner when isLoadingAssets is true. Use the existing AssetsTab, mdmAPI.deleteAsset/getAssets mocks, and the delete UI/modal interactions in the component to locate the behavior.
🤖 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/ConfigurationProfiles/components/AddAssetModal/AddAssetModal.tsx`:
- Around line 117-120: `AddAssetModal` is closing the modal even when the upload
fails because `onDone()` is called in the `finally` block of the upload flow.
Move the `onDone()` call out of `finally` and invoke it only after a successful
upload completes, while keeping `setIsLoading(false)` in `finally` so the modal
stays open and the selected file remains available for retry on error.
- Around line 36-54: The file picker trigger is currently nested inside the
Button in AddAssetModal, which creates invalid interactive content and
unreliable click behavior. Update AddAssetModal so the Button uses an
onClick/ref-driven approach to open the hidden file input instead of wrapping a
label inside the native button, and keep the file selection handling in the
existing onFileOpen flow.
In
`@frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/DeleteAssetModal.tsx`:
- Around line 36-49: The DeleteAssetModal flow currently allows cancellation and
other modal dismissal actions while deletion is in progress. Update
DeleteAssetModal so the Cancel Button is disabled when isDeleting is true, and
pass isLoading={isDeleting} through to the Modal so Escape/Enter and other close
interactions are blocked during the async delete. Use the existing onDelete,
onCancel, and isDeleting props in DeleteAssetModal to keep the modal open and
prevent duplicate delete calls until the request finishes.
---
Nitpick comments:
In
`@frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/AssetsTab.tests.tsx`:
- Around line 1-103: Add coverage in AssetsTab.tests.tsx for the missing user
paths in AssetsTab: verify the delete flow triggers the delete action and
refetches assets, confirm the error branch renders DataError when isErrorAssets
is true, and confirm the loading branch renders Spinner when isLoadingAssets is
true. Use the existing AssetsTab, mdmAPI.deleteAsset/getAssets mocks, and the
delete UI/modal interactions in the component to locate the behavior.
🪄 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: 3c9caf12-1a73-4329-8c51-73f6fe186799
📒 Files selected for processing (30)
frontend/components/CommandPalette/groups/controls.tsfrontend/components/ListItem/ListItem.tsxfrontend/components/graphics/FileJson.tsxfrontend/components/graphics/index.tsfrontend/interfaces/mdm.tsfrontend/pages/ManageControlsPage/OSSettings/OSSettings.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/ConfigurationProfiles.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/AddAssetModal.tests.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/AddAssetModal.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/_styles.scssfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/index.tsfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/AssetListItem.tests.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/AssetListItem.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/_styles.scssfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/index.tsfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/AssetsTab.tests.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/AssetsTab.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/_styles.scssfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/index.tsfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/DeleteAssetModal.tests.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/DeleteAssetModal.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/_styles.scssfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/index.tsfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/ProfileListItem/ProfileListItem.tests.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/ProfileListItem/ProfileListItem.tsxfrontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/ProfileListItem/_styles.scssfrontend/pages/hosts/details/OSSettingsModal/OSSettingsTable/OSSettingsNameCell/_styles.scssfrontend/router/paths.tsfrontend/services/entities/mdm.tsfrontend/utilities/endpoints.ts
| labels_include_any?: IProfileLabel[]; | ||
| labels_exclude_any?: IProfileLabel[]; | ||
| // Apple DDM PayloadScope: "User" for user-scoped declarations, "System" | ||
| // otherwise. Note this differs from the host details endpoint, which reports |
There was a problem hiding this comment.
This inconsistency is slightly weird but it's been there for a year so I dunno about changing it now. Happy to be persuaded otherwise(it'd be backend)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Related issue: Resolves #48571
Checklist for submitter
If some of the following don't apply, delete the relevant line.
No changes file as this is a subtask
Changes file added for user-visible changes in
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information.
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