@@ -27,13 +27,13 @@ import {
2727import LoadingPage from "@/components/loading" ;
2828
2929import { QuerySummary , useQueries } from "@/hooks/use-queries" ;
30- import { toHumanReadableDate } from "@/lib/utils" ;
31- import Status from "./status" ;
30+ import { toHumanReadableDate , getEngineName } from "@/lib/utils" ;
31+ import Status , { Duration } from "./status" ;
3232import Link from "next/link" ;
3333import { Empty , EmptyContent , EmptyDescription , EmptyHeader , EmptyMedia , EmptyTitle } from "@/components/ui/empty" ;
34- import { ClipboardIcon , Database } from "lucide-react" ;
34+ import { ClipboardIcon , Database , ExternalLinkIcon } from "lucide-react" ;
3535import { Button } from "@/components/ui/button" ;
36- import { Tooltip , TooltipContent , TooltipTrigger } from "@/components/ui/tooltip" ;
36+ import { Tooltip , TooltipContent , TooltipTrigger , TooltipProvider } from "@/components/ui/tooltip" ;
3737import { dashboardUrl } from "@/components/server-provider" ;
3838import { TooltipArrow } from "@radix-ui/react-tooltip" ;
3939
@@ -42,7 +42,7 @@ const STATUS: string = "state";
4242// Define status priority for sorting (lower number = higher priority)
4343const statusPriority : Record < string , number > = {
4444 Pending : 1 ,
45- Planning : 2 ,
45+ Optimizing : 2 ,
4646 Setup : 3 ,
4747 Executing : 4 ,
4848 Finalizing : 5 ,
@@ -63,18 +63,87 @@ const columnHelper = createColumnHelper<QuerySummary>();
6363const columns = [
6464 columnHelper . accessor ( "id" , {
6565 header : "Name" ,
66- cell : info => info . getValue ( ) ,
66+ cell : info => {
67+ const id = info . getValue ( ) ;
68+ return (
69+ < TooltipProvider >
70+ < Tooltip >
71+ < TooltipTrigger asChild >
72+ < div className = "max-w-[150px] truncate" > { id } </ div >
73+ </ TooltipTrigger >
74+ < TooltipContent >
75+ < p > { id } </ p >
76+ </ TooltipContent >
77+ </ Tooltip >
78+ </ TooltipProvider >
79+ ) ;
80+ } ,
6781 sortingFn : "alphanumeric" ,
6882 } ) ,
6983 columnHelper . accessor ( "status" , {
7084 header : "Status" ,
71- cell : info => < Status state = { info . getValue ( ) } /> ,
85+ cell : info => < Status state = { info . getValue ( ) } showDuration = { false } /> ,
7286 sortingFn : statusSortingFn ,
7387 } ) ,
88+ columnHelper . display ( {
89+ id : "duration" ,
90+ header : "Duration" ,
91+ cell : info => < Duration state = { info . row . original . status } /> ,
92+ } ) ,
93+ columnHelper . accessor ( "entrypoint" , {
94+ header : "Entrypoint" ,
95+ cell : info => {
96+ const entry = info . getValue ( ) ;
97+ if ( ! entry ) return "-" ;
98+ return (
99+ < TooltipProvider >
100+ < Tooltip >
101+ < TooltipTrigger asChild >
102+ < div className = "max-w-[200px] truncate" > { entry } </ div >
103+ </ TooltipTrigger >
104+ < TooltipContent className = "max-w-none text-sm" >
105+ < p className = "break-all font-mono" > { entry } </ p >
106+ </ TooltipContent >
107+ </ Tooltip >
108+ </ TooltipProvider >
109+ ) ;
110+ } ,
111+ sortingFn : "alphanumeric" ,
112+ } ) ,
74113 columnHelper . accessor ( "start_sec" , {
75114 header : "Start Time" ,
76115 cell : info => toHumanReadableDate ( info . getValue ( ) ) ,
77116 sortingFn : "basic" ,
117+ } ) ,
118+ columnHelper . accessor ( "runner" , {
119+ header : "Engine" ,
120+ cell : info => getEngineName ( info . getValue ( ) ) ,
121+ sortingFn : "alphanumeric" ,
122+ } ) ,
123+ // @ts -ignore
124+ columnHelper . accessor ( "ray_dashboard_url" , {
125+ header : "Ray UI" ,
126+ cell : info => {
127+ let url = info . getValue ( ) ;
128+ if ( url ) {
129+ if ( ! url . startsWith ( "http://" ) && ! url . startsWith ( "https://" ) ) {
130+ url = "http://" + url ;
131+ }
132+ return (
133+ < a
134+ href = { url }
135+ target = "_blank"
136+ rel = "noopener noreferrer"
137+ className = "flex items-center gap-1 text-blue-500 hover:underline"
138+ onClick = { ( e ) => e . stopPropagation ( ) }
139+ >
140+ Open Ray UI < ExternalLinkIcon className = "h-4 w-4" />
141+ </ a >
142+ ) ;
143+ }
144+ return null ;
145+ } ,
146+ enableSorting : false ,
78147 } )
79148] ;
80149
@@ -184,6 +253,7 @@ export default function QueryList() {
184253 columns,
185254 getCoreRowModel : getCoreRowModel ( ) ,
186255 getSortedRowModel : getSortedRowModel ( ) ,
256+ columnResizeMode : "onChange" ,
187257 initialState : {
188258 sorting : [
189259 { id : "status" , desc : false } ,
@@ -193,7 +263,7 @@ export default function QueryList() {
193263 } ) ;
194264
195265 const spacing = ( obj : any ) =>
196- `px-[20px] ${ obj . column . columnDef . accessorKey === STATUS ? "w-[60%]" : undefined } ` ;
266+ `px-[20px]` ;
197267
198268 const handleRowClick = ( queryId : string ) => {
199269 router . push ( `/query?id=${ queryId } ` ) ;
@@ -208,23 +278,31 @@ export default function QueryList() {
208278 }
209279
210280 return (
211- < div className = "space-y-4 max-w-6xl mx-auto" >
281+ < div className = "space-y-4 max-w-full px-6 mx-auto" >
212282 < Header />
213283
214- < div className = "border" >
284+ < div className = "border rounded-md overflow-hidden " >
215285 < Table >
216- < TableHeader >
286+ < TableHeader className = "bg-white" >
217287 { table . getHeaderGroups ( ) . map ( headerGroup => (
218- < TableRow key = { headerGroup . id } className = "" >
219- { headerGroup . headers . map ( header => (
288+ < TableRow key = { headerGroup . id } className = "hover:bg-transparent border-b border-zinc-200 " >
289+ { headerGroup . headers . map ( ( header , index ) => (
220290 < TableHead
221291 key = { header . id }
222- className = { `text-xs font-mono ${ spacing ( header ) } ` }
292+ className = { `relative text-xs font-mono font-bold text-black ${ spacing ( header ) } ${ index !== headerGroup . headers . length - 1 ? "border-r border-zinc-200" : "" } ` }
293+ style = { { width : header . getSize ( ) } }
223294 >
224295 { flexRender (
225296 header . column . columnDef . header ,
226297 header . getContext ( )
227298 ) }
299+ < div
300+ onMouseDown = { header . getResizeHandler ( ) }
301+ onTouchStart = { header . getResizeHandler ( ) }
302+ className = { `absolute right-0 top-0 h-full w-1 cursor-col-resize touch-none select-none bg-border/50 hover:bg-primary/50 ${
303+ header . column . getIsResizing ( ) ? "bg-primary" : ""
304+ } `}
305+ />
228306 </ TableHead >
229307 ) ) }
230308 </ TableRow >
@@ -238,17 +316,16 @@ export default function QueryList() {
238316 className = "hover:bg-zinc-800 transition-colors duration-50 cursor-pointer"
239317 onClick = { ( ) => handleRowClick ( row . original . id ) }
240318 >
241- { row . getAllCells ( ) . map ( cell => (
319+ { row . getAllCells ( ) . map ( ( cell , index ) => (
242320 < TableCell
243321 key = { cell . id }
244- className = { `py-[15px] ${ spacing ( cell ) } ` }
322+ className = { `py-[15px] ${ spacing ( cell ) } ${ index !== row . getAllCells ( ) . length - 1 ? "border-r border-zinc-800" : "" } ` }
323+ style = { { width : cell . column . getSize ( ) } }
245324 >
246- < div className = "truncate" >
247- { flexRender (
248- cell . column . columnDef . cell ,
249- cell . getContext ( )
250- ) }
251- </ div >
325+ { flexRender (
326+ cell . column . columnDef . cell ,
327+ cell . getContext ( )
328+ ) }
252329 </ TableCell >
253330 ) ) }
254331 </ TableRow >
0 commit comments