Skip to content

Commit b7d8918

Browse files
authored
fix(site): only show active tasks in waiting for input tab (#20933)
This change filters out non-active tasks from the "Waiting for input" tab filter for the tasks list. --- 🤖 This change was initially written by Claude Code using Coder Tasks, then reviewed and edited by a human 🏂
1 parent e7dbbcd commit b7d8918

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

site/src/pages/TasksPage/TasksPage.stories.tsx

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { withAuthProvider, withProxyProvider } from "testHelpers/storybook";
1010
import type { Meta, StoryObj } from "@storybook/react-vite";
1111
import { API } from "api/api";
1212
import { MockUsers } from "pages/UsersPage/storybookData/users";
13-
import { expect, spyOn, userEvent, within } from "storybook/test";
13+
import { expect, spyOn, userEvent, waitFor, within } from "storybook/test";
1414
import { getTemplatesQueryKey } from "../../api/queries/templates";
1515
import TasksPage from "./TasksPage";
1616

@@ -145,6 +145,29 @@ export const LoadedTasksWaitingForInputTab: Story = {
145145
spyOn(API, "getTasks").mockResolvedValue([
146146
{
147147
...firstTask,
148+
id: "active-idle-task",
149+
display_name: "Active Idle Task",
150+
status: "active",
151+
current_state: {
152+
...firstTask.current_state,
153+
state: "idle",
154+
},
155+
},
156+
{
157+
...firstTask,
158+
id: "paused-idle-task",
159+
display_name: "Paused Idle Task",
160+
status: "paused",
161+
current_state: {
162+
...firstTask.current_state,
163+
state: "idle",
164+
},
165+
},
166+
{
167+
...firstTask,
168+
id: "error-idle-task",
169+
display_name: "Error Idle Task",
170+
status: "error",
148171
current_state: {
149172
...firstTask.current_state,
150173
state: "idle",
@@ -161,6 +184,23 @@ export const LoadedTasksWaitingForInputTab: Story = {
161184
name: /waiting for input/i,
162185
});
163186
await userEvent.click(waitingForInputTab);
187+
188+
// Wait for the table to update after tab switch
189+
await waitFor(async () => {
190+
const table = canvas.getByRole("table");
191+
const tableContent = within(table);
192+
193+
// Active idle task should be visible
194+
expect(tableContent.getByText("Active Idle Task")).toBeInTheDocument();
195+
196+
// Only active idle tasks should be visible in the table
197+
expect(
198+
tableContent.queryByText("Paused Idle Task"),
199+
).not.toBeInTheDocument();
200+
expect(
201+
tableContent.queryByText("Error Idle Task"),
202+
).not.toBeInTheDocument();
203+
});
164204
});
165205
},
166206
};

site/src/pages/TasksPage/TasksPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const TasksPage: FC = () => {
4444
refetchInterval: 10_000,
4545
});
4646
const idleTasks = tasksQuery.data?.filter(
47-
(task) => task.current_state?.state === "idle",
47+
(task) => task.status === "active" && task.current_state?.state === "idle",
4848
);
4949
const displayedTasks =
5050
tab.value === "waiting-for-input" ? idleTasks : tasksQuery.data;

0 commit comments

Comments
 (0)