Reuse Policies' Automations button on Dashboard, Software, and Reports - #46846
Conversation
…, and Reports Extracts the gear-icon + "Automations" button into a reusable AutomationsButton component and uses it across the Policies, Software, and Reports pages. The Dashboard Activity card reuses it via a new "automations" action type on useInfoCard. No modal/behavior changes.
There was a problem hiding this comment.
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.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #46846 +/- ##
========================================
Coverage 66.95% 66.96%
========================================
Files 2851 2854 +3
Lines 225402 225533 +131
Branches 11547 11592 +45
========================================
+ Hits 150915 151024 +109
- Misses 60789 60811 +22
Partials 13698 13698
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
This PR introduces a reusable AutomationsButton component (matching the existing Policies “Automations” button) and replaces bespoke “Manage automations” button implementations across Dashboard, Software, and Reports/Queries for consistent UI and reuse.
Changes:
- Added
components/buttons/AutomationsButton(TSX + SCSS + index export). - Replaced existing inverse buttons in Software, Queries, and Policies pages with
AutomationsButton. - Updated Dashboard InfoCard action handling to support an
automationsaction type and render the new button.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/pages/SoftwarePage/SoftwarePage.tsx | Swaps the “Manage automations” inverse button for AutomationsButton within the tooltip wrapper. |
| frontend/pages/queries/ManageQueriesPage/ManageQueriesPage.tsx | Reuses AutomationsButton for the reports automations entrypoint (enabled + disabled states). |
| frontend/pages/policies/ManagePoliciesPage/ManagePoliciesPage.tsx | Replaces the inline Icon+Button “Automations” control with AutomationsButton. |
| frontend/pages/DashboardPage/DashboardPage.tsx | Changes Activity card action config to use a new automations action type. |
| frontend/pages/DashboardPage/components/InfoCard/InfoCard.tsx | Adds rendering support for action.type === "automations" using AutomationsButton. |
| frontend/components/buttons/AutomationsButton/index.ts | Adds barrel export for the new button component. |
| frontend/components/buttons/AutomationsButton/AutomationsButton.tsx | Implements the reusable AutomationsButton wrapper around Button. |
| frontend/components/buttons/AutomationsButton/_styles.scss | Adds styling for the new button. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .automations-button { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: $pad-small; | ||
| } |
| const baseClass = "automations-button"; | ||
|
|
||
| export interface IAutomationsButtonProps { | ||
| onClick?: (evt: React.MouseEvent<HTMLButtonElement>) => void; | ||
| disabled?: boolean; | ||
| className?: string; | ||
| size?: "small" | "wide" | "default"; | ||
| } |
|
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 (2)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThis PR introduces a reusable Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
…types from Button - Remove _styles.scss: the gap was applied to the <button> element, but icon/text live in Button's .children-wrapper; spacing is already provided by the --inverse variant's children-wrapper gap. - Derive IAutomationsButtonProps from Button's IButtonProps so onClick/size stay in sync (onClick now also accepts keyboard/generic handlers). - Drop the now-redundant manage-policies__automations-button rule/className.
The Button directory's index.ts only re-exported the default, so importing the IButtonProps type via "components/buttons/Button" failed (TS2614). Re-export the named types alongside the default.
Resolves #45147 (AutomationsButton introduced as part of that issue)
Testing
Summary by CodeRabbit