Files
supabase/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.ts
T
Joshen LimandTerry Sutton 94f5fc5a61 Feat/api side panel (#17880)
* Demo api side panel

* Add docs for storage and edge functions

* Add content

* fix

* Add scroll to logic

* Add storage docs

* Add docs URLs

* Add connecting to project section in getting started

* Link back to docs site for product + resource specific docs

* Add entry points into API side panel for table editor, auth users and storage

* Add entry points into API side panel for edge functions

* Beef up feature preview modal with content

* Fix asset path

* Address several feedback

* Addressing more feedback

* Shift GraphiQL page to database if new api docs flag enabled

* Spelling

* Wording changes

* Spacing and wording

* Fix small issues

* Fix

* Update key showing toggle button

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>
2023-10-05 13:30:12 +08:00

103 lines
2.6 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: [],
},
...(isNewAPIDocsEnabled
? [
{
name: 'GraphiQL',
key: 'graphiql',
url: `/project/${ref}/database/graphiql`,
items: [],
},
]
: []),
],
},
]
}