Skip to content

Fleet UI: Hosts page gear menu and per-fleet Activity automations modal - #50269

Draft
nulmete wants to merge 2 commits into
50217-host-activity-webhooks-backendfrom
50219-host-activity-webhooks-frontend
Draft

Fleet UI: Hosts page gear menu and per-fleet Activity automations modal#50269
nulmete wants to merge 2 commits into
50217-host-activity-webhooks-backendfrom
50219-host-activity-webhooks-frontend

Conversation

@nulmete

@nulmete nulmete commented Jul 30, 2026

Copy link
Copy Markdown
Member

Related issue: Resolves #50219

Adds the Hosts page UI for per-fleet host activity webhooks: the "Custom host vitals" and "Enroll secrets" header buttons move into a gear-icon menu with a new "Activity automations" option, which opens a modal to enable the webhook and set its destination URL for the selected fleet (including "No fleet"). The option is disabled with a tooltip on "All fleets" and on Fleet Free. Stacked on #50247 (backend).

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

For unreleased bug fixes in a release candidate, one of:

  • Confirmed that the fix is not expected to adversely impact load test results
  • Alerted the release DRI if additional load testing is needed

Database migrations

  • Checked schema for all modified table for columns that will auto-update timestamps during migration.
  • Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects.
  • Ensured the correct collation is explicitly set for character columns (COLLATE utf8mb4_unicode_ci).

New Fleet configuration settings

  • Setting(s) is/are explicitly excluded from GitOps

If you didn't check the box above, follow this checklist for GitOps-enabled settings:

  • Verified that the setting is exported via fleetctl generate-gitops
  • Verified the setting is documented in a separate PR to the GitOps documentation
  • Verified that the setting is cleared on the server if it is not supplied in a YAML file (or that it is documented as being optional)
  • Verified that any relevant UI is disabled when GitOps mode is enabled

fleetd/orbit/Fleet Desktop

  • Verified compatibility with the latest released version of Fleet (see Must rule)
  • If the change applies to only one platform, confirmed that runtime.GOOS is used as needed to isolate changes
  • Verified that fleetd runs on macOS, Linux and Windows
  • Verified auto-update works from the released version of component to the new version (see tools/tuf/test)

Summary by CodeRabbit

  • New Features
    • Added host activity automation management for configuring webhook delivery and viewing example payloads.
    • Added access through the Hosts settings menu and command palette, with premium and permission-based availability.
    • Added an icon-only option for dropdown action triggers.
    • Added validation, save status feedback, and GitOps-aware controls.
  • Bug Fixes
    • Improved Hosts page settings menu behavior and empty-state test coverage.

@nulmete

nulmete commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.09677% with 47 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.07%. Comparing base (2652e2e) to head (907a185).

Files with missing lines Patch % Lines
...nd/pages/hosts/ManageHostsPage/ManageHostsPage.tsx 42.10% 33 Missing ⚠️
...yAutomationsModal/HostActivityAutomationsModal.tsx 73.07% 14 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                           @@
##           50217-host-activity-webhooks-backend   #50269    +/-   ##
======================================================================
  Coverage                                 67.07%   67.07%            
======================================================================
  Files                                      3934     3935     +1     
  Lines                                    251101   251217   +116     
  Branches                                  13281    13487   +206     
======================================================================
+ Hits                                     168424   168516    +92     
- Misses                                    67339    67362    +23     
- Partials                                  15338    15339     +1     
Flag Coverage Δ
frontend 61.30% <62.09%> (+0.05%) ⬆️

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 Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The PR adds typed host activity webhook settings and exposes a gated automation command in the command palette. It extends ActionsDropdown with an icon-only trigger, replaces Hosts page header controls with a settings menu, and adds deep-link handling for the automation modal. The new modal loads and saves per-team webhook settings, validates destination URLs, displays an example payload, and disables inputs in GitOps mode. Tests cover menu behavior, premium gating, modal states, validation, submission, payload rendering, and GitOps mode.

Possibly related issues

  • fleetdm/fleet#40493 — Covers the broader host activity webhook UI, modal, permissions, and per-fleet settings implemented here.
  • fleetdm/fleet#50217 — Directly overlaps the host_activities_webhook configuration and frontend wiring.
  • fleetdm/fleet#50220 — Concerns documentation and QA for the host activity webhook feature added by this PR.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Most requested UI and modal work is present, but the linked issue's profile_uuid activity-interface update is missing from the changes. Add the activity details profile_uuid field and any related wiring, or document that it is handled in a separate backend PR.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main gear-menu and Activity automations modal change.
Description check ✅ Passed The description includes the related issue and a clear summary matching the template, with the checklist sections present.
Out of Scope Changes check ✅ Passed The changed files all support the Hosts page gear menu, modal, webhooks, tests, or related shared UI updates.
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 50219-host-activity-webhooks-frontend

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: 1

🤖 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/hosts/ManageHostsPage/components/HostActivityAutomationsModal/HostActivityAutomationsModal.tsx`:
- Around line 95-100: Update HostActivityAutomationsModal’s onModalSubmit and
Save/Modal Enter submission paths to check GitOps mode before validating or
calling onSubmit, preventing webhook updates when GitOps is enabled. Disable the
Save control in that mode, and add a regression test confirming neither Save nor
Enter invokes onSubmit.
🪄 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 Plus

Run ID: c651a603-2869-4566-bbc2-8b0059b1745d

📥 Commits

Reviewing files that changed from the base of the PR and between 2652e2e and ea69dd4.

📒 Files selected for processing (13)
  • frontend/components/ActionsDropdown/ActionsDropdown.tsx
  • frontend/components/CommandPalette/CommandPalette.tsx
  • frontend/components/CommandPalette/groups/automations.ts
  • frontend/components/CommandPalette/helpers.ts
  • frontend/interfaces/config.ts
  • frontend/interfaces/team.ts
  • frontend/interfaces/webhook.ts
  • frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tests.tsx
  • frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx
  • frontend/pages/hosts/ManageHostsPage/components/HostActivityAutomationsModal/HostActivityAutomationsModal.tests.tsx
  • frontend/pages/hosts/ManageHostsPage/components/HostActivityAutomationsModal/HostActivityAutomationsModal.tsx
  • frontend/pages/hosts/ManageHostsPage/components/HostActivityAutomationsModal/_styles.scss
  • frontend/pages/hosts/ManageHostsPage/components/HostActivityAutomationsModal/index.ts

Comment on lines +95 to +100
const onModalSubmit = () => {
const newErrors = validateForm(formData);
setFormErrors(newErrors);
if (Object.keys(newErrors).length === 0) {
onSubmit(formData);
}

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Block saves in GitOps mode.

GitOps currently disables editing controls but still permits onSubmit through Save and Modal’s Enter handler. Disable Save and guard onModalSubmit so this UI cannot issue a webhook update while GitOps is enabled. Add a regression test that Save/Enter does not call onSubmit.

Proposed fix
 const onModalSubmit = () => {
+  if (gitOpsModeEnabled) {
+    return;
+  }
   const newErrors = validateForm(formData);
   setFormErrors(newErrors);
   if (Object.keys(newErrors).length === 0) {
     onSubmit(formData);
   }
 };
 
 ...
- disabled={Object.keys(formErrors).length > 0}
+ disabled={gitOpsModeEnabled || Object.keys(formErrors).length > 0}

Also applies to: 182-187

🤖 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/hosts/ManageHostsPage/components/HostActivityAutomationsModal/HostActivityAutomationsModal.tsx`
around lines 95 - 100, Update HostActivityAutomationsModal’s onModalSubmit and
Save/Modal Enter submission paths to check GitOps mode before validating or
calling onSubmit, preventing webhook updates when GitOps is enabled. Disable the
Save control in that mode, and add a regression test confirming neither Save nor
Enter invokes onSubmit.

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.

1 participant