mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-08 03:48:14 +02:00
Handle bug with initial connector page display (#2727)
* Handle bug with initial connector page display * Casing consistency
This commit is contained in:
parent
672f5cc5ce
commit
78e7710f17
@ -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 (
|
||||
<Callout
|
||||
className="mt-4"
|
||||
title="No indexing attempts scheduled yet"
|
||||
icon={FiInfo}
|
||||
color="blue"
|
||||
>
|
||||
Index attempts are scheduled in the background, and may take some time
|
||||
to appear. Try refreshing the page in ~30 seconds!
|
||||
</Callout>
|
||||
);
|
||||
}
|
||||
|
||||
// This is the index attempt that the user wants to view the trace for
|
||||
const indexAttemptToDisplayTraceFor = currentPageData?.index_attempts?.find(
|
||||
(indexAttempt) => indexAttempt.id === indexAttemptTracePopupId
|
||||
|
Loading…
x
Reference in New Issue
Block a user