mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 11:55:05 +03:00
* Scaffold advisor rules * Wrap up implementation * Add feature flag * Fix type issues * Fix types * fix * Scaffold * Revise UI for advisor rules * Hide edit button * Refactor AdvisorRulesLayout * Some fixes from PR feedback
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import type { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
|
|
import type { Project } from 'data/projects/project-detail-query'
|
|
import { IS_PLATFORM } from 'lib/constants'
|
|
|
|
export const generateAdvisorsMenu = (
|
|
project?: Project,
|
|
features?: { advisorRules: boolean }
|
|
): ProductMenuGroup[] => {
|
|
const ref = project?.ref ?? 'default'
|
|
|
|
return [
|
|
{
|
|
title: 'Advisors',
|
|
items: [
|
|
{
|
|
name: 'Security Advisor',
|
|
key: 'security',
|
|
url: `/project/${ref}/advisors/security`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Performance Advisor',
|
|
key: 'performance',
|
|
url: `/project/${ref}/advisors/performance`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Query Performance',
|
|
key: 'query-performance',
|
|
url: `/project/${ref}/advisors/query-performance`,
|
|
items: [],
|
|
},
|
|
],
|
|
},
|
|
...(IS_PLATFORM && features?.advisorRules
|
|
? [
|
|
{
|
|
title: 'Configuration',
|
|
items: [
|
|
{
|
|
name: 'Advisor Rules',
|
|
key: 'rules',
|
|
url: `/project/${ref}/advisors/rules/security`,
|
|
items: [],
|
|
},
|
|
],
|
|
},
|
|
]
|
|
: []),
|
|
]
|
|
}
|