@@ -34,9 +34,11 @@ import {
3434 IconUser ,
3535} from 'sentry/icons' ;
3636import { t } from 'sentry/locale' ;
37+ import { ConfigStore } from 'sentry/stores/configStore' ;
3738import { apiOptions } from 'sentry/utils/api/apiOptions' ;
3839import { isActiveSuperuser } from 'sentry/utils/isActiveSuperuser' ;
3940import { QUERY_API_CLIENT , useMutation } from 'sentry/utils/queryClient' ;
41+ import { replaceRouterParams } from 'sentry/utils/replaceRouterParams' ;
4042import { useMutateUserOptions } from 'sentry/utils/useMutateUserOptions' ;
4143import { useOrganization } from 'sentry/utils/useOrganization' ;
4244import { useProjects } from 'sentry/utils/useProjects' ;
@@ -50,6 +52,8 @@ import {MOBILE_LANDING_SUB_PATH} from 'sentry/views/insights/pages/mobile/settin
5052import { ISSUE_TAXONOMY_CONFIG } from 'sentry/views/issueList/taxonomies' ;
5153import { useStarredIssueViews } from 'sentry/views/navigation/secondary/sections/issues/issueViews/useStarredIssueViews' ;
5254import { 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
5458import { CMDKAction } from './cmdk' ;
5559import { 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