Skip to content

feat(platform): add activate/deactivate toggle for automations#429

Merged
Israeltheminer merged 2 commits into
mainfrom
feat/automation-active-toggle
Feb 11, 2026
Merged

feat(platform): add activate/deactivate toggle for automations#429
Israeltheminer merged 2 commits into
mainfrom
feat/automation-active-toggle

Conversation

@Israeltheminer

@Israeltheminer Israeltheminer commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

Closes #383

Summary

  • Add a Switch toggle component (AutomationActiveToggle) for directly activating/deactivating automations
  • Add toggle column to the automations list table (after the status badge)
  • Add toggle with label and helper text at the top of the automation configuration tab
  • Draft automations have the toggle disabled (they require the full publish flow)
  • Deactivation shows a confirmation dialog consistent with existing UX patterns
  • Includes unit tests (8 test cases) covering all states and interactions

Test plan

  • Automations list: toggle appears in table, disabled for drafts, toggles active/archived
  • Configuration tab: toggle appears at top with label and helper text, same behavior
  • Deactivation shows confirmation dialog before proceeding
  • Toast messages appear on success/failure
  • Row click navigation still works (toggle click doesn't trigger it)
  • Unit tests pass: npm run test:ui --workspace=@tale/platform

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added toggle control to activate/deactivate automations in the automations table and configuration page.
    • Added confirmation dialog for deactivating automations to prevent accidental state changes.
  • Documentation

    • Added UI labels and help text describing automation active state and behavior.
  • Tests

    • Added comprehensive test suite for automation toggle functionality.

Add a Switch toggle to both the automations list table and the
configuration tab, allowing direct activation/deactivation without
navigating through dropdown menus. Draft automations have the toggle
disabled since they require the full publish flow. Deactivation shows
a confirmation dialog consistent with existing UX patterns.
@coderabbitai

coderabbitai Bot commented Feb 11, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR implements an active/inactive state toggle feature for automations. It introduces a new AutomationActiveToggle React component that renders a switch to control automation active state, with a confirmation dialog for deactivation. The component integrates with republish/unpublish hooks for state management and authentication hooks for user context. The feature is integrated into the automations table configuration, the automation configuration page, and includes comprehensive test coverage. Localization strings are added for UI elements and accessibility labels. The test configuration is updated to include tests under the app/features/**/*.test.{ts,tsx} pattern.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a toggle component for activating/deactivating automations, which matches the primary objective of the PR.
Linked Issues check ✅ Passed All coding requirements from issue #383 are met: AutomationActiveToggle component enables users to activate/deactivate automations from both the list (via use-automations-table-config) and configuration tab, with proper handling of draft constraints.
Out of Scope Changes check ✅ Passed All changes are directly related to issue #383 requirements. The vitest.ui.config.mjs change simply enables test discovery for the new test file and is a necessary supporting change.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/automation-active-toggle

Comment @coderabbitai help to get the list of available commands and usage tips.

@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

Caution

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

⚠️ Outside diff range comments (1)
services/platform/app/features/automations/components/use-automations-table-config.tsx (1)

31-38: 🧹 Nitpick | 🔵 Trivial

Use automations-specific archived label for consistency.

The status column currently uses t.common('status.archived'); prefer tEntity('navigation.archived') to match the automations context.

♻️ Suggested update
-              : status === 'archived'
-                ? t.common('status.archived')
+              : status === 'archived'
+                ? tEntity('navigation.archived')
Based on learnings: “In automations-related UI components, prefer using the navigation-specific localization key t('navigation.archived') instead of a generic status key like tCommon('status.archived') when the wording conveys a contextual meaning unique to automations navigation.”
🤖 Fix all issues with AI agents
In
`@services/platform/app/features/automations/components/automation-active-toggle.tsx`:
- Around line 96-110: The wrapper div around the Switch causes the
noStaticElementInteractions lint error; remove the non-interactive wrapper and
move its event handlers to the interactive Switch component — attach
onClick={(e) => e.stopPropagation()} and onKeyDown={(e) => e.stopPropagation()}
directly to the Switch (while keeping checked={isActive},
onCheckedChange={handleToggle}, disabled={isDraft || isToggling}, label={label},
and aria-label={tAutomations('activeToggle.ariaLabel')}) so the stopPropagation
logic remains but the interaction is on an interactive element.

Move stopPropagation handlers from wrapper div to Switch component
to fix noStaticElementInteractions lint error. Exclude app/features
tests from default vitest config so they only run under jsdom via
vitest.ui.config.mjs.
@Israeltheminer Israeltheminer merged commit 2bd843d into main Feb 11, 2026
8 checks passed
@Israeltheminer Israeltheminer deleted the feat/automation-active-toggle branch February 11, 2026 17:23
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.

Automations should have an active/inactive state

1 participant