From 4990aacc0d7b78c935dd14acc181e6a1765bbbb5 Mon Sep 17 00:00:00 2001 From: meherhendi Date: Thu, 19 Oct 2023 16:06:53 +0100 Subject: [PATCH] google drive step3 indexing not starting bug fix --- .../admin/connectors/google-drive/page.tsx | 25 +++++++++++++++++-- web/src/lib/types.ts | 2 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/web/src/app/admin/connectors/google-drive/page.tsx b/web/src/app/admin/connectors/google-drive/page.tsx index cb2af82df..b375037a9 100644 --- a/web/src/app/admin/connectors/google-drive/page.tsx +++ b/web/src/app/admin/connectors/google-drive/page.tsx @@ -13,6 +13,7 @@ import { GoogleDriveConfig, GoogleDriveCredentialJson, GoogleDriveServiceAccountCredentialJson, + User, } from "@/lib/types"; import { linkCredential } from "@/lib/credential"; import { ConnectorForm } from "@/components/admin/connectors/ConnectorForm"; @@ -276,13 +277,24 @@ const Main = () => { refreshCredentials, } = usePublicCredentials(); + const { + data: currentUserData, + isLoading: iscurrentUserLoading, + error: iscurrentUserError, + } = useSWR( + "/api/manage/me", + fetcher + ); + + const { popup, setPopup } = usePopup(); if ( (!appCredentialData && isAppCredentialLoading) || (!serviceAccountKeyData && isServiceAccountKeyLoading) || (!connectorIndexingStatuses && isConnectorIndexingStatusesLoading) || - (!credentialsData && isCredentialsLoading) + (!credentialsData && isCredentialsLoading) || + (!currentUserData && iscurrentUserLoading) ) { return (
@@ -317,12 +329,21 @@ const Main = () => { ); } + if (iscurrentUserError || !credentialsData) { + return ( +
+
+ Error loading user profile. Contact an administrator. +
+
+ ); + } const googleDrivePublicCredential: | Credential | undefined = credentialsData.find( (credential) => credential.credential_json?.google_drive_tokens && - credential.user_id === null + credential.user_id === currentUserData?.id ); const googleDriveServiceAccountCredential: | Credential diff --git a/web/src/lib/types.ts b/web/src/lib/types.ts index 7e3afed7f..a4f85ebad 100644 --- a/web/src/lib/types.ts +++ b/web/src/lib/types.ts @@ -164,7 +164,7 @@ export interface CredentialBase { export interface Credential extends CredentialBase { id: number; - user_id: number | null; + user_id: string | null; time_created: string; time_updated: string; }