Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {useCallback, useMemo} from 'react';
import styled from '@emotion/styled';

import {Button} from 'sentry/components/core/button';
import Access from 'sentry/components/acl/access';
import {LinkButton} from 'sentry/components/core/button/linkButton';
import type {SelectOption} from 'sentry/components/core/compactSelect';
import {CompactSelect} from 'sentry/components/core/compactSelect';
Expand All @@ -14,19 +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';

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();
}, []);

Expand Down Expand Up @@ -70,22 +71,31 @@ function OrgFooterMessage() {
{isIntegrationInfoPending ? (
<LoadingIndicator />
) : provider ? (
<AddIntegration
provider={provider}
onInstall={handleAddIntegration}
organization={organization}
<IntegrationContext
value={{
provider,
type: 'first_party',
installStatus: 'Installed',
analyticsParams: {
view: 'test_analytics_org_selector',
already_installed: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Misleading Analytics for Fresh Integrations

The already_installed analytics parameter is set to true when users are adding a new GitHub organization integration, which will track incorrect analytics data. This should be false since the integration being added is not already installed, similar to the pattern used in preOnboarding.tsx.

Fix in Cursor Fix in Web

},
}}
>
{openDialog => (
<Button
size="xs"
icon={<IconAdd />}
priority="default"
onClick={() => openDialog()}
>
{t('GitHub Organization')}
</Button>
)}
</AddIntegration>
<Access access={['org:integrations']} organization={organization}>
{({hasAccess}) => (
<IntegrationButton
userHasAccess={hasAccess}
onAddIntegration={handleAddIntegration}
onExternalClick={() => {}}
buttonProps={{
size: 'sm',
priority: 'primary',
}}
/>
)}
</Access>
</IntegrationContext>
) : (
<LinkButton
href="https://github.com/apps/sentry/installations/select_target"
Expand Down
3 changes: 2 additions & 1 deletion static/app/utils/analytics/integrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export type IntegrationView = {
| 'project_creation'
| 'developer_settings'
| 'new_integration_modal'
| 'test_analytics_onboarding';
| 'test_analytics_onboarding'
| 'test_analytics_org_selector';
};

type SingleIntegrationEventParams = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ type Props = {
| 'integrations_directory'
| 'onboarding'
| 'project_creation'
| 'test_analytics_onboarding';
| 'test_analytics_onboarding'
| 'test_analytics_org_selector';
};
modalParams?: Record<string, string>;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading