diff --git a/studio/components/interfaces/Organization/IntegrationSettings/OrganizationIntegration.tsx b/studio/components/interfaces/Organization/IntegrationSettings/OrganizationIntegration.tsx index b26d83cb017..ddc6d34ceb3 100644 --- a/studio/components/interfaces/Organization/IntegrationSettings/OrganizationIntegration.tsx +++ b/studio/components/interfaces/Organization/IntegrationSettings/OrganizationIntegration.tsx @@ -13,6 +13,7 @@ import { ScaffoldSectionDetail, } from 'components/layouts/Scaffold' import ConfirmationModal from 'components/ui/ConfirmationModal' +import { useIntegrationsVercelConnectionSyncEnvsMutation } from 'data/integrations/integrations-vercel-connection-sync-envs-mutation' import { IntegrationName, IntegrationProjectConnection, @@ -22,7 +23,7 @@ import { BASE_PATH } from 'lib/constants' import { pluralize } from 'lib/helpers' import { EMPTY_ARR } from 'lib/void' import React, { forwardRef, useCallback, useState } from 'react' -import { Button, Dropdown, IconChevronDown, IconTrash, Modal } from 'ui' +import { Button, Dropdown, IconChevronDown, IconTrash, Modal, IconLoader, IconRefreshCw } from 'ui' export interface IntegrationProps { title: string @@ -117,6 +118,7 @@ interface IntegrationConnectionItemProps extends IntegrationConnectionProps { const IntegrationConnectionItem = React.forwardRef( ({ onDeleteConnection, ...props }, ref) => { const [isOpen, setIsOpen] = useState(false) + const [dropdownVisible, setDropdownVisible] = useState(false) const onConfirm = useCallback(async () => { try { @@ -130,19 +132,55 @@ const IntegrationConnectionItem = React.forwardRef { + try { + await syncEnvs({ connectionId: props.connection.id }) + } finally { + setDropdownVisible(false) + } + }, [props.connection, syncEnvs]) + return ( <> setDropdownVisible(!dropdownVisible)} + modal={false} side="bottom" align="end" - size="large" + size="medium" overlay={ <> + {props.type === 'Vercel' && ( + <> + + ) : ( + + ) + } + onSelect={(event) => { + event.preventDefault() + onReSyncEnvVars() + }} + disabled={isSyncEnvLoading} + > + Resync environment variables + + + + )} } onSelect={() => setIsOpen(true)}> - Delete + Delete connection } @@ -152,8 +190,8 @@ const IntegrationConnectionItem = React.forwardRef } - {...props} /> +