Files
supabase/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.ts
T
Joshen LimandTerry Sutton 69d16750a6 Feat/enum types management (#17953)
* Set up react queries for enumerated types

* Add delete enumerated type RQ

* Implement types UI + deleting types

* Implement create enumerated type

* Implement update enumerated type

* Tidy enumb dropdown in table editor

* Fix default value dropdown for enum in column editor

* Remove unused code

* Add create enum type cta in column editor

* Support updating enum description

* Add learn more URL RE inability to delete a single enum value

* Add sorting when creating enums

* Support updating existing values in an enum type

* Support updating order when editing existing enum

* Address comments part 1

* Address comments part 2

* Use lucide icons

* Update icons

* Address comments part 3

* Refactor enum type forms to use react hook form

* Update studio/components/interfaces/Database/EnumeratedTypes/EditEnumeratedTypeSidePanel.tsx

* Update studio/components/interfaces/Database/EnumeratedTypes/EditEnumeratedTypeSidePanel.tsx

* Copy

* Small style fix to API panel

* Use new input components and add alert when creating enum type

* Address comments

* Address comments

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>
2023-10-10 14:08:29 +08:00

109 lines
2.8 KiB
TypeScript

import { Project } from 'types'
import { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
import { IS_PLATFORM } from 'lib/constants'
export const generateDatabaseMenu = (
project?: Project,
flags?: {
pgNetExtensionExists: boolean
isNewAPIDocsEnabled: boolean
}
): ProductMenuGroup[] => {
const ref = project?.ref ?? 'default'
const { pgNetExtensionExists, isNewAPIDocsEnabled } = flags || {}
return [
{
title: 'Database',
items: [
{ name: 'Tables', key: 'tables', url: `/project/${ref}/database/tables`, items: [] },
{
name: 'Schema Visualizer',
key: 'schemas',
url: `/project/${ref}/database/schemas`,
items: [],
},
{
name: 'Triggers',
key: 'triggers',
url: `/project/${ref}/database/triggers`,
items: [],
},
{
name: 'Functions',
key: 'functions',
url: `/project/${ref}/database/functions`,
items: [],
},
{
name: 'Extensions',
key: 'extensions',
url: `/project/${ref}/database/extensions`,
items: [],
},
{ name: 'Roles', key: 'roles', url: `/project/${ref}/database/roles`, items: [] },
{
name: 'Replication',
key: 'replication',
url: `/project/${ref}/database/replication`,
items: [],
},
...(!!pgNetExtensionExists
? [
{
name: 'Webhooks',
key: 'hooks',
url: `/project/${ref}/database/hooks`,
items: [],
},
]
: []),
{
name: 'Wrappers',
key: 'wrappers',
url: `/project/${ref}/database/wrappers`,
items: [],
},
...(IS_PLATFORM
? [
{
name: 'Backups',
key: 'backups',
url: `/project/${ref}/database/backups/scheduled`,
items: [],
},
]
: []),
{
name: 'Migrations',
key: 'migrations',
url: `/project/${ref}/database/migrations`,
items: [],
},
{
name: 'Indexes',
key: 'indexes',
url: `/project/${ref}/database/indexes`,
items: [],
},
{
name: 'Enumerated Types',
key: 'types',
url: `/project/${ref}/database/types`,
items: [],
},
...(isNewAPIDocsEnabled
? [
{
name: 'GraphiQL',
key: 'graphiql',
url: `/project/${ref}/database/graphiql`,
items: [],
},
]
: []),
],
},
]
}