Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix(JobsTab): disable Run Now action when editing job (#4036)
[._.]/ Adam Eivy695976919ad1
diff --git a/.changelog/next/fixed-issue-4036.md b/.changelog/next/fixed-issue-4036.mdnew file mode 100644index 0000000000..ac3c8062e0--- /dev/null+++ b/.changelog/next/fixed-issue-4036.md@@ -0,0 +1 @@+- Disable Run Now action on job cards while editingdiff --git a/client/src/components/cos/tabs/JobsTab.jsx b/client/src/components/cos/tabs/JobsTab.jsxindex 14b673bb8a..44ae3765c1 100644--- a/client/src/components/cos/tabs/JobsTab.jsx+++ b/client/src/components/cos/tabs/JobsTab.jsx@@ -424,8 +424,12 @@ function JobCard({ job, apps, providers, onToggle, onTrigger, onDelete, onUpdate<div className="flex items-center gap-1"><buttononClick={() => onTrigger(job.id)}- className="p-1.5 text-gray-500 hover:text-port-accent transition-colors"- title="Run now" aria-label="Run now"+ disabled={editing}+ className={`p-1.5 transition-colors ${+ editing ? 'text-gray-600 opacity-50 cursor-not-allowed' : 'text-gray-500 hover:text-port-accent'+ }`}+ title={editing ? 'Save changes before running job' : 'Run now'}+ aria-label="Run now"><Play size={14} /></button>diff --git a/client/src/components/cos/tabs/JobsTab.test.jsx b/client/src/components/cos/tabs/JobsTab.test.jsxnew file mode 100644index 0000000000..2aef526e53--- /dev/null+++ b/client/src/components/cos/tabs/JobsTab.test.jsx@@ -0,0 +1,78 @@+import { describe, it, expect, vi, beforeEach } from 'vitest';+import { fireEvent, render, screen, waitFor } from '@testing-library/react';++const api = vi.hoisted(() => ({+ getCosJobs: vi.fn(),+ triggerCosJob: vi.fn(),+ updateCosJob: vi.fn(),+ toggleCosJob: vi.fn(),+ deleteCosJob: vi.fn(),+ getJobHistory: vi.fn(),+ getApps: vi.fn(),+ getProviders: vi.fn(),+}));++const toast = vi.hoisted(() => ({ success: vi.fn(), error: vi.fn() }));++vi.mock('../../../services/api', () => api);+vi.mock('../../ui/Toast', () => ({ default: toast }));++const JobsTab = (await import('./JobsTab')).default;++const mockJob = {+ id: 'job-1',+ name: 'Test Job',+ description: 'Test job description',+ type: 'agent',+ interval: 'daily',+ intervalMs: 86400000,+ priority: 'MEDIUM',+ autonomyLevel: 'medium',+ enabled: true,+ promptTemplate: 'Do test things',+ category: 'General',+ lastRun: null,+ runCount: 0+};++beforeEach(() => {+ vi.clearAllMocks();+ api.getCosJobs.mockResolvedValue({ jobs: [mockJob] });+ api.getJobHistory.mockResolvedValue({ runs: [] });+ api.triggerCosJob.mockResolvedValue({ success: true });+ api.updateCosJob.mockResolvedValue({ job: mockJob });+ api.getApps.mockResolvedValue([]);+ api.getProviders.mockResolvedValue({ providers: [] });+});++describe('JobsTab / JobCard Run Now disable behavior (#4036)', () => {+ it('enables the Run now button when not editing and disables it while editing', async () => {+ render(<JobsTab apps={[]} providers={[]} />);++ // Wait for jobs to load+ await waitFor(() => expect(screen.getByText('Test Job')).toBeInTheDocument());++ const runNowButton = screen.getByRole('button', { name: 'Run now' });+ expect(runNowButton).not.toBeDisabled();+ expect(runNowButton).toHaveAttribute('title', 'Run now');++ // Click edit button+ const editButton = screen.getByRole('button', { name: 'Edit' });+ fireEvent.click(editButton);++ // Now Run now button should be disabled+ expect(runNowButton).toBeDisabled();+ expect(runNowButton).toHaveAttribute('title', 'Save changes before running job');++ // Attempting to click Run now while editing should not trigger job+ fireEvent.click(runNowButton);+ expect(api.triggerCosJob).not.toHaveBeenCalled();++ // Saving edits should re-enable the button+ const saveButton = screen.getByRole('button', { name: 'Save' });+ fireEvent.click(saveButton);++ await waitFor(() => expect(runNowButton).not.toBeDisabled());+ expect(runNowButton).toHaveAttribute('title', 'Run now');+ });+});