-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix(export): show 'Data export requires Business Plan' on 404 for SaaS #97546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 5 commits
cfe9e2e
240d5d9
43aa5a2
fd2b236
01c0c79
a756291
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {GroupFixture} from 'sentry-fixture/group'; | ||
import {OrganizationFixture} from 'sentry-fixture/organization'; | ||
import {ProjectFixture} from 'sentry-fixture/project'; | ||
|
||
import {render, screen} from 'sentry-test/reactTestingLibrary'; | ||
|
||
import TagExportDropdown from 'sentry/views/issueDetails/groupDistributions/tagExportDropdown'; | ||
|
||
describe('TagExportDropdown', function () { | ||
const group = GroupFixture(); | ||
const project = ProjectFixture(); | ||
const orgWithFeature = OrganizationFixture({features: ['discover-query']}); | ||
const orgWithoutFeature = OrganizationFixture({features: []}); | ||
|
||
it('does not render when org lacks discover-query feature', function () { | ||
render( | ||
<TagExportDropdown | ||
organization={orgWithoutFeature} | ||
project={project} | ||
group={group} | ||
tagKey="user" | ||
/> | ||
); | ||
|
||
expect(screen.queryByLabelText('Export options')).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('renders when org has discover-query feature', function () { | ||
render( | ||
<TagExportDropdown | ||
organization={orgWithFeature} | ||
project={project} | ||
group={group} | ||
tagKey="user" | ||
/> | ||
); | ||
|
||
expect(screen.getByLabelText('Export options')).toBeInTheDocument(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import {useState} from 'react'; | ||
|
||
import Feature from 'sentry/components/acl/feature'; | ||
import {Button} from 'sentry/components/core/button'; | ||
import {ExportQueryType, useDataExport} from 'sentry/components/dataExport'; | ||
import {DropdownMenu} from 'sentry/components/dropdownMenu'; | ||
|
@@ -30,39 +31,41 @@ export default function TagExportDropdown({tagKey, group, organization, project} | |
}); | ||
|
||
return ( | ||
<DropdownMenu | ||
size="xs" | ||
trigger={triggerProps => ( | ||
<Button | ||
{...triggerProps} | ||
borderless | ||
size="xs" | ||
aria-label={t('Export options')} | ||
icon={<IconDownload />} | ||
/> | ||
)} | ||
items={[ | ||
{ | ||
key: 'export-page', | ||
label: t('Export Page to CSV'), | ||
// TODO(issues): Dropdown menu doesn't support hrefs yet | ||
onAction: () => { | ||
window.open( | ||
`/${organization.slug}/${project.slug}/issues/${group.id}/tags/${tagKey}/export/`, | ||
'_blank' | ||
); | ||
<Feature features="organizations:discover-query" organization={organization}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay i believe i updated it. but this will just hide the button right. do we have an example of showing an "upgrade to business" hook? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don't think we have a unified upgrade to business hook since each place that I know of that has this upsell, does it slightly differently |
||
<DropdownMenu | ||
size="xs" | ||
trigger={triggerProps => ( | ||
<Button | ||
{...triggerProps} | ||
borderless | ||
size="xs" | ||
aria-label={t('Export options')} | ||
icon={<IconDownload />} | ||
/> | ||
)} | ||
items={[ | ||
{ | ||
key: 'export-page', | ||
label: t('Export Page to CSV'), | ||
// TODO(issues): Dropdown menu doesn't support hrefs yet | ||
onAction: () => { | ||
window.open( | ||
`/${organization.slug}/${project.slug}/issues/${group.id}/tags/${tagKey}/export/`, | ||
'_blank' | ||
); | ||
}, | ||
}, | ||
}, | ||
{ | ||
key: 'export-all', | ||
label: isExportDisabled ? t('Export in progress...') : t('Export All to CSV'), | ||
onAction: () => { | ||
handleDataExport(); | ||
setIsExportDisabled(true); | ||
{ | ||
key: 'export-all', | ||
label: isExportDisabled ? t('Export in progress...') : t('Export All to CSV'), | ||
onAction: () => { | ||
handleDataExport(); | ||
setIsExportDisabled(true); | ||
}, | ||
disabled: isExportDisabled, | ||
}, | ||
disabled: isExportDisabled, | ||
}, | ||
]} | ||
/> | ||
]} | ||
/> | ||
</Feature> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Feature Flag Mismatch in TagExportDropdown Test
The
TagExportDropdown
test sets thediscover-query
feature flag on the organization, but the component checks fororganizations:discover-query
. This mismatch prevents the component from correctly detecting the feature, causing the test that expects the dropdown to render to fail.