google drive step3 indexing not starting bug fix

This commit is contained in:
meherhendi 2023-10-19 16:06:53 +01:00 committed by Chris Weaver
parent 947d4d0a2e
commit 4990aacc0d
2 changed files with 24 additions and 3 deletions

View File

@ -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<User>(
"/api/manage/me",
fetcher
);
const { popup, setPopup } = usePopup();
if (
(!appCredentialData && isAppCredentialLoading) ||
(!serviceAccountKeyData && isServiceAccountKeyLoading) ||
(!connectorIndexingStatuses && isConnectorIndexingStatusesLoading) ||
(!credentialsData && isCredentialsLoading)
(!credentialsData && isCredentialsLoading) ||
(!currentUserData && iscurrentUserLoading)
) {
return (
<div className="mx-auto">
@ -317,12 +329,21 @@ const Main = () => {
);
}
if (iscurrentUserError || !credentialsData) {
return (
<div className="mx-auto">
<div className="text-red-500">
Error loading user profile. Contact an administrator.
</div>
</div>
);
}
const googleDrivePublicCredential:
| Credential<GoogleDriveCredentialJson>
| undefined = credentialsData.find(
(credential) =>
credential.credential_json?.google_drive_tokens &&
credential.user_id === null
credential.user_id === currentUserData?.id
);
const googleDriveServiceAccountCredential:
| Credential<GoogleDriveServiceAccountCredentialJson>

View File

@ -164,7 +164,7 @@ export interface CredentialBase<T> {
export interface Credential<T> extends CredentialBase<T> {
id: number;
user_id: number | null;
user_id: string | null;
time_created: string;
time_updated: string;
}