mirror of
https://github.com/supabase/supabase.git
synced 2026-06-19 19:47:55 +08:00
* Add crons option in the database menu. * Add react-hook-form to the studio package.json. * Refactor the functionSelector to be used by other features. * Add the bulk of the functionality for the cron UI. Some of the code is copy-pasted from functions feature, needs to be cleaned before merging. * Tons of changes, the Create Cron sheet works now. * Added some more functionality for the cronjob feature. * Convert the Cron table to a listing with cards. * Add click-to-copy in the Auth Hooks feature. * Remove extra prop. * Fix type errors. * Fix some random issues. Fix the tests. * Fix the tests. * Add a style for disabled radio button item. * Make the default SQL snippet. Handle the case pg_net is not installed. * Fix the heading and save button when creating a new cron job. * Change the name of the custom label in the schedule dropdown. * Minor fixes. * Rename all mentions of cronjobs to cron jobs. * Always show the cron jobs link. * Rename the link from crons to cron-jobs. * Fix the disabled state for the stacked radio group. * More minor fixes. * More small fixes. * Fix the tests. * Minor UI tweaks * More minor tweaks * Add padding bottom * Add feature flag for the cron ui. * Fix the SQL function option. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
168 lines
4.4 KiB
TypeScript
168 lines
4.4 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'
|
|
import { ArrowUpRight } from 'lucide-react'
|
|
|
|
export const generateDatabaseMenu = (
|
|
project?: Project,
|
|
flags?: {
|
|
pgNetExtensionExists: boolean
|
|
pitrEnabled: boolean
|
|
columnLevelPrivileges: boolean
|
|
cronUiEnabled: boolean
|
|
}
|
|
): ProductMenuGroup[] => {
|
|
const ref = project?.ref ?? 'default'
|
|
const { pgNetExtensionExists, pitrEnabled, columnLevelPrivileges, cronUiEnabled } = flags || {}
|
|
|
|
return [
|
|
{
|
|
title: 'Database Management',
|
|
items: [
|
|
{ name: 'Tables', key: 'tables', url: `/project/${ref}/database/tables`, items: [] },
|
|
{
|
|
name: 'Functions',
|
|
key: 'functions',
|
|
url: `/project/${ref}/database/functions`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Triggers',
|
|
key: 'triggers',
|
|
url: `/project/${ref}/database/triggers`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Enumerated Types',
|
|
key: 'types',
|
|
url: `/project/${ref}/database/types`,
|
|
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Extensions',
|
|
key: 'extensions',
|
|
url: `/project/${ref}/database/extensions`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Indexes',
|
|
key: 'indexes',
|
|
url: `/project/${ref}/database/indexes`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Publications',
|
|
key: 'publications',
|
|
url: `/project/${ref}/database/publications`,
|
|
items: [],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: 'Access Control',
|
|
items: [
|
|
{ name: 'Roles', key: 'roles', url: `/project/${ref}/database/roles`, items: [] },
|
|
...(columnLevelPrivileges
|
|
? [
|
|
{
|
|
name: 'Column Privileges',
|
|
key: 'column-privileges',
|
|
url: `/project/${ref}/database/column-privileges`,
|
|
items: [],
|
|
label: 'ALPHA',
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
name: 'Policies',
|
|
key: 'policies',
|
|
url: `/project/${ref}/auth/policies`,
|
|
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
|
|
items: [],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: 'Platform',
|
|
items: [
|
|
...(IS_PLATFORM
|
|
? [
|
|
{
|
|
name: 'Backups',
|
|
key: 'backups',
|
|
url: pitrEnabled
|
|
? `/project/${ref}/database/backups/pitr`
|
|
: `/project/${ref}/database/backups/scheduled`,
|
|
items: [],
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
name: 'Wrappers',
|
|
key: 'wrappers',
|
|
url: `/project/${ref}/database/wrappers`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Migrations',
|
|
key: 'migrations',
|
|
url: `/project/${ref}/database/migrations`,
|
|
items: [],
|
|
},
|
|
...(!!pgNetExtensionExists
|
|
? [
|
|
{
|
|
name: 'Webhooks',
|
|
key: 'hooks',
|
|
url: `/project/${ref}/database/hooks`,
|
|
items: [],
|
|
},
|
|
]
|
|
: []),
|
|
...(!!cronUiEnabled
|
|
? [
|
|
{
|
|
name: 'Cron Jobs',
|
|
key: 'cron-jobs',
|
|
url: `/project/${ref}/database/cron-jobs`,
|
|
items: [],
|
|
},
|
|
]
|
|
: []),
|
|
],
|
|
},
|
|
{
|
|
title: 'Tools',
|
|
items: [
|
|
{
|
|
name: 'Schema Visualizer',
|
|
key: 'schemas',
|
|
url: `/project/${ref}/database/schemas`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Query Performance',
|
|
key: 'query-performance',
|
|
url: `/project/${ref}/database/query-performance`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Security Advisor',
|
|
key: 'security-advisor',
|
|
url: `/project/${ref}/advisors/security`,
|
|
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Performance Advisor',
|
|
key: 'performance-advisor',
|
|
url: `/project/${ref}/advisors/performance`,
|
|
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
|
|
items: [],
|
|
},
|
|
],
|
|
},
|
|
]
|
|
}
|