From 4bd7c9cadbe74cad18f0bf6eb57498d51a583327 Mon Sep 17 00:00:00 2001 From: Calvin Yau Date: Fri, 7 Nov 2025 22:59:19 -0800 Subject: [PATCH 1/4] feat(codecov): Show request button in org selector when no access --- .../integratedOrgSelector.tsx | 46 ++++++++++++------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx b/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx index d7a75c8fc8e79e..d1b086c7107986 100644 --- a/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx +++ b/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx @@ -1,6 +1,7 @@ import {useCallback, useMemo} from 'react'; import styled from '@emotion/styled'; +import Access from 'sentry/components/acl/access'; import {Button} from 'sentry/components/core/button'; import {LinkButton} from 'sentry/components/core/button/linkButton'; import type {SelectOption} from 'sentry/components/core/compactSelect'; @@ -20,6 +21,7 @@ import useOrganization from 'sentry/utils/useOrganization'; import {useGetActiveIntegratedOrgs} from 'sentry/views/prevent/tests/queries/useGetActiveIntegratedOrgs'; import AddIntegration from 'sentry/views/settings/organizationIntegrations/addIntegration'; import type {IntegrationInformation} from 'sentry/views/settings/organizationIntegrations/integrationDetailedView'; +import RequestIntegrationButton from 'sentry/views/settings/organizationIntegrations/integrationRequest/RequestIntegrationButton'; const DEFAULT_ORG_LABEL = 'Select GitHub Org'; @@ -70,22 +72,34 @@ function OrgFooterMessage() { {isIntegrationInfoPending ? ( ) : provider ? ( - - {openDialog => ( - - )} - + + {({hasAccess}) => + hasAccess ? ( + + {openDialog => ( + + )} + + ) : ( + + ) + } + ) : ( Date: Mon, 10 Nov 2025 16:39:57 -0800 Subject: [PATCH 2/4] fix(codecov): Use IntegrationButton to handle both admin/non-admin --- .../integratedOrgSelector.tsx | 62 +++++++++---------- .../app/utils/analytics/integrations/index.ts | 3 +- .../addIntegration.tsx | 3 +- .../integrationButton.tsx | 2 + .../integrationContext.tsx | 3 +- 5 files changed, 38 insertions(+), 35 deletions(-) diff --git a/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx b/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx index d1b086c7107986..53bc9d263a0372 100644 --- a/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx +++ b/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx @@ -2,7 +2,6 @@ import {useCallback, useMemo} from 'react'; import styled from '@emotion/styled'; import Access from 'sentry/components/acl/access'; -import {Button} from 'sentry/components/core/button'; import {LinkButton} from 'sentry/components/core/button/linkButton'; import type {SelectOption} from 'sentry/components/core/compactSelect'; import {CompactSelect} from 'sentry/components/core/compactSelect'; @@ -15,20 +14,20 @@ import {usePreventContext} from 'sentry/components/prevent/context/preventContex import {integratedOrgIdToName} from 'sentry/components/prevent/utils'; import {IconAdd, IconBuilding, IconInfo} from 'sentry/icons'; import {t, tct} from 'sentry/locale'; -import type {IntegrationWithConfig} from 'sentry/types/integrations'; +import type {Integration} from 'sentry/types/integrations'; import {useApiQuery} from 'sentry/utils/queryClient'; import useOrganization from 'sentry/utils/useOrganization'; import {useGetActiveIntegratedOrgs} from 'sentry/views/prevent/tests/queries/useGetActiveIntegratedOrgs'; -import AddIntegration from 'sentry/views/settings/organizationIntegrations/addIntegration'; +import IntegrationButton from 'sentry/views/settings/organizationIntegrations/integrationButton'; +import {IntegrationContext} from 'sentry/views/settings/organizationIntegrations/integrationContext'; import type {IntegrationInformation} from 'sentry/views/settings/organizationIntegrations/integrationDetailedView'; -import RequestIntegrationButton from 'sentry/views/settings/organizationIntegrations/integrationRequest/RequestIntegrationButton'; const DEFAULT_ORG_LABEL = 'Select GitHub Org'; function OrgFooterMessage() { const organization = useOrganization(); - const handleAddIntegration = useCallback((_integration: IntegrationWithConfig) => { + const handleAddIntegration = useCallback((_integration: Integration) => { window.location.reload(); }, []); @@ -72,34 +71,33 @@ function OrgFooterMessage() { {isIntegrationInfoPending ? ( ) : provider ? ( - - {({hasAccess}) => - hasAccess ? ( - - {openDialog => ( - - )} - - ) : ( - + + {({hasAccess}) => ( + {}} + buttonProps={{ + size: 'sm', + priority: 'primary', + buttonText: t('GitHub Organization'), + icon: , + }} /> - ) - } - + )} + + ) : ( ; }; diff --git a/static/app/views/settings/organizationIntegrations/integrationButton.tsx b/static/app/views/settings/organizationIntegrations/integrationButton.tsx index cf1e50bc38cd8a..080a848cca3f51 100644 --- a/static/app/views/settings/organizationIntegrations/integrationButton.tsx +++ b/static/app/views/settings/organizationIntegrations/integrationButton.tsx @@ -17,7 +17,9 @@ type Props = { }; type ButtonProps = { + buttonText?: string; disabled?: any; + icon?: React.ReactNode; priority?: any; size?: any; style?: any; diff --git a/static/app/views/settings/organizationIntegrations/integrationContext.tsx b/static/app/views/settings/organizationIntegrations/integrationContext.tsx index 0efe51aa53a194..d4fd52bfbc9fa1 100644 --- a/static/app/views/settings/organizationIntegrations/integrationContext.tsx +++ b/static/app/views/settings/organizationIntegrations/integrationContext.tsx @@ -12,7 +12,8 @@ type IntegrationContextProps = { | 'integrations_directory' | 'onboarding' | 'project_creation' - | 'test_analytics_onboarding'; + | 'test_analytics_onboarding' + | 'test_analytics_org_selector'; referrer?: string; }; installStatus: string; From 56675b17ccf6b03a8cb319e0025e3e2b71bd3e1d Mon Sep 17 00:00:00 2001 From: Calvin Yau Date: Tue, 11 Nov 2025 17:10:20 -0800 Subject: [PATCH 3/4] chore(codecov): Change btn copy back to Add Installation --- .../prevent/integratedOrgSelector/integratedOrgSelector.tsx | 2 -- .../settings/organizationIntegrations/integrationButton.tsx | 2 -- 2 files changed, 4 deletions(-) diff --git a/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx b/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx index 53bc9d263a0372..340b4e6b4dae34 100644 --- a/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx +++ b/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx @@ -91,8 +91,6 @@ function OrgFooterMessage() { buttonProps={{ size: 'sm', priority: 'primary', - buttonText: t('GitHub Organization'), - icon: , }} /> )} diff --git a/static/app/views/settings/organizationIntegrations/integrationButton.tsx b/static/app/views/settings/organizationIntegrations/integrationButton.tsx index 080a848cca3f51..cf1e50bc38cd8a 100644 --- a/static/app/views/settings/organizationIntegrations/integrationButton.tsx +++ b/static/app/views/settings/organizationIntegrations/integrationButton.tsx @@ -17,9 +17,7 @@ type Props = { }; type ButtonProps = { - buttonText?: string; disabled?: any; - icon?: React.ReactNode; priority?: any; size?: any; style?: any; From b88114f7f8cfdcb996be6960d8179df7ae8f15a9 Mon Sep 17 00:00:00 2001 From: Calvin Yau Date: Thu, 13 Nov 2025 00:47:23 -0600 Subject: [PATCH 4/4] fix(codecov): Dynamically figure out install status --- .../integratedOrgSelector/integratedOrgSelector.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx b/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx index 340b4e6b4dae34..0b122666dc6753 100644 --- a/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx +++ b/static/app/components/prevent/integratedOrgSelector/integratedOrgSelector.tsx @@ -47,7 +47,10 @@ function OrgFooterMessage() { } ); + const {data: installedIntegrations = []} = useGetActiveIntegratedOrgs({organization}); + const provider = integrationInfo?.providers[0]; + const hasInstalledIntegration = installedIntegrations.length > 0; return ( @@ -75,10 +78,10 @@ function OrgFooterMessage() { value={{ provider, type: 'first_party', - installStatus: 'Installed', + installStatus: hasInstalledIntegration ? 'Installed' : 'Not Installed', analyticsParams: { view: 'test_analytics_org_selector', - already_installed: true, + already_installed: hasInstalledIntegration, }, }} >