Fleet UI: Hosts page gear menu and per-fleet Activity automations modal - #50269
Fleet UI: Hosts page gear menu and per-fleet Activity automations modal#50269nulmete wants to merge 2 commits into
Conversation
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Codecov Report❌ Patch coverage is
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
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:
|
WalkthroughThe PR adds typed host activity webhook settings and exposes a gated automation command in the command palette. It extends Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 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
📒 Files selected for processing (13)
frontend/components/ActionsDropdown/ActionsDropdown.tsxfrontend/components/CommandPalette/CommandPalette.tsxfrontend/components/CommandPalette/groups/automations.tsfrontend/components/CommandPalette/helpers.tsfrontend/interfaces/config.tsfrontend/interfaces/team.tsfrontend/interfaces/webhook.tsfrontend/pages/hosts/ManageHostsPage/ManageHostsPage.tests.tsxfrontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsxfrontend/pages/hosts/ManageHostsPage/components/HostActivityAutomationsModal/HostActivityAutomationsModal.tests.tsxfrontend/pages/hosts/ManageHostsPage/components/HostActivityAutomationsModal/HostActivityAutomationsModal.tsxfrontend/pages/hosts/ManageHostsPage/components/HostActivityAutomationsModal/_styles.scssfrontend/pages/hosts/ManageHostsPage/components/HostActivityAutomationsModal/index.ts
| const onModalSubmit = () => { | ||
| const newErrors = validateForm(formData); | ||
| setFormErrors(newErrors); | ||
| if (Object.keys(newErrors).length === 0) { | ||
| onSubmit(formData); | ||
| } |
There was a problem hiding this comment.
🎯 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.
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/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
Added/updated automated tests
Where appropriate, automated tests simulate multiple hosts and test for host isolation (updates to one hosts's records do not affect another)
QA'd all new/changed functionality manually
For unreleased bug fixes in a release candidate, one of:
Database migrations
COLLATE utf8mb4_unicode_ci).New Fleet configuration settings
If you didn't check the box above, follow this checklist for GitOps-enabled settings:
fleetctl generate-gitopsfleetd/orbit/Fleet Desktop
runtime.GOOSis used as needed to isolate changesSummary by CodeRabbit