@@ -14,7 +14,7 @@ import { Input } from "@/components/ui/input"
1414import { Select , SelectContent , SelectItem , SelectTrigger , SelectValue } from "@/components/ui/select"
1515import { Table , TableBody , TableCell , TableHead , TableHeader , TableRow } from "@/components/ui/table"
1616import { SINGLE_TENANT_ORG_DOMAIN } from "@/lib/constants"
17- import { getCodeHostInfoForRepo , getRepoImageSrc } from "@/lib/utils"
17+ import { CodeHostType , getCodeHostCommitUrl , getCodeHostInfoForRepo , getFormattedDate , getRepoImageSrc } from "@/lib/utils"
1818import {
1919 type ColumnDef ,
2020 type ColumnFiltersState ,
@@ -35,6 +35,7 @@ import { useMemo, useState } from "react"
3535import { getBrowsePath } from "../../browse/hooks/utils"
3636import { useRouter } from "next/navigation"
3737import { useToast } from "@/components/hooks/use-toast" ;
38+ import { DisplayDate } from "../../components/DisplayDate"
3839
3940// @see : https://v0.app/chat/repo-indexing-status-uhjdDim8OUS
4041
@@ -49,6 +50,7 @@ export type Repo = {
4950 webUrl : string | null
5051 codeHostType : string
5152 imageUrl : string | null
53+ indexedCommitHash : string | null
5254 latestJobStatus : "PENDING" | "IN_PROGRESS" | "COMPLETED" | "FAILED" | null
5355}
5456
@@ -81,13 +83,7 @@ const getStatusBadge = (status: Repo["latestJobStatus"]) => {
8183
8284const formatDate = ( date : Date | null ) => {
8385 if ( ! date ) return "Never"
84- return new Intl . DateTimeFormat ( "en-US" , {
85- month : "short" ,
86- day : "numeric" ,
87- year : "numeric" ,
88- hour : "2-digit" ,
89- minute : "2-digit" ,
90- } ) . format ( date )
86+ return getFormattedDate ( date ) ;
9187}
9288
9389export const columns : ColumnDef < Repo > [ ] = [
@@ -132,20 +128,64 @@ export const columns: ColumnDef<Repo>[] = [
132128 } ,
133129 {
134130 accessorKey : "latestJobStatus" ,
135- header : "Status " ,
131+ header : "Lastest status " ,
136132 cell : ( { row } ) => getStatusBadge ( row . getValue ( "latestJobStatus" ) ) ,
137133 } ,
138134 {
139135 accessorKey : "indexedAt" ,
140136 header : ( { column } ) => {
141137 return (
142- < Button variant = "ghost" onClick = { ( ) => column . toggleSorting ( column . getIsSorted ( ) === "asc" ) } >
143- Last Indexed
138+ < Button
139+ variant = "ghost"
140+ onClick = { ( ) => column . toggleSorting ( column . getIsSorted ( ) === "asc" ) }
141+ >
142+ Last synced
144143 < ArrowUpDown className = "ml-2 h-4 w-4" />
145144 </ Button >
146145 )
147146 } ,
148- cell : ( { row } ) => formatDate ( row . getValue ( "indexedAt" ) ) ,
147+ cell : ( { row } ) => {
148+ const indexedAt = row . getValue ( "indexedAt" ) as Date | null ;
149+ if ( ! indexedAt ) {
150+ return "-" ;
151+ }
152+
153+ return (
154+ < DisplayDate date = { indexedAt } className = "ml-3" />
155+ )
156+ }
157+ } ,
158+ {
159+ accessorKey : "indexedCommitHash" ,
160+ header : "Last commit" ,
161+ cell : ( { row } ) => {
162+ const hash = row . getValue ( "indexedCommitHash" ) as string | null ;
163+ if ( ! hash ) {
164+ return "-" ;
165+ }
166+
167+ const smallHash = hash . slice ( 0 , 7 ) ;
168+ const repo = row . original ;
169+ const codeHostType = repo . codeHostType as CodeHostType ;
170+ const webUrl = repo . webUrl ;
171+
172+ const commitUrl = getCodeHostCommitUrl ( {
173+ webUrl,
174+ codeHostType,
175+ commitHash : hash ,
176+ } ) ;
177+
178+ if ( ! commitUrl ) {
179+ return < span className = "font-mono text-sm" > { smallHash } </ span >
180+ }
181+
182+ return < Link
183+ href = { commitUrl }
184+ className = "font-mono text-sm text-link hover:underline"
185+ >
186+ { smallHash }
187+ </ Link >
188+ } ,
149189 } ,
150190 {
151191 id : "actions" ,
0 commit comments