Skip to content

Commit

Permalink
Fix: fix ui to render error from data source properly
Browse files Browse the repository at this point in the history
Signed-off-by: Daishan Peng <[email protected]>
  • Loading branch information
StrongMonkey committed Oct 24, 2024
1 parent dce8445 commit 60be75c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ const RemoteKnowledgeSourceStatus: React.FC<
/>
)}
<span
className={`text-sm mr-2 ${source?.error ? "text-destructive" : "text-gray-500"}`}
className={`text-sm mr-2 ${
!source.runID && source.error
? "text-destructive"
: "text-gray-500"
}`}
>
{source?.error || source?.status || "Syncing Files..."}
{(!source?.runID && source?.error) ||
source?.status ||
"Syncing Files..."}
</span>
{!source.error && <LoadingSpinner className="w-4 h-4" />}
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/admin/app/components/knowledge/notion/NotionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const NotionModal: FC<NotionModalProps> = ({
ingestionError={ingestionError}
/>
)}
{notionSource?.runID && (
{(notionSource?.runID || notionSource?.error) && (
<RemoteKnowledgeSourceStatus source={notionSource!} />
)}
<div className="mt-4 flex justify-between">
Expand Down
9 changes: 5 additions & 4 deletions ui/admin/app/components/knowledge/onedrive/OneDriveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,11 @@ export const OnedriveModal: FC<OnedriveModalProps> = ({
ingestionError={ingestionError}
/>
)}
{onedriveSource?.state?.onedriveState?.links &&
onedriveSource?.runID && (
<RemoteKnowledgeSourceStatus source={onedriveSource} />
)}
{((onedriveSource?.state?.onedriveState?.links &&
onedriveSource?.runID) ||
onedriveSource?.error) && (
<RemoteKnowledgeSourceStatus source={onedriveSource} />
)}

<div className="mt-4 flex justify-between">
<Button
Expand Down
2 changes: 1 addition & 1 deletion ui/admin/app/components/knowledge/website/WebsiteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export const WebsiteModal: FC<WebsiteModalProps> = ({
ingestionError={ingestionError}
/>
)}
{websiteSource?.runID && (
{(websiteSource?.runID || websiteSource?.error) && (
<RemoteKnowledgeSourceStatus source={websiteSource!} />
)}
<div className="mt-4 flex justify-between">
Expand Down

0 comments on commit 60be75c

Please sign in to comment.