Skip to content

Commit 10e70f8

Browse files
authored
fix: show task display name in task topbar (#20957) (#20980)
Related to PR: #20957 (cherry picked from commit 21efebe)
1 parent abe66a3 commit 10e70f8

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

site/src/pages/TaskPage/TaskPage.stories.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
MockDeletedWorkspace,
3+
MockDisplayNameTasks,
34
MockFailedWorkspace,
45
MockStartingWorkspace,
56
MockStoppedWorkspace,
@@ -561,6 +562,38 @@ export const WorkspaceStartFailureWithDialog: Story = {
561562
},
562563
};
563564

565+
const longDisplayName =
566+
"Implement comprehensive authentication and authorization system with role-based access control";
567+
export const LongDisplayName: Story = {
568+
parameters: {
569+
queries: [
570+
{
571+
// Sidebar: uses getTasks() which returns an array
572+
key: ["tasks", { owner: MockTask.owner_name }],
573+
data: [
574+
{ ...MockDisplayNameTasks[0], display_name: longDisplayName },
575+
...MockDisplayNameTasks.slice(1),
576+
],
577+
},
578+
{
579+
// TaskTopbar: uses getTask() which returns a single task
580+
key: ["tasks", MockTask.owner_name, MockTask.id],
581+
data: { ...MockDisplayNameTasks[0], display_name: longDisplayName },
582+
},
583+
{
584+
// Workspace data for the task
585+
key: [
586+
"workspace",
587+
MockTask.owner_name,
588+
MockTask.workspace_name,
589+
"settings",
590+
],
591+
data: MockWorkspace,
592+
},
593+
],
594+
},
595+
};
596+
564597
function mockTaskWithWorkspace(
565598
sidebarApp: WorkspaceApp,
566599
activeApp: WorkspaceApp,

site/src/pages/TaskPage/TaskTopbar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type TaskTopbarProps = { task: Task; workspace: Workspace };
2323

2424
export const TaskTopbar: FC<TaskTopbarProps> = ({ task, workspace }) => {
2525
return (
26-
<header className="flex flex-shrink-0 items-center p-3 border-solid border-border border-0 border-b">
26+
<header className="flex flex-shrink-0 items-center gap-2 p-3 border-solid border-border border-0 border-b">
2727
<TooltipProvider>
2828
<Tooltip>
2929
<TooltipTrigger asChild>
@@ -38,7 +38,9 @@ export const TaskTopbar: FC<TaskTopbarProps> = ({ task, workspace }) => {
3838
</Tooltip>
3939
</TooltipProvider>
4040

41-
<h1 className="m-0 pl-2 text-base font-medium truncate">{task.name}</h1>
41+
<h1 className="m-0 pl-2 text-base font-medium max-w-[520px] truncate">
42+
{task.display_name}
43+
</h1>
4244

4345
{task.current_state?.uri && (
4446
<div className="flex items-center gap-2 flex-wrap ml-4">

site/src/testHelpers/entities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4971,8 +4971,8 @@ export const MockAIPromptPresets: TypesGen.Preset[] = [
49714971

49724972
export const MockTask = {
49734973
id: "test-task",
4974-
name: "wild-test-123",
4975-
display_name: "Task wild test",
4974+
name: "perform-some-task-123",
4975+
display_name: "Perform some task",
49764976
organization_id: MockOrganization.id,
49774977
owner_id: MockUserOwner.id,
49784978
owner_name: MockUserOwner.username,

0 commit comments

Comments
 (0)