Skip to content

Fleet UI: Manage local accounts host details page followup - #44013

Merged
RachelElysia merged 3 commits into
mainfrom
31741-fe-1-followup
Apr 23, 2026
Merged

Fleet UI: Manage local accounts host details page followup#44013
RachelElysia merged 3 commits into
mainfrom
31741-fe-1-followup

Conversation

@RachelElysia

@RachelElysia RachelElysia commented Apr 22, 2026

Copy link
Copy Markdown
Member

Issue

Closes #31741

Description

Follow-up post-review

  • Separate failed tooltip on disable state (If the product team has specific copy for the failed state, this can be adjusted)
  • Massage activity for unassigned hosts to read better
  • Refetch activity feed on close so users will see the viewed activity in past activity immediately
  • On enter won't close modal for people viewing the password using keyboard navigation on the show button

Testing

  • QA'd all new/changed functionality manually

Summary by CodeRabbit

  • New Features

    • Modal component now supports an optional Enter key handler.
  • Bug Fixes

    • Improved activity feed text clarity for managed account operations.
    • Activity feed now properly updates after dismissing the managed account modal.
    • Tooltip messaging distinguishes between pending and failed managed account statuses.
  • Tests

    • Expanded test coverage for managed account status-specific tooltips.

Copilot AI review requested due to automatic review settings April 22, 2026 21:11
@RachelElysia
RachelElysia requested a review from a team as a code owner April 22, 2026 21:11

@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

Follow-up UI tweaks for managed local accounts on the Host details page, improving keyboard behavior, activity feed messaging, and host action tooltips.

Changes:

  • Removes onEnter behavior from the managed account modal to avoid Enter-key conflicts.
  • Refetches host past activities when closing the managed account modal so “viewed managed account” appears in the feed.
  • Splits the “pending” vs “failed” managed account tooltip messaging and refines activity feed copy for (un)assigned hosts.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/pages/hosts/details/HostDetailsPage/modals/ManagedAccountModal/ManagedAccountModal.tsx Stops binding Enter key to modal cancel.
frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx Refetches past activities on managed account modal close.
frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/helpers.tsx Adds distinct tooltip copy for managed account “failed” state.
frontend/pages/DashboardPage/cards/ActivityFeed/GlobalActivityItem/GlobalActivityItem.tsx Updates wording for managed local accounts enable/disable activities.
frontend/components/Modal/Modal.tsx Documents onEnter usage caveats for modals.

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

@RachelElysia RachelElysia changed the title Fleet UI: <anage local accounts host details page followup Fleet UI: Manage local accounts host details page followup Apr 22, 2026
@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The pull request introduces an onEnter callback mechanism to the Modal component, allowing parent components to specify custom behavior when users press Enter. This callback is integrated into ManagedAccountModal to trigger modal closure. The changes also update activity feed template text for managed local account actions to improve clarity around host fleet assignments, refactor tooltip messaging in the managed account dropdown to distinguish between pending and failed states, and split a parametrized test into separate test cases for improved clarity. When the ManagedAccountModal closes, the host details page now refetches past activities to reflect server-side changes in the activity feed.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The linked issue #31741 is about VPP app install status, unrelated to this PR's changes about managed account modal behavior and activity feed text. Verify that issue #31741 is the correct related issue, or link to the appropriate issue (#31652 or #31674) that addresses manage local accounts functionality.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description covers the main objectives (separate failed tooltip, improve activity text, refetch feed, prevent modal close on Enter), but the QA checklist item is unchecked and the description is less detailed than typical.
Out of Scope Changes check ✅ Passed The changes focus on Modal props, managed account tooltip states, activity feed text, and refetch behavior—all aligned with the stated objectives of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and specifically summarizes the main changes: follow-up improvements to the 'Manage local accounts' feature on the host details page.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 31741-fe-1-followup

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 and usage tips.

@codecov

codecov Bot commented Apr 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 37.50000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.09%. Comparing base (c4b3089) to head (04c3941).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
.../hosts/details/HostDetailsPage/HostDetailsPage.tsx 0.00% 3 Missing ⚠️
...vityFeed/GlobalActivityItem/GlobalActivityItem.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #44013      +/-   ##
==========================================
- Coverage   65.10%   65.09%   -0.01%     
==========================================
  Files        2608     2608              
  Lines      254025   254032       +7     
  Branches     9401     9291     -110     
==========================================
+ Hits       165371   165373       +2     
- Misses      75852    75857       +5     
  Partials    12802    12802              
Flag Coverage Δ
frontend 54.76% <37.50%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/components/Modal/Modal.tsx (1)

76-91: ⚠️ Potential issue | 🟠 Major

Document-level Enter listener has real impact and needs hardening — avoid global reach.

The onEnter prop is actively used by 50+ modal components across the codebase. However, the listener implementation has a genuine problem:

When a modal passes onEnter, pressing Enter anywhere—including inside focused inputs, buttons, or nested modals—triggers the callback and preventDefault(). This silently breaks native form submission, button activation, and other Enter-dependent flows.

Evidence: ActivityItem.tsx includes stopPropagation() in its click handler specifically to work around unwanted bubbling up to the Modal's onEnter handler (lines 97-100). This is a symptom of the listener's overly broad reach.

Required hardening:

  • Only fire when the event target is inside this modal (scope via a ref on the modal container), or at minimum ignore events when event.defaultPrevented is true or the target is a <button>, <textarea>, or contenteditable element.
  • Skip IME composition: if (event.isComposing || event.keyCode === 229) return;.
  • Consider keyup or check event.repeat to avoid repeated fires on held keys.

This affects many components and should be fixed before more modals depend on this behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/components/Modal/Modal.tsx` around lines 76 - 91, The document-level
Enter handler (closeOrSaveWithEnterKey used in the useEffect for onEnter) is too
broad — restrict it by tying it to this modal's container ref (check that
event.target is contained within the modal element) and/or ignore events when
event.defaultPrevented is true or the target is a control that should keep
native behavior (e.g., tagName "BUTTON", "TEXTAREA", contentEditable elements or
input types that submit forms); also skip IME composition by returning early
when event.isComposing or event.keyCode === 229, and avoid duplicate firings by
checking event.type/key repeat (use keyup or test event.repeat) before calling
onEnter; keep the same add/remove listener logic in the useEffect but apply
these guards inside closeOrSaveWithEnterKey.
🧹 Nitpick comments (1)
frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx (1)

1625-1635: Refetch on close looks correct; minor: only past activities are refreshed.

The backend (ee/server/service/hosts.go GetHostManagedAccountPassword) writes the ActivityTypeViewedManagedLocalAccount synchronously before returning the password, so by the time the modal is closed the activity is already persisted — the refetch here will pick it up. Two small nits:

  • If the user is currently viewing the "Upcoming" tab, the new past activity won't appear until they switch tabs and pastActivities is re-read. That's probably fine since this activity is always "past", but consider whether a refetchUpcomingActivities() is also warranted for consistency with the other close handlers (onCloseScriptModalGroup, onCancelRunScriptDetailsModal) that refetch both.
  • The inline arrow allocates a new handler every render. Not a functional issue, just stylistically inconsistent with the surrounding useCallback-based handlers.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx` around
lines 1625 - 1635, The current inline onCancel handler for ManagedAccountModal
always allocates a new function and only calls refetchPastActivities(), so
refetching is inconsistent with other close handlers; change the inline arrow to
a stable useCallback handler (e.g., handleManagedAccountModalCancel) and have it
call setShowManagedAccountModal(false) and both refetchPastActivities() and
refetchUpcomingActivities() for consistency with
onCloseScriptModalGroup/onCancelRunScriptDetailsModal so the new activity is
visible in all tabs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@frontend/components/Modal/Modal.tsx`:
- Around line 76-91: The document-level Enter handler (closeOrSaveWithEnterKey
used in the useEffect for onEnter) is too broad — restrict it by tying it to
this modal's container ref (check that event.target is contained within the
modal element) and/or ignore events when event.defaultPrevented is true or the
target is a control that should keep native behavior (e.g., tagName "BUTTON",
"TEXTAREA", contentEditable elements or input types that submit forms); also
skip IME composition by returning early when event.isComposing or event.keyCode
=== 229, and avoid duplicate firings by checking event.type/key repeat (use
keyup or test event.repeat) before calling onEnter; keep the same add/remove
listener logic in the useEffect but apply these guards inside
closeOrSaveWithEnterKey.

---

Nitpick comments:
In `@frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx`:
- Around line 1625-1635: The current inline onCancel handler for
ManagedAccountModal always allocates a new function and only calls
refetchPastActivities(), so refetching is inconsistent with other close
handlers; change the inline arrow to a stable useCallback handler (e.g.,
handleManagedAccountModalCancel) and have it call
setShowManagedAccountModal(false) and both refetchPastActivities() and
refetchUpcomingActivities() for consistency with
onCloseScriptModalGroup/onCancelRunScriptDetailsModal so the new activity is
visible in all tabs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: deb25bb9-f60f-4e1d-80ea-8e4318b6acde

📥 Commits

Reviewing files that changed from the base of the PR and between c4b3089 and 04c3941.

📒 Files selected for processing (6)
  • frontend/components/Modal/Modal.tsx
  • frontend/pages/DashboardPage/cards/ActivityFeed/GlobalActivityItem/GlobalActivityItem.tsx
  • frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/HostActionsDropdown.tests.tsx
  • frontend/pages/hosts/details/HostDetailsPage/HostActionsDropdown/helpers.tsx
  • frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx
  • frontend/pages/hosts/details/HostDetailsPage/modals/ManagedAccountModal/ManagedAccountModal.tsx

@RachelElysia
RachelElysia merged commit 0db7c2b into main Apr 23, 2026
19 checks passed
@RachelElysia
RachelElysia deleted the 31741-fe-1-followup branch April 23, 2026 01:42
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