Skip to content

Commit edcee32

Browse files
authored
fix: always show View Task for Tasks workspaces (#21970)
Closes [`internal#1292`](coder/internal#1292) This pull-request reduces our nesting of the `View Task` button. Its easier to jump to tasks now as we don't have to wait for the app status to exist.
1 parent 2549fc7 commit edcee32

2 files changed

Lines changed: 18 additions & 20 deletions

File tree

‎site/src/modules/resources/AgentRow.tsx‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import type {
1010
} from "api/typesGenerated";
1111
import { Button } from "components/Button/Button";
1212
import { DropdownArrow } from "components/DropdownArrow/DropdownArrow";
13-
import { Stack } from "components/Stack/Stack";
1413
import { useProxy } from "contexts/ProxyContext";
14+
import { SquareCheckBigIcon } from "lucide-react";
1515
import { useFeatureVisibility } from "modules/dashboard/useFeatureVisibility";
1616
import { AppStatuses } from "pages/WorkspacePage/AppStatuses";
1717
import {
@@ -22,6 +22,7 @@ import {
2222
useRef,
2323
useState,
2424
} from "react";
25+
import { Link as RouterLink } from "react-router";
2526
import AutoSizer from "react-virtualized-auto-sizer";
2627
import type { FixedSizeList as List, ListOnScrollProps } from "react-window";
2728
import { AgentApps, organizeAgentApps } from "./AgentApps/AgentApps";
@@ -144,10 +145,9 @@ export const AgentRow: FC<AgentRowProps> = ({
144145
hasSubdomainApps && !proxy.proxy?.wildcard_hostname;
145146

146147
return (
147-
<Stack
148+
<div
148149
key={agent.id}
149-
direction="column"
150-
spacing={0}
150+
className="flex flex-col max-w-full"
151151
css={[
152152
styles.agentRow,
153153
styles[`agentRow-${agent.status}`],
@@ -215,6 +215,17 @@ export const AgentRow: FC<AgentRowProps> = ({
215215
</section>
216216
)}
217217

218+
{workspace.task_id && (
219+
<Button asChild size="sm" variant="outline" className="w-fit">
220+
<RouterLink
221+
to={`/tasks/${workspace.owner_name}/${workspace.task_id}`}
222+
>
223+
<SquareCheckBigIcon />
224+
View task
225+
</RouterLink>
226+
</Button>
227+
)}
228+
218229
{shouldShowWildcardWarning && <WildcardHostnameWarning />}
219230

220231
{shouldDisplayAppsSection && (
@@ -325,7 +336,7 @@ export const AgentRow: FC<AgentRowProps> = ({
325336
</AutoSizer>
326337
</Collapse>
327338

328-
<Stack css={{ padding: "12px 16px" }} direction="row" spacing={1}>
339+
<div className="flex flex-row gap-2 px-4 py-3">
329340
<Button
330341
size="sm"
331342
variant="subtle"
@@ -336,10 +347,10 @@ export const AgentRow: FC<AgentRowProps> = ({
336347
</Button>
337348
<Divider orientation="vertical" variant="middle" flexItem />
338349
<DownloadAgentLogsButton agent={agent} />
339-
</Stack>
350+
</div>
340351
</section>
341352
)}
342-
</Stack>
353+
</div>
343354
);
344355
};
345356

‎site/src/pages/WorkspacePage/AppStatuses.tsx‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ import {
1919
ExternalLinkIcon,
2020
FileIcon,
2121
LayoutGridIcon,
22-
SquareCheckBigIcon,
2322
} from "lucide-react";
2423
import { AppStatusStateIcon } from "modules/apps/AppStatusStateIcon";
2524
import { useAppLink } from "modules/apps/useAppLink";
2625
import { type FC, useState } from "react";
27-
import { Link as RouterLink } from "react-router";
2826
import { timeFrom } from "utils/time";
2927
import { truncateURI } from "utils/uri";
3028

@@ -114,17 +112,6 @@ export const AppStatuses: FC<AppStatusesProps> = ({
114112
</Button>
115113
))}
116114

117-
{workspace.task_id && (
118-
<Button asChild size="sm" variant="outline">
119-
<RouterLink
120-
to={`/tasks/${workspace.owner_name}/${workspace.task_id}`}
121-
>
122-
<SquareCheckBigIcon />
123-
View task
124-
</RouterLink>
125-
</Button>
126-
)}
127-
128115
<Tooltip>
129116
<TooltipTrigger asChild>
130117
<Button

0 commit comments

Comments
 (0)