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
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,10 @@ tests/sentry/api/endpoints/test_organization_attribute_mappings.py @get
/tests/sentry/scm/ @getsentry/scm
## End of SCM

## SCM Frontend
/static/app/components/repositories @getsentry/coding-workflows-sentry-frontend @getsentry/scm
## End of SCM Frontend

# End of Coding Workflows

# Conduit
Expand Down
2 changes: 0 additions & 2 deletions .github/codeowners-coverage-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,6 @@ static/app/components/hook.spec.tsx
static/app/components/hook.tsx
static/app/components/hookOrDefault.spec.tsx
static/app/components/hookOrDefault.tsx
static/app/components/hotkeysLabel.spec.tsx
static/app/components/hotkeysLabel.tsx
static/app/components/hovercard.spec.tsx
static/app/components/hovercard.tsx
static/app/components/iconCircledNumber.tsx
Expand Down
2 changes: 1 addition & 1 deletion src/sentry_plugins/jira/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def build_dynamic_field(self, group, field_meta):
schema.get("items") == "user" or schema["type"] == "user"
):
fieldtype = "select"
sentry_url = f"/api/0/issues/{group.id}/plugins/{self.slug}/autocomplete"
sentry_url = f"/api/0/organizations/{group.organization.slug}/issues/{group.id}/plugins/{self.slug}/autocomplete"
fkwargs["url"] = "{}?jira_url={}".format(
sentry_url,
quote_plus(field_meta["autoCompleteUrl"]),
Expand Down
5 changes: 3 additions & 2 deletions static/app/components/alerts/pageBanner.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from '@emotion/styled';
import replaysDeadRageBackground from 'sentry-images/spot/replay-dead-rage-changelog.svg';

import {Button, LinkButton} from '@sentry/scraps/button';
import {InlineCode} from '@sentry/scraps/code';
import {ExternalLink} from '@sentry/scraps/link';

import {PageBanner} from 'sentry/components/alerts/pageBanner';
Expand Down Expand Up @@ -42,7 +43,7 @@ export default Storybook.story('PageBanner', story => {
<Fragment>
<p>
This example renders an X in the top-right corner. You can wire it up with
something like <kbd>useDismissAlert()</kbd>.
something like <InlineCode>useDismissAlert()</InlineCode>.
</p>
<p>
Is Dismissed? <var>{String(isDismissed)}</var>
Expand Down Expand Up @@ -72,7 +73,7 @@ export default Storybook.story('PageBanner', story => {
<Fragment>
<p>
The banner will resize if it's shrunk really narrow. To make it expand inside a
flex parent set <kbd>flex-grow:1</kbd>.
flex parent set <InlineCode>flex-grow:1</InlineCode>.
</p>
<p>
<Button size="sm" onClick={() => setFlexGrow(!flexGrow)}>
Expand Down
40 changes: 9 additions & 31 deletions static/app/components/commandPalette/ui/commandPalette.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {Fragment, useLayoutEffect, useMemo, useEffect, useCallback} from 'react';
import {Fragment, useCallback, useLayoutEffect, useMemo} from 'react';
import {preload} from 'react-dom';
import {useTheme} from '@emotion/react';
import styled from '@emotion/styled';
import {ListKeyboardDelegate, useSelectableCollection} from '@react-aria/selection';
import {mergeProps} from '@react-aria/utils';
import {Item} from '@react-stately/collections';
import {useTreeState} from '@react-stately/tree';
import * as Sentry from '@sentry/react';
import {AnimatePresence, motion} from 'framer-motion';

import errorIllustration from 'sentry-images/spot/computer-missing.svg';
Expand All @@ -29,14 +28,13 @@ import {
useCommandPaletteDispatch,
useCommandPaletteState,
} from 'sentry/components/commandPalette/ui/commandPaletteStateContext';
import {useCommandPaletteAnalytics} from 'sentry/components/commandPalette/useCommandPaletteAnalytics';
import {FeedbackButton} from 'sentry/components/feedbackButton/feedbackButton';
import {IconArrow, IconClose, IconSearch} from 'sentry/icons';
import {IconDefaultsProvider} from 'sentry/icons/useIconDefaults';
import {t} from 'sentry/locale';
import {trackAnalytics} from 'sentry/utils/analytics';
import {fzf} from 'sentry/utils/search/fzf';
import type {Theme} from 'sentry/utils/theme';
import {useOrganization} from 'sentry/utils/useOrganization';

const MotionButton = motion.create(Button);
const MotionIconSearch = motion.create(IconSearch);
Expand Down Expand Up @@ -72,7 +70,6 @@ export function CommandPalette(props: CommandPaletteProps) {
const theme = useTheme();

const actions = useCommandPaletteActions();
const organization = useOrganization();
const state = useCommandPaletteState();
const dispatch = useCommandPaletteDispatch();

Expand All @@ -97,6 +94,8 @@ export function CommandPalette(props: CommandPaletteProps) {
[state.query, displayedActions]
);

const analytics = useCommandPaletteAnalytics(filteredActions.length);

const sections = useMemo(
() => groupActionsBySection(filteredActions),
[filteredActions]
Expand Down Expand Up @@ -169,25 +168,23 @@ export function CommandPalette(props: CommandPaletteProps) {

const onActionSelection = useCallback(
(key: ReturnType<typeof treeState.collection.getFirstKey> | null) => {
const action = filteredActions.find(a => a.key === key);
const resultIndex = filteredActions.findIndex(a => a.key === key);
const action = resultIndex >= 0 ? filteredActions[resultIndex] : undefined;
if (!action) {
return;
}

if (action.type === 'group') {
trackAnalytics('command_palette.action_selected', {
organization,
action: action.display.label,
query: state.query,
});
analytics.recordGroupAction(action, resultIndex);
dispatch({type: 'push action', action});
return;
}

analytics.recordAction(action, resultIndex, action.groupingKey ?? '');
dispatch({type: 'trigger action'});
props.onAction(action);
},
[filteredActions, dispatch, props, treeState, organization, state.query]
[filteredActions, dispatch, props, analytics, treeState]
);

return (
Expand Down Expand Up @@ -444,25 +441,6 @@ function flattenActions(
}

function CommandPaletteNoResults() {
const organization = useOrganization();
const {query, action} = useCommandPaletteState();

useEffect(() => {
const actionLabel =
typeof action?.value.action.display.label === 'string'
? action.value.action.display.label
: undefined;
trackAnalytics('command_palette.no_results', {
organization,
query,
action: actionLabel,
});
Sentry.logger.info('Command palette returned no results', {
query,
action: actionLabel,
});
}, [organization, query, action]);

return (
<Flex
direction="column"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import {createContext, useContext, useReducer, useRef} from 'react';

import {useHotkeys} from '@sentry/scraps/hotkey';

import {
openCommandPaletteDeprecated,
toggleCommandPalette,
} from 'sentry/actionCreators/modal';
import type {CommandPaletteActionWithKey} from 'sentry/components/commandPalette/types';
import {unreachable} from 'sentry/utils/unreachable';
import {useHotkeys} from 'sentry/utils/useHotkeys';
import {useOrganization} from 'sentry/utils/useOrganization';

export type LinkedList = {
Expand Down
33 changes: 7 additions & 26 deletions static/app/components/commandPalette/ui/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,16 @@ import type {ModalRenderProps} from 'sentry/actionCreators/modal';
import {closeModal} from 'sentry/actionCreators/modal';
import type {CommandPaletteActionWithKey} from 'sentry/components/commandPalette/types';
import {CommandPalette} from 'sentry/components/commandPalette/ui/commandPalette';
import {
getActionPath,
useCommandPaletteState,
} from 'sentry/components/commandPalette/ui/commandPaletteStateContext';
import {useCommandPaletteState} from 'sentry/components/commandPalette/ui/commandPaletteStateContext';
import {useDsnLookupActions} from 'sentry/components/commandPalette/useDsnLookupActions';
import {trackAnalytics} from 'sentry/utils/analytics';
import type {Theme} from 'sentry/utils/theme';
import {unreachable} from 'sentry/utils/unreachable';
import {normalizeUrl} from 'sentry/utils/url/normalizeUrl';
import {useNavigate} from 'sentry/utils/useNavigate';
import {useOrganization} from 'sentry/utils/useOrganization';

export default function CommandPaletteModal({Body}: ModalRenderProps) {
const navigate = useNavigate();
const organization = useOrganization();

const state = useCommandPaletteState();
const {query} = state;
const {query} = useCommandPaletteState();

useDsnLookupActions(query);

Expand All @@ -31,29 +23,18 @@ export default function CommandPaletteModal({Body}: ModalRenderProps) {
const actionType = action.type;
switch (actionType) {
case 'navigate':
case 'callback': {
const path = getActionPath(state);
const label =
path.length > 0 ? `${path} → ${action.display.label}` : action.display.label;
trackAnalytics('command_palette.action_selected', {
organization,
action: label,
query,
});
if (actionType === 'navigate') {
navigate(normalizeUrl(action.to));
} else {
action.onAction();
}
navigate(normalizeUrl(action.to));
break;
case 'callback':
action.onAction();
break;
}
default:
unreachable(actionType);
break;
}
closeModal();
},
[navigate, organization, state, query]
[navigate]
);

return (
Expand Down
Loading
Loading