Skip to content

Add UI for assets#49071

Open
JordanMontgomery wants to merge 3 commits into
mainfrom
JM-48571
Open

Add UI for assets#49071
JordanMontgomery wants to merge 3 commits into
mainfrom
JM-48571

Conversation

@JordanMontgomery

@JordanMontgomery JordanMontgomery commented Jul 9, 2026

Copy link
Copy Markdown
Member

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/ or ee/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

  • New Features
    • Added a Premium-only Assets tab to Configuration Profiles, with upload, list, download, copy, and delete for JSON assets.
    • Added an Assets entry to the command palette’s configuration controls (shown only for Premium).
    • Introduced a new JSON graphic type and improved profile scope indicators for user-scoped entries.
  • Bug Fixes
    • Updated navigation so the Assets view correctly opens from both settings and the command palette.
    • Improved alignment and tooltip/icon positioning across affected list and scope displays.

@JordanMontgomery

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.10%. Comparing base (374aa7e) to head (c2f0641).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...urationProfiles/components/AssetsTab/AssetsTab.tsx 66.07% 19 Missing ⚠️
frontend/services/entities/mdm.ts 0.00% 19 Missing ⚠️
...rofiles/components/AssetListItem/AssetListItem.tsx 65.21% 8 Missing ⚠️
...rofiles/components/AddAssetModal/AddAssetModal.tsx 90.47% 4 Missing ⚠️
...s/components/DeleteAssetModal/DeleteAssetModal.tsx 83.33% 1 Missing ⚠️
frontend/utilities/endpoints.ts 0.00% 1 Missing ⚠️
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              
Flag Coverage Δ
frontend 59.34% <66.66%> (+0.04%) ⬆️

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.

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 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.

Comment thread frontend/interfaces/mdm.ts Outdated
Comment thread frontend/services/entities/mdm.ts Outdated
@coderabbitai

coderabbitai Bot commented Jul 9, 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: 1b85f9af-796e-4230-9656-6780a9e84849

📥 Commits

Reviewing files that changed from the base of the PR and between 55b258b and c2f0641.

📒 Files selected for processing (4)
  • frontend/interfaces/mdm.ts
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/AddAssetModal.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/AssetListItem.tsx
  • frontend/services/entities/mdm.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/AssetListItem.tsx
  • frontend/services/entities/mdm.ts
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/AddAssetModal.tsx

Walkthrough

This PR adds Apple DDM asset support to the Controls page. It introduces asset-related types, endpoints, and mdmService methods; adds a CONTROLS_ASSETS route; and updates the command palette and graphics map with a new Assets entry and file-json icon. The Configuration Profiles page gains Profiles/Assets sub-tabs, plus AssetsTab, AddAssetModal, AssetListItem, and DeleteAssetModal components. ProfileListItem also renders a user-scope icon for user-scoped profiles, with related alignment updates and tests.

Possibly related PRs

  • fleetdm/fleet#49011: Adds the corresponding server-side asset endpoints and datastore/service support that the new frontend asset service methods call.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main change: adding assets UI.
Description check ✅ Passed The description follows the template, includes the related issue, checklist, and testing notes, and is mostly complete.
Linked Issues check ✅ Passed The changes cover the requested tabs, asset UI, modals, user-scope icon, API methods, endpoints, and gating/misalignment fixes for #48571.
Out of Scope Changes check ✅ Passed No clear unrelated changes are present; the styling and icon additions support the assets and profile UI work.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch JM-48571

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

🧹 Nitpick comments (1)
frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/AssetsTab.tests.tsx (1)

1-103: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add 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.deleteAsset called → refetch), the error state (isErrorAssets rendering <DataError />), and the loading state (isLoadingAssets rendering <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

📥 Commits

Reviewing files that changed from the base of the PR and between a334816 and 55b258b.

📒 Files selected for processing (30)
  • frontend/components/CommandPalette/groups/controls.ts
  • frontend/components/ListItem/ListItem.tsx
  • frontend/components/graphics/FileJson.tsx
  • frontend/components/graphics/index.ts
  • frontend/interfaces/mdm.ts
  • frontend/pages/ManageControlsPage/OSSettings/OSSettings.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/ConfigurationProfiles.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/AddAssetModal.tests.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/AddAssetModal.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/_styles.scss
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AddAssetModal/index.ts
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/AssetListItem.tests.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/AssetListItem.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/_styles.scss
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetListItem/index.ts
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/AssetsTab.tests.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/AssetsTab.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/_styles.scss
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/AssetsTab/index.ts
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/DeleteAssetModal.tests.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/DeleteAssetModal.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/_styles.scss
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/DeleteAssetModal/index.ts
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/ProfileListItem/ProfileListItem.tests.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/ProfileListItem/ProfileListItem.tsx
  • frontend/pages/ManageControlsPage/OSSettings/cards/ConfigurationProfiles/components/ProfileListItem/_styles.scss
  • frontend/pages/hosts/details/OSSettingsModal/OSSettingsTable/OSSettingsNameCell/_styles.scss
  • frontend/router/paths.ts
  • frontend/services/entities/mdm.ts
  • frontend/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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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>
@JordanMontgomery JordanMontgomery marked this pull request as ready for review July 9, 2026 19:51
@JordanMontgomery JordanMontgomery requested a review from a team as a code owner July 9, 2026 19:51
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.

SAAD: Frontend - Profiles/Assets tabs, asset modals and user-scope icon on user-scoped declarations and config profiles

2 participants