-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(flags): add setup integration modal #80437
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d2ff0fa
:sparkles: add modal
michellewzhang 3ef2ca2
:recycle: tweaks
michellewzhang 4cba2e6
:bug: only call endpoint once
michellewzhang fd1edb3
:white_check_mark: tests
michellewzhang 60e0c97
:recycle: add docs link
michellewzhang 83e0603
:recycle: use diff token endpoint
michellewzhang 5a56503
:chart_with_upwards_trend: analytics
michellewzhang b73a353
:lipstick: border for empty state:
michellewzhang 8e95dfd
:art: pr comments
michellewzhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,14 +1,20 @@ | ||||||
import {useCallback, useMemo, useRef, useState} from 'react'; | ||||||
import {Fragment, useCallback, useMemo, useRef, useState} from 'react'; | ||||||
import styled from '@emotion/styled'; | ||||||
|
||||||
import {openModal} from 'sentry/actionCreators/modal'; | ||||||
import {Button} from 'sentry/components/button'; | ||||||
import ButtonBar from 'sentry/components/buttonBar'; | ||||||
import EmptyStateWarning from 'sentry/components/emptyStateWarning'; | ||||||
import ErrorBoundary from 'sentry/components/errorBoundary'; | ||||||
import { | ||||||
CardContainer, | ||||||
FeatureFlagDrawer, | ||||||
} from 'sentry/components/events/featureFlags/featureFlagDrawer'; | ||||||
import FeatureFlagSort from 'sentry/components/events/featureFlags/featureFlagSort'; | ||||||
import { | ||||||
modalCss, | ||||||
SetupIntegrationModal, | ||||||
} from 'sentry/components/events/featureFlags/setupIntegrationModal'; | ||||||
import { | ||||||
FlagControlOptions, | ||||||
OrderBy, | ||||||
|
@@ -86,6 +92,15 @@ export function EventFeatureFlagList({ | |||||
event, | ||||||
}); | ||||||
|
||||||
const hasFlagContext = !!event.contexts.flags; | ||||||
const hasFlags = Boolean(hasFlagContext && event?.contexts?.flags?.values.length); | ||||||
|
||||||
function handleClick() { | ||||||
openModal(modalProps => <SetupIntegrationModal {...modalProps} />, { | ||||||
modalCss, | ||||||
}); | ||||||
} | ||||||
|
||||||
const suspectFlagNames: Set<string> = useMemo(() => { | ||||||
return isSuspectError || isSuspectPending | ||||||
? new Set() | ||||||
|
@@ -150,37 +165,50 @@ export function EventFeatureFlagList({ | |||||
[openDrawer, event, group, project, hydratedFlags, organization, sortBy, orderBy] | ||||||
); | ||||||
|
||||||
if (!hydratedFlags.length) { | ||||||
// TODO: for LD users, show a CTA in this section instead | ||||||
// if contexts.flags is not set, hide the section | ||||||
if (!hasFlagContext) { | ||||||
return null; | ||||||
} | ||||||
|
||||||
const actions = ( | ||||||
<ButtonBar gap={1}> | ||||||
{feedbackButton} | ||||||
<Button | ||||||
size="xs" | ||||||
aria-label={t('View All')} | ||||||
ref={viewAllButtonRef} | ||||||
title={t('View All Flags')} | ||||||
onClick={() => { | ||||||
isDrawerOpen ? closeDrawer() : onViewAllFlags(); | ||||||
}} | ||||||
> | ||||||
{t('View All')} | ||||||
</Button> | ||||||
<Button | ||||||
aria-label={t('Open Feature Flag Search')} | ||||||
icon={<IconSearch size="xs" />} | ||||||
size="xs" | ||||||
title={t('Open Search')} | ||||||
onClick={() => onViewAllFlags(FlagControlOptions.SEARCH)} | ||||||
/> | ||||||
<FeatureFlagSort | ||||||
orderBy={orderBy} | ||||||
sortBy={sortBy} | ||||||
setSortBy={setSortBy} | ||||||
setOrderBy={setOrderBy} | ||||||
/> | ||||||
{hasFlagContext && ( | ||||||
<Fragment> | ||||||
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. Do we still need this after the early return check above?
Suggested change
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. keeping this for now since it'll be useful when we add in the LD feature flag |
||||||
<Button aria-label={t('Set Up Integration')} size="xs" onClick={handleClick}> | ||||||
{t('Set Up Integration')} | ||||||
</Button> | ||||||
{hasFlags && ( | ||||||
<Fragment> | ||||||
<Button | ||||||
size="xs" | ||||||
aria-label={t('View All')} | ||||||
ref={viewAllButtonRef} | ||||||
title={t('View All Flags')} | ||||||
onClick={() => { | ||||||
isDrawerOpen ? closeDrawer() : onViewAllFlags(); | ||||||
}} | ||||||
> | ||||||
{t('View All')} | ||||||
</Button> | ||||||
<Button | ||||||
aria-label={t('Open Feature Flag Search')} | ||||||
icon={<IconSearch size="xs" />} | ||||||
size="xs" | ||||||
title={t('Open Search')} | ||||||
onClick={() => onViewAllFlags(FlagControlOptions.SEARCH)} | ||||||
/> | ||||||
<FeatureFlagSort | ||||||
orderBy={orderBy} | ||||||
sortBy={sortBy} | ||||||
setSortBy={setSortBy} | ||||||
setOrderBy={setOrderBy} | ||||||
/> | ||||||
</Fragment> | ||||||
)} | ||||||
</Fragment> | ||||||
)} | ||||||
</ButtonBar> | ||||||
); | ||||||
|
||||||
|
@@ -203,10 +231,16 @@ export function EventFeatureFlagList({ | |||||
type={SectionKey.FEATURE_FLAGS} | ||||||
actions={actions} | ||||||
> | ||||||
<CardContainer numCols={columnTwo.length ? 2 : 1}> | ||||||
<KeyValueData.Card contentItems={columnOne} /> | ||||||
<KeyValueData.Card contentItems={columnTwo} /> | ||||||
</CardContainer> | ||||||
{hasFlags ? ( | ||||||
<CardContainer numCols={columnTwo.length ? 2 : 1}> | ||||||
<KeyValueData.Card contentItems={columnOne} /> | ||||||
<KeyValueData.Card contentItems={columnTwo} /> | ||||||
</CardContainer> | ||||||
) : ( | ||||||
<EmptyStateWarning withIcon small> | ||||||
{t('No feature flags were found for this event')} | ||||||
</EmptyStateWarning> | ||||||
)} | ||||||
</InterimSection> | ||||||
</ErrorBoundary> | ||||||
); | ||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.