Skip to content
Merged
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
24 changes: 24 additions & 0 deletions static/app/constants/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,30 @@ export const DATA_CATEGORY_INFO = {
`/settings/${organization.slug}/seer/`,
formatting: DEFAULT_COUNT_FORMATTING,
},
[DataCategoryExact.SIZE_ANALYSIS]: {
name: DataCategoryExact.SIZE_ANALYSIS,
plural: DataCategory.SIZE_ANALYSIS,
singular: 'sizeAnalysis',
displayName: 'size analysis upload',
titleName: t('Size Analysis Uploads'),
productName: t('Size Analysis Upload'),
uid: 35,
isBilledCategory: false,
statsInfo: {...DEFAULT_STATS_INFO, showExternalStats: true},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI, if you set showExternalStats to true without adding additional checks here the category will show up as an option in stats for everybody

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is showExternalStats for stats page only?
It also affects Subscription Page, because Subscription Page also uses chartMetadata.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it is only for stats page, the chartMetadata you're referring to in subscription page is a completely separate function from the one in stats

formatting: DEFAULT_COUNT_FORMATTING,
},
[DataCategoryExact.INSTALLABLE_BUILD]: {
name: DataCategoryExact.INSTALLABLE_BUILD,
plural: DataCategory.INSTALLABLE_BUILD,
singular: 'installableBuild',
displayName: 'build distribution',
titleName: t('Build Distributions'),
productName: t('Build Distribution'),
uid: 36,
isBilledCategory: false,
statsInfo: {...DEFAULT_STATS_INFO, showExternalStats: true},
formatting: DEFAULT_COUNT_FORMATTING,
},
} as const satisfies Record<DataCategoryExact, DataCategoryInfo>;

// SmartSearchBar settings
Expand Down
4 changes: 4 additions & 0 deletions static/app/types/core.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export enum DataCategory {
PREVENT_REVIEW = 'preventReviews',
USER_REPORT_V2 = 'feedback',
TRACE_METRICS = 'traceMetrics',
SIZE_ANALYSIS = 'sizeAnalyses',
INSTALLABLE_BUILD = 'installableBuilds',
}

/**
Expand Down Expand Up @@ -131,6 +133,8 @@ export enum DataCategoryExact {
SEER_USER = 'seer_user',
USER_REPORT_V2 = 'feedback',
TRACE_METRIC = 'trace_metric',
SIZE_ANALYSIS = 'size_analysis',
INSTALLABLE_BUILD = 'installable_build',
}

/**
Expand Down
58 changes: 58 additions & 0 deletions static/app/views/organizationStats/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,64 @@ describe('OrganizationStats', () => {
expect(screen.queryByRole('option', {name: 'Issue Scans'})).not.toBeInTheDocument();
});

it('shows size analysis when billing feature flag is enabled', async () => {
const newOrg = OrganizationFixture({
features: ['size-analysis-billing'],
});

render(<OrganizationStats />, {
organization: newOrg,
});

await userEvent.click(await screen.findByText('Category'));
expect(
screen.getByRole('option', {name: 'Size Analysis Uploads'})
).toBeInTheDocument();
});

it('does not show size analysis when billing feature flag is disabled', async () => {
const newOrg = OrganizationFixture({
features: [],
});

render(<OrganizationStats />, {
organization: newOrg,
});

await userEvent.click(await screen.findByText('Category'));
expect(
screen.queryByRole('option', {name: 'Size Analysis Uploads'})
).not.toBeInTheDocument();
});

it('shows installable build when billing feature flag is enabled', async () => {
const newOrg = OrganizationFixture({
features: ['installable-build-billing'],
});

render(<OrganizationStats />, {
organization: newOrg,
});

await userEvent.click(await screen.findByText('Category'));
expect(screen.getByRole('option', {name: 'Build Distributions'})).toBeInTheDocument();
});

it('does not show installable build when billing feature flag is disabled', async () => {
const newOrg = OrganizationFixture({
features: [],
});

render(<OrganizationStats />, {
organization: newOrg,
});

await userEvent.click(await screen.findByText('Category'));
expect(
screen.queryByRole('option', {name: 'Build Distributions'})
).not.toBeInTheDocument();
});

it('shows Metrics category when tracemetrics-stats feature flag is enabled', async () => {
const newOrg = OrganizationFixture({
features: ['team-insights', 'tracemetrics-enabled', 'tracemetrics-stats'],
Expand Down
6 changes: 6 additions & 0 deletions static/app/views/organizationStats/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ export class OrganizationStatsInner extends Component<OrganizationStatsProps> {
if (opt.value === DataCategory.PROFILES) {
return !hasProfilingStats;
}
if (opt.value === DataCategory.SIZE_ANALYSIS) {
return organization.features.includes('size-analysis-billing');
}
if (opt.value === DataCategory.INSTALLABLE_BUILD) {
return organization.features.includes('installable-build-billing');
}
return true;
}).map(opt => {
if ((hasProfiling || hasProfilingStats) && opt.value === DataCategory.PROFILES) {
Expand Down
Loading