Skip to content

Commit 702caac

Browse files
committed
Added nice queue cell rendering
1 parent 0c6850f commit 702caac

File tree

4 files changed

+56
-29
lines changed

4 files changed

+56
-29
lines changed

apps/webapp/app/components/code/TSQLResultsTable.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { SimpleTooltip } from "../primitives/Tooltip";
2727
import { InformationCircleIcon } from "@heroicons/react/20/solid";
2828
import { useOrganization } from "~/hooks/useOrganizations";
2929
import { useProject } from "~/hooks/useProject";
30+
import { QueueName } from "../runs/v3/QueueName";
3031

3132
/**
3233
* Check if a ClickHouse type is a DateTime type
@@ -168,6 +169,13 @@ function CellValue({
168169
}
169170
return <span>{String(value)}</span>;
170171
}
172+
case "queue": {
173+
if (typeof value === "string") {
174+
const type = value.startsWith("task/") ? "task" : "custom";
175+
return <QueueName type={type} name={value.replace("task/", "")} />;
176+
}
177+
return <span>{String(value)}</span>;
178+
}
171179
}
172180
}
173181

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { TaskIconSmall } from "~/assets/icons/TaskIcon";
2+
import { SimpleTooltip } from "~/components/primitives/Tooltip";
3+
import { cn } from "~/utils/cn";
4+
import { RectangleStackIcon } from "@heroicons/react/20/solid";
5+
6+
export function QueueName({
7+
name,
8+
type,
9+
paused,
10+
className,
11+
}: {
12+
name: string;
13+
type: "task" | "custom";
14+
paused?: boolean;
15+
className?: string;
16+
}) {
17+
return (
18+
<span className={cn("flex items-center gap-1", className)}>
19+
{type === "task" ? (
20+
<SimpleTooltip
21+
button={
22+
<TaskIconSmall
23+
className={cn("size-[1.125rem] text-blue-500", paused && "opacity-50")}
24+
/>
25+
}
26+
content={`This queue was automatically created from your "${name}" task`}
27+
/>
28+
) : (
29+
<SimpleTooltip
30+
button={
31+
<RectangleStackIcon
32+
className={cn("size-[1.125rem] text-purple-500", paused && "opacity-50")}
33+
/>
34+
}
35+
content={`This is a custom queue you added in your code.`}
36+
/>
37+
)}
38+
<span className={paused ? "opacity-50" : undefined}>{name}</span>
39+
</span>
40+
);
41+
}

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues/route.tsx

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ import { PauseEnvironmentService } from "~/v3/services/pauseEnvironment.server";
8080
import { PauseQueueService } from "~/v3/services/pauseQueue.server";
8181
import { useCurrentPlan } from "../_app.orgs.$organizationSlug/route";
8282
import { ConcurrencyIcon } from "~/assets/icons/ConcurrencyIcon";
83+
import { QueueName } from "~/components/runs/v3/QueueName";
8384

8485
const SearchParamsSchema = z.object({
8586
query: z.string().optional(),
@@ -516,34 +517,7 @@ export default function Page() {
516517
<TableRow key={queue.name}>
517518
<TableCell>
518519
<span className="flex items-center gap-2">
519-
{queue.type === "task" ? (
520-
<SimpleTooltip
521-
button={
522-
<TaskIconSmall
523-
className={cn(
524-
"size-[1.125rem] text-blue-500",
525-
queue.paused && "opacity-50"
526-
)}
527-
/>
528-
}
529-
content={`This queue was automatically created from your "${queue.name}" task`}
530-
/>
531-
) : (
532-
<SimpleTooltip
533-
button={
534-
<RectangleStackIcon
535-
className={cn(
536-
"size-[1.125rem] text-purple-500",
537-
queue.paused && "opacity-50"
538-
)}
539-
/>
540-
}
541-
content={`This is a custom queue you added in your code.`}
542-
/>
543-
)}
544-
<span className={queue.paused ? "opacity-50" : undefined}>
545-
{queue.name}
546-
</span>
520+
<QueueName {...queue} />
547521
{queue.concurrency?.overriddenAt ? (
548522
<SimpleTooltip
549523
button={

apps/webapp/app/v3/querySchemas.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ export const runsSchema: TableSchema = {
9696
},
9797
queue: {
9898
name: "queue",
99-
...column("String", { description: "Queue name", example: "task/my-background-task" }),
99+
...column("String", {
100+
description: "Queue name",
101+
example: "task/my-background-task",
102+
customRenderType: "queue",
103+
}),
100104
},
101105
schedule_id: {
102106
name: "schedule_id",

0 commit comments

Comments
 (0)