Skip to content

Commit 43ccf50

Browse files
authored
ref(cmdk): Ensure nested settings pages are added to Cmdk (#112750)
Ensures sub-pages are added to actions for settings nav. Might get a bit clobbered by #112262 , but I can rebase if needed Tested locally and works great! <img width="698" height="336" alt="Screenshot 2026-04-10 at 4 04 44 PM" src="https://github.com/user-attachments/assets/c10566b5-40fb-4654-8f18-9856c4d8fb80" />
1 parent 3298514 commit 43ccf50

File tree

1 file changed

+57
-7
lines changed

1 file changed

+57
-7
lines changed

static/app/components/commandPalette/ui/commandPaletteGlobalActions.tsx

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ import {
3434
IconUser,
3535
} from 'sentry/icons';
3636
import {t} from 'sentry/locale';
37+
import {ConfigStore} from 'sentry/stores/configStore';
3738
import {apiOptions} from 'sentry/utils/api/apiOptions';
3839
import {isActiveSuperuser} from 'sentry/utils/isActiveSuperuser';
3940
import {QUERY_API_CLIENT, useMutation} from 'sentry/utils/queryClient';
41+
import {replaceRouterParams} from 'sentry/utils/replaceRouterParams';
4042
import {useMutateUserOptions} from 'sentry/utils/useMutateUserOptions';
4143
import {useOrganization} from 'sentry/utils/useOrganization';
4244
import {useProjects} from 'sentry/utils/useProjects';
@@ -50,6 +52,8 @@ import {MOBILE_LANDING_SUB_PATH} from 'sentry/views/insights/pages/mobile/settin
5052
import {ISSUE_TAXONOMY_CONFIG} from 'sentry/views/issueList/taxonomies';
5153
import {useStarredIssueViews} from 'sentry/views/navigation/secondary/sections/issues/issueViews/useStarredIssueViews';
5254
import {getUserOrgNavigationConfiguration} from 'sentry/views/settings/organization/userOrgNavigationConfiguration';
55+
import {getNavigationConfiguration} from 'sentry/views/settings/project/navigationConfiguration';
56+
import type {NavigationGroupProps} from 'sentry/views/settings/types';
5357

5458
import {CMDKAction} from './cmdk';
5559
import {CommandPaletteSlot} from './commandPaletteSlot';
@@ -202,11 +206,32 @@ export function GlobalCommandPaletteActions() {
202206
)}
203207

204208
<CMDKAction display={{label: t('Settings'), icon: <IconSettings />}}>
205-
{getUserOrgNavigationConfiguration().flatMap(section =>
206-
section.items.map(item => (
207-
<CMDKAction key={item.path} display={{label: item.title}} to={item.path} />
208-
))
209-
)}
209+
{getUserOrgNavigationConfiguration().map(section => {
210+
const orgNavContext: NavigationGroupProps = {
211+
...section,
212+
organization,
213+
access: new Set(organization.access ?? []),
214+
features: new Set(organization.features ?? []),
215+
isSelfHosted: ConfigStore.get('isSelfHosted'),
216+
};
217+
return (
218+
<CMDKAction key={section.name} display={{label: section.name}}>
219+
{section.items
220+
.filter(item =>
221+
typeof item.show === 'function'
222+
? item.show(orgNavContext)
223+
: item.show !== false
224+
)
225+
.map(item => (
226+
<CMDKAction
227+
key={item.path}
228+
display={{label: item.title, details: item.description}}
229+
to={replaceRouterParams(item.path, {orgId: organization.slug})}
230+
/>
231+
))}
232+
</CMDKAction>
233+
);
234+
})}
210235
</CMDKAction>
211236

212237
<CMDKAction
@@ -220,8 +245,33 @@ export function GlobalCommandPaletteActions() {
220245
label: project.name,
221246
icon: <ProjectAvatar project={project} size={16} />,
222247
}}
223-
to={`/settings/${organization.slug}/projects/${project.slug}/`}
224-
/>
248+
>
249+
{getNavigationConfiguration({organization, project}).flatMap(section => {
250+
const projectNavContext = {
251+
...section,
252+
organization,
253+
project,
254+
access: new Set(organization.access ?? []),
255+
features: new Set(project.features ?? []),
256+
};
257+
return section.items
258+
.filter(item =>
259+
typeof item.show === 'function'
260+
? item.show(projectNavContext)
261+
: item.show !== false
262+
)
263+
.map(item => (
264+
<CMDKAction
265+
key={item.path}
266+
display={{label: item.title, details: item.description}}
267+
to={replaceRouterParams(item.path, {
268+
orgId: organization.slug,
269+
projectId: project.slug,
270+
})}
271+
/>
272+
));
273+
})}
274+
</CMDKAction>
225275
))}
226276
</CMDKAction>
227277
</CMDKAction>

0 commit comments

Comments
 (0)