mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-19 12:03:54 +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.
|
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.
|
`http://127.0.0.1:3000` and accessing it there.
|
||||||
|
@@ -272,6 +272,7 @@ interface DriveCredentialSectionProps {
|
|||||||
appCredentialData?: { client_id: string };
|
appCredentialData?: { client_id: string };
|
||||||
setPopup: (popupSpec: PopupSpec | null) => void;
|
setPopup: (popupSpec: PopupSpec | null) => void;
|
||||||
refreshCredentials: () => void;
|
refreshCredentials: () => void;
|
||||||
|
connectorExists: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DriveOAuthSection = ({
|
export const DriveOAuthSection = ({
|
||||||
@@ -281,6 +282,7 @@ export const DriveOAuthSection = ({
|
|||||||
appCredentialData,
|
appCredentialData,
|
||||||
setPopup,
|
setPopup,
|
||||||
refreshCredentials,
|
refreshCredentials,
|
||||||
|
connectorExists,
|
||||||
}: DriveCredentialSectionProps) => {
|
}: DriveCredentialSectionProps) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@@ -294,6 +296,14 @@ export const DriveOAuthSection = ({
|
|||||||
</p>
|
</p>
|
||||||
<Button
|
<Button
|
||||||
onClick={async () => {
|
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);
|
await adminDeleteCredential(existingCredential.id);
|
||||||
setPopup({
|
setPopup({
|
||||||
message: "Successfully revoked access to Google Drive!",
|
message: "Successfully revoked access to Google Drive!",
|
||||||
|
@@ -377,6 +377,7 @@ const Main = () => {
|
|||||||
}
|
}
|
||||||
appCredentialData={appCredentialData}
|
appCredentialData={appCredentialData}
|
||||||
serviceAccountKeyData={serviceAccountKeyData}
|
serviceAccountKeyData={serviceAccountKeyData}
|
||||||
|
connectorExists={googleDriveConnectorIndexingStatuses.length > 0}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Title className="mb-2 mt-6 ml-auto mr-auto">
|
<Title className="mb-2 mt-6 ml-auto mr-auto">
|
||||||
|
Reference in New Issue
Block a user