diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 408881367d3a1e..914e8088f3e55e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -462,11 +462,11 @@ tests/sentry/api/endpoints/test_organization_attribute_mappings.py @get /src/sentry/identity/ @getsentry/enterprise /src/sentry/integrations/ @getsentry/product-owners-settings-integrations @getsentry/ecosystem -/src/sentry/integrations/api/endpoints/organization_code_mapping*.py @getsentry/issue-detection-backend +/src/sentry/integrations/api/endpoints/organization_code_mapping*.py @getsentry/coding-workflows-sentry-backend /src/sentry/integrations/api/endpoints/organization_coding_agents.py @getsentry/machine-learning-ai /src/sentry/integrations/coding_agent/ @getsentry/machine-learning-ai /src/sentry/integrations/utils/codecov.py @getsentry/codecov -/src/sentry/integrations/utils/stacktrace_link.py @getsentry/issue-detection-backend +/src/sentry/integrations/utils/stacktrace_link.py @getsentry/coding-workflows-sentry-backend /src/sentry/mail/ @getsentry/alerts-notifications /src/sentry/notifications/ @getsentry/alerts-notifications @getsentry/ecosystem @@ -651,7 +651,7 @@ tests/sentry/api/endpoints/test_organization_attribute_mappings.py @get /src/sentry/event_manager.py @getsentry/issue-detection-backend /src/sentry/eventstore/models.py @getsentry/issue-detection-backend /src/sentry/grouping/ @getsentry/issue-detection-backend -/src/sentry/issues/auto_source_code_config/ @getsentry/issue-detection-backend +/src/sentry/issues/auto_source_code_config/ @getsentry/coding-workflows-sentry-backend /src/sentry/issues/endpoints/related_issues.py @getsentry/issue-detection-backend /src/sentry/issues/ingest.py @getsentry/issue-detection-backend /src/sentry/issues/issue_occurrence.py @getsentry/issue-detection-backend @@ -671,16 +671,16 @@ tests/sentry/api/endpoints/test_organization_attribute_mappings.py @get /src/sentry/tasks/auto_ongoing_issues.py @getsentry/issue-detection-backend /src/sentry/tasks/auto_remove_inbox.py @getsentry/issue-detection-backend /src/sentry/tasks/auto_resolve_issues.py @getsentry/issue-detection-backend -/src/sentry/tasks/auto_source_code_config.py @getsentry/issue-detection-backend +/src/sentry/tasks/auto_source_code_config.py @getsentry/coding-workflows-sentry-backend /src/sentry/tasks/check_new_issue_threshold_met.py @getsentry/issue-detection-backend /src/sentry/tasks/clear_expired_resolutions.py @getsentry/issue-detection-backend /src/sentry/tasks/clear_expired_rulesnoozes.py @getsentry/issue-detection-backend /src/sentry/tasks/clear_expired_snoozes.py @getsentry/issue-detection-backend -/src/sentry/tasks/codeowners/ @getsentry/issue-detection-backend -/src/sentry/tasks/commit_context.py @getsentry/issue-detection-backend +/src/sentry/tasks/codeowners/ @getsentry/coding-workflows-sentry-backend +/src/sentry/tasks/commit_context.py @getsentry/coding-workflows-sentry-backend /src/sentry/tasks/seer/delete_seer_grouping_records.py @getsentry/issue-detection-backend /src/sentry/tasks/embeddings_grouping/ @getsentry/issue-detection-backend -/src/sentry/tasks/groupowner.py @getsentry/issue-detection-backend +/src/sentry/tasks/groupowner.py @getsentry/coding-workflows-sentry-backend /src/sentry/tasks/merge.py @getsentry/issue-detection-backend /src/sentry/tasks/unmerge.py @getsentry/issue-detection-backend /src/sentry/tasks/weekly_escalating_forecast.py @getsentry/issue-detection-backend @@ -703,7 +703,7 @@ tests/sentry/api/endpoints/test_organization_attribute_mappings.py @get /tests/sentry/deletions/test_group.py @getsentry/issue-detection-backend /tests/sentry/event_manager/ @getsentry/issue-detection-backend /tests/sentry/grouping/ @getsentry/issue-detection-backend -/tests/sentry/issues/auto_source_code_config/ @getsentry/issue-detection-backend +/tests/sentry/issues/auto_source_code_config/ @getsentry/coding-workflows-sentry-backend /tests/sentry/issues/endpoints/ @getsentry/issue-workflow /tests/sentry/issues/endpoints/test_related_issues.py @getsentry/issue-detection-backend /tests/sentry/issues/test_ingest.py @getsentry/issue-detection-backend @@ -726,9 +726,9 @@ tests/sentry/api/endpoints/test_organization_attribute_mappings.py @get /tests/sentry/tasks/test_clear_expired_resolutions.py @getsentry/issue-detection-backend /tests/sentry/tasks/test_clear_expired_rulesnoozes.py @getsentry/issue-detection-backend /tests/sentry/tasks/test_clear_expired_snoozes.py @getsentry/issue-detection-backend -/tests/sentry/tasks/test_code_owners.py @getsentry/issue-detection-backend -/tests/sentry/tasks/test_commit_context.py @getsentry/issue-detection-backend -/tests/sentry/tasks/test_groupowner.py @getsentry/issue-detection-backend +/tests/sentry/tasks/test_code_owners.py @getsentry/coding-workflows-sentry-backend +/tests/sentry/tasks/test_commit_context.py @getsentry/coding-workflows-sentry-backend +/tests/sentry/tasks/test_groupowner.py @getsentry/coding-workflows-sentry-backend /tests/sentry/tasks/test_merge.py @getsentry/issue-detection-backend /tests/sentry/tasks/test_post_process.py @getsentry/issue-detection-backend /tests/sentry/tasks/test_weekly_escalating_forecast.py @getsentry/issue-detection-backend diff --git a/static/app/components/commandPalette/useGlobalCommandPaletteActions.tsx b/static/app/components/commandPalette/useGlobalCommandPaletteActions.tsx index ac5d3a5406334a..838375531c0ca5 100644 --- a/static/app/components/commandPalette/useGlobalCommandPaletteActions.tsx +++ b/static/app/components/commandPalette/useGlobalCommandPaletteActions.tsx @@ -37,10 +37,12 @@ import { } from 'sentry/icons'; import {t} from 'sentry/locale'; import {apiOptions} from 'sentry/utils/api/apiOptions'; -import {queryOptions} from 'sentry/utils/queryClient'; +import {isActiveSuperuser} from 'sentry/utils/isActiveSuperuser'; +import {QUERY_API_CLIENT, queryOptions, useMutation} from 'sentry/utils/queryClient'; import {useMutateUserOptions} from 'sentry/utils/useMutateUserOptions'; import {useOrganization} from 'sentry/utils/useOrganization'; import {useProjects} from 'sentry/utils/useProjects'; +import {useUser} from 'sentry/utils/useUser'; import {useGetStarredDashboards} from 'sentry/views/dashboards/hooks/useGetStarredDashboards'; import {AGENTS_LANDING_SUB_PATH} from 'sentry/views/insights/pages/agents/settings'; import {BACKEND_LANDING_SUB_PATH} from 'sentry/views/insights/pages/backend/settings'; @@ -320,6 +322,12 @@ function useNavigationToggleCollapsed(): CommandPaletteAction { */ export function useGlobalCommandPaletteActions() { const organization = useOrganization(); + const user = useUser(); + const {mutate: exitSuperuser} = useMutation({ + mutationFn: () => + QUERY_API_CLIENT.requestPromise('/auth/superuser/', {method: 'DELETE'}), + onSuccess: () => window.location.reload(), + }); const hasDsnLookup = organization.features.includes('cmd-k-dsn-lookup'); const {projects} = useProjects(); const navigateActions = useNavigationActions(); @@ -330,8 +338,51 @@ export function useGlobalCommandPaletteActions() { const navPrefix = `/organizations/${organization.slug}`; + const adminActions: CommandPaletteAction[] = user.isStaff + ? [ + { + display: { + label: t('Admin'), + }, + actions: [ + { + display: { + label: t('Open _admin'), + icon: , + }, + onAction: () => window.open('/_admin/', '_blank', 'noreferrer'), + }, + { + display: { + label: t('Open %s in _admin', organization.name), + icon: , + }, + onAction: () => + window.open( + `/_admin/organizations/${organization.slug}/`, + '_blank', + 'noreferrer' + ), + }, + ...(isActiveSuperuser() + ? [ + { + display: { + label: t('Exit Superuser'), + icon: , + }, + onAction: () => exitSuperuser(), + }, + ] + : []), + ], + }, + ] + : []; + useCommandPaletteActionsRegister([ ...navigateActions, + ...adminActions, // BEGIN ADD ACTIONS { display: {