MCPcopy Index your code
hub / github.com/modelcontextprotocol/inspector / TasksTab

Function TasksTab

client/src/components/TasksTab.tsx:36–227  ·  view source on GitHub ↗
({
  tasks,
  listTasks,
  clearTasks,
  cancelTask,
  selectedTask,
  setSelectedTask,
  error,
  nextCursor,
}: {
  tasks: Task[];
  listTasks: () => void;
  clearTasks: () => void;
  cancelTask: (taskId: string) => Promise<void>;
  selectedTask: Task | null;
  setSelectedTask: (task: Task | null) => void;
  error: string | null;
  nextCursor?: string;
})

Source from the content-addressed store, hash-verified

34};
35
36const TasksTab = ({
37 tasks,
38 listTasks,
39 clearTasks,
40 cancelTask,
41 selectedTask,
42 setSelectedTask,
43 error,
44 nextCursor,
45}: {
46 tasks: Task[];
47 listTasks: () => void;
48 clearTasks: () => void;
49 cancelTask: (taskId: string) => Promise<void>;
50 selectedTask: Task | null;
51 setSelectedTask: (task: Task | null) => void;
52 error: string | null;
53 nextCursor?: string;
54}) => {
55 const [isCancelling, setIsCancelling] = useState<string | null>(null);
56
57 const displayedTask = selectedTask
58 ? tasks.find((t) => t.taskId === selectedTask.taskId) || selectedTask
59 : null;
60
61 const handleCancel = async (taskId: string) => {
62 setIsCancelling(taskId);
63 try {
64 await cancelTask(taskId);
65 } finally {
66 setIsCancelling(null);
67 }
68 };
69
70 return (
71 <TabsContent value="tasks" className="flex-1 overflow-hidden p-0 m-0">
72 <div className="flex h-full overflow-hidden p-4 gap-4">
73 <div className="w-1/3">
74 <ListPane
75 title="Tasks"
76 items={tasks}
77 setSelectedItem={setSelectedTask}
78 listItems={listTasks}
79 clearItems={clearTasks}
80 buttonText={nextCursor ? "List More Tasks" : "List Tasks"}
81 isButtonDisabled={!nextCursor && tasks.length > 0}
82 renderItem={(task) => (
83 <div className="flex items-center gap-2 overflow-hidden w-full">
84 <TaskStatusIcon status={task.status} />
85 <div className="flex flex-col overflow-hidden">
86 <span className="truncate font-medium">{task.taskId}</span>
87 <span className="truncate text-xs text-muted-foreground">
88 {task.status} -{" "}
89 {new Date(task.lastUpdatedAt).toLocaleString()}
90 </span>
91 </div>
92 </div>
93 )}

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
handleCancelFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…