diff --git a/web/src/app/admin/connector/[ccPairId]/IndexingAttemptsTable.tsx b/web/src/app/admin/connector/[ccPairId]/IndexingAttemptsTable.tsx index 517fb1585..4bb532981 100644 --- a/web/src/app/admin/connector/[ccPairId]/IndexingAttemptsTable.tsx +++ b/web/src/app/admin/connector/[ccPairId]/IndexingAttemptsTable.tsx @@ -9,6 +9,7 @@ import { TableBody, TableCell, Text, + Callout, } from "@tremor/react"; import { CCPairFullInfo, PaginatedIndexAttempts } from "./types"; import { IndexAttemptStatus } from "@/components/Status"; @@ -23,6 +24,7 @@ import Link from "next/link"; import ExceptionTraceModal from "@/components/modals/ExceptionTraceModal"; import { useRouter } from "next/navigation"; import { Tooltip } from "@/components/tooltip/Tooltip"; +import { FiInfo } from "react-icons/fi"; // This is the number of index attempts to display per page const NUM_IN_PAGE = 8; @@ -61,7 +63,9 @@ export function IndexingAttemptsTable({ ccPair }: { ccPair: CCPairFullInfo }) { const batchRetrievalUrlBuilder = useCallback( (batchNum: number) => { - return `${buildCCPairInfoUrl(ccPair.id)}/index-attempts?page=${batchNum}&page_size=${BATCH_SIZE * NUM_IN_PAGE}`; + return `${buildCCPairInfoUrl( + ccPair.id + )}/index-attempts?page=${batchNum}&page_size=${BATCH_SIZE * NUM_IN_PAGE}`; }, [ccPair.id] ); @@ -124,9 +128,9 @@ export function IndexingAttemptsTable({ ccPair }: { ccPair: CCPairFullInfo }) { setIsCurrentPageLoading(false); } - const nextBatchNum = Math.min( - batchNum + 1, - Math.ceil(totalPages / BATCH_SIZE) - 1 + const nextBatchNum = Math.max( + Math.min(batchNum + 1, Math.ceil(totalPages / BATCH_SIZE) - 1), + 0 ); if (!cachedBatches[nextBatchNum]) { fetchBatchData(nextBatchNum); @@ -182,6 +186,26 @@ export function IndexingAttemptsTable({ ccPair }: { ccPair: CCPairFullInfo }) { ); } + // if no indexing attempts have been scheduled yet, let the user know why + if ( + Object.keys(cachedBatches).length === 0 || + Object.values(cachedBatches).every((batch) => + batch.every((page) => page.index_attempts.length === 0) + ) + ) { + return ( + + Index attempts are scheduled in the background, and may take some time + to appear. Try refreshing the page in ~30 seconds! + + ); + } + // This is the index attempt that the user wants to view the trace for const indexAttemptToDisplayTraceFor = currentPageData?.index_attempts?.find( (indexAttempt) => indexAttempt.id === indexAttemptTracePopupId