mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-19 03:58:30 +02:00
Disallow Google Drive credential delete if connectors exist
This commit is contained in:
@@ -19,5 +19,5 @@ pnpm dev
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
*Note:* if you are having problems accessing the ^, try setting the `WEB_DOMAIN` env variable to
|
||||
_Note:_ if you are having problems accessing the ^, try setting the `WEB_DOMAIN` env variable to
|
||||
`http://127.0.0.1:3000` and accessing it there.
|
||||
|
@@ -272,6 +272,7 @@ interface DriveCredentialSectionProps {
|
||||
appCredentialData?: { client_id: string };
|
||||
setPopup: (popupSpec: PopupSpec | null) => void;
|
||||
refreshCredentials: () => void;
|
||||
connectorExists: boolean;
|
||||
}
|
||||
|
||||
export const DriveOAuthSection = ({
|
||||
@@ -281,6 +282,7 @@ export const DriveOAuthSection = ({
|
||||
appCredentialData,
|
||||
setPopup,
|
||||
refreshCredentials,
|
||||
connectorExists,
|
||||
}: DriveCredentialSectionProps) => {
|
||||
const router = useRouter();
|
||||
|
||||
@@ -294,6 +296,14 @@ export const DriveOAuthSection = ({
|
||||
</p>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
if (connectorExists) {
|
||||
setPopup({
|
||||
message:
|
||||
"Cannot revoke access to Google Drive while any connector is still setup. Please delete all connectors, then try again.",
|
||||
type: "error",
|
||||
});
|
||||
return;
|
||||
}
|
||||
await adminDeleteCredential(existingCredential.id);
|
||||
setPopup({
|
||||
message: "Successfully revoked access to Google Drive!",
|
||||
|
@@ -377,6 +377,7 @@ const Main = () => {
|
||||
}
|
||||
appCredentialData={appCredentialData}
|
||||
serviceAccountKeyData={serviceAccountKeyData}
|
||||
connectorExists={googleDriveConnectorIndexingStatuses.length > 0}
|
||||
/>
|
||||
|
||||
<Title className="mb-2 mt-6 ml-auto mr-auto">
|
||||
|
Reference in New Issue
Block a user