-
Tasks
-
- {tasksQuery.data ? (
- tasksQuery.data.length > 0 ? (
- tasksQuery.data.map((t) => (
-
- ))
- ) : (
+
+
+
Tasks
+
+ {tasksQuery.data ? (
+ tasksQuery.data.length > 0 ? (
+ tasksQuery.data.map((t) => (
+
+ ))
+ ) : (
+
+ No tasks found
+
+ )
+ ) : tasksQuery.error ? (
- No tasks found
+ {getErrorMessage(tasksQuery.error, "Failed to load tasks")}
- )
- ) : tasksQuery.error ? (
-
- {getErrorMessage(tasksQuery.error, "Failed to load tasks")}
-
- ) : (
-
- {Array.from({ length: 5 }).map((_, index) => (
-
- ))}
-
- )}
+ ) : (
+
+ {Array.from({ length: 5 }).map((_, index) => (
+
+ ))}
+
+ )}
+
-
+
);
};
diff --git a/site/src/pages/TaskPage/TaskPage.stories.tsx b/site/src/pages/TaskPage/TaskPage.stories.tsx
index 7c165f82a9..d711c7aecc 100644
--- a/site/src/pages/TaskPage/TaskPage.stories.tsx
+++ b/site/src/pages/TaskPage/TaskPage.stories.tsx
@@ -2,6 +2,8 @@ import {
MockFailedWorkspace,
MockStartingWorkspace,
MockStoppedWorkspace,
+ MockTasks,
+ MockUserOwner,
MockWorkspace,
MockWorkspaceAgentLogSource,
MockWorkspaceAgentReady,
@@ -12,6 +14,7 @@ import {
mockApiError,
} from "testHelpers/entities";
import {
+ withAuthProvider,
withGlobalSnackbar,
withProxyProvider,
withWebSocket,
@@ -30,9 +33,21 @@ import TaskPage, { data, WorkspaceDoesNotHaveAITaskError } from "./TaskPage";
const meta: Meta
= {
title: "pages/TaskPage",
component: TaskPage,
- decorators: [withProxyProvider()],
+ decorators: [withProxyProvider(), withAuthProvider],
+ beforeEach: () => {
+ spyOn(API.experimental, "getTasks").mockResolvedValue(MockTasks);
+ },
parameters: {
layout: "fullscreen",
+ user: MockUserOwner,
+ reactRouter: reactRouterParameters({
+ location: {
+ pathParams: {
+ workspace: MockTasks[0].workspace.name,
+ },
+ },
+ routing: { path: "/tasks/:workspace" },
+ }),
},
};
diff --git a/site/src/pages/TaskPage/TaskPage.tsx b/site/src/pages/TaskPage/TaskPage.tsx
index f8556391da..8b8934a212 100644
--- a/site/src/pages/TaskPage/TaskPage.tsx
+++ b/site/src/pages/TaskPage/TaskPage.tsx
@@ -17,10 +17,17 @@ import { useWorkspaceBuildLogs } from "hooks/useWorkspaceBuildLogs";
import { ArrowLeftIcon, RotateCcwIcon } from "lucide-react";
import { AgentLogs } from "modules/resources/AgentLogs/AgentLogs";
import { useAgentLogs } from "modules/resources/useAgentLogs";
+import { TasksSidebar } from "modules/tasks/TasksSidebar/TasksSidebar";
import { AI_PROMPT_PARAMETER_NAME, type Task } from "modules/tasks/tasks";
import { WorkspaceErrorDialog } from "modules/workspaces/ErrorDialog/WorkspaceErrorDialog";
import { WorkspaceBuildLogs } from "modules/workspaces/WorkspaceBuildLogs/WorkspaceBuildLogs";
-import { type FC, type ReactNode, useLayoutEffect, useRef } from "react";
+import {
+ type FC,
+ type PropsWithChildren,
+ type ReactNode,
+ useLayoutEffect,
+ useRef,
+} from "react";
import { Helmet } from "react-helmet-async";
import { useMutation, useQuery, useQueryClient } from "react-query";
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
@@ -35,6 +42,15 @@ import { TaskApps } from "./TaskApps";
import { TaskSidebar } from "./TaskSidebar";
import { TaskTopbar } from "./TaskTopbar";
+const TaskPageLayout: FC = ({ children }) => {
+ return (
+
+ );
+};
+
const TaskPage = () => {
const { workspace: workspaceName, username } = useParams() as {
workspace: string;
@@ -54,7 +70,7 @@ const TaskPage = () => {
if (error) {
return (
- <>
+
{pageTitle("Error loading task")}
@@ -81,18 +97,18 @@ const TaskPage = () => {