|
@@ -9,6 +9,7 @@ import {
|
|
|
CardContainer,
|
|
|
FeatureFlagDrawer,
|
|
|
FLAG_SORT_OPTIONS,
|
|
|
+ FlagControlOptions,
|
|
|
FlagSort,
|
|
|
getLabel,
|
|
|
} from 'sentry/components/events/featureFlags/featureFlagDrawer';
|
|
@@ -16,7 +17,7 @@ import useDrawer from 'sentry/components/globalDrawer';
|
|
|
import KeyValueData, {
|
|
|
type KeyValueDataContentProps,
|
|
|
} from 'sentry/components/keyValueData';
|
|
|
-import {IconMegaphone, IconSort} from 'sentry/icons';
|
|
|
+import {IconMegaphone, IconSearch, IconSort} from 'sentry/icons';
|
|
|
import {t} from 'sentry/locale';
|
|
|
import type {Event, FeatureFlag} from 'sentry/types/event';
|
|
|
import type {Group} from 'sentry/types/group';
|
|
@@ -91,35 +92,39 @@ export function EventFeatureFlagList({
|
|
|
? [...hydratedFlags].reverse()
|
|
|
: hydratedFlags;
|
|
|
|
|
|
- const onViewAllFlags = useCallback(() => {
|
|
|
- trackAnalytics('flags.view-all-clicked', {
|
|
|
- organization,
|
|
|
- });
|
|
|
- openDrawer(
|
|
|
- () => (
|
|
|
- <FeatureFlagDrawer
|
|
|
- group={group}
|
|
|
- event={event}
|
|
|
- project={project}
|
|
|
- hydratedFlags={hydratedFlags}
|
|
|
- initialSort={sortMethod}
|
|
|
- />
|
|
|
- ),
|
|
|
- {
|
|
|
- ariaLabel: t('Feature flags drawer'),
|
|
|
- // We prevent a click on the 'View All' button from closing the drawer so that
|
|
|
- // we don't reopen it immediately, and instead let the button handle this itself.
|
|
|
- shouldCloseOnInteractOutside: element => {
|
|
|
- const viewAllButton = viewAllButtonRef.current;
|
|
|
- if (viewAllButton?.contains(element)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- },
|
|
|
- transitionProps: {stiffness: 1000},
|
|
|
- }
|
|
|
- );
|
|
|
- }, [openDrawer, event, group, project, sortMethod, hydratedFlags, organization]);
|
|
|
+ const onViewAllFlags = useCallback(
|
|
|
+ (focusControl?: FlagControlOptions) => {
|
|
|
+ trackAnalytics('flags.view-all-clicked', {
|
|
|
+ organization,
|
|
|
+ });
|
|
|
+ openDrawer(
|
|
|
+ () => (
|
|
|
+ <FeatureFlagDrawer
|
|
|
+ group={group}
|
|
|
+ event={event}
|
|
|
+ project={project}
|
|
|
+ hydratedFlags={hydratedFlags}
|
|
|
+ initialSort={sortMethod}
|
|
|
+ focusControl={focusControl}
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ {
|
|
|
+ ariaLabel: t('Feature flags drawer'),
|
|
|
+ // We prevent a click on the 'View All' button from closing the drawer so that
|
|
|
+ // we don't reopen it immediately, and instead let the button handle this itself.
|
|
|
+ shouldCloseOnInteractOutside: element => {
|
|
|
+ const viewAllButton = viewAllButtonRef.current;
|
|
|
+ if (viewAllButton?.contains(element)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ transitionProps: {stiffness: 1000},
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ [openDrawer, event, group, project, sortMethod, hydratedFlags, organization]
|
|
|
+ );
|
|
|
|
|
|
if (!hydratedFlags.length) {
|
|
|
return null;
|
|
@@ -128,10 +133,18 @@ export function EventFeatureFlagList({
|
|
|
const actions = (
|
|
|
<ButtonBar gap={1}>
|
|
|
{feedbackButton}
|
|
|
+ <Button
|
|
|
+ aria-label={t('Open Feature Flag Search')}
|
|
|
+ icon={<IconSearch size="xs" />}
|
|
|
+ size="xs"
|
|
|
+ title={t('Open Search')}
|
|
|
+ onClick={() => onViewAllFlags(FlagControlOptions.SEARCH)}
|
|
|
+ />
|
|
|
<Button
|
|
|
size="xs"
|
|
|
aria-label={t('View All')}
|
|
|
ref={viewAllButtonRef}
|
|
|
+ title={t('View All Flags')}
|
|
|
onClick={() => {
|
|
|
isDrawerOpen ? closeDrawer() : onViewAllFlags();
|
|
|
}}
|