mirror of
https://github.com/supabase/supabase.git
synced 2026-06-20 11:22:25 +08:00
* add basic feature * rename to datasource * rename elements in left sidebar * update copy in titles in left sidebar * Add optional 'enabled' parameter in useLogsQuery hook * Update warehouse query state and components * add template selector for warehouse query builder * update deprecated input compo * fix create token and console warnings * fix type errors * fix dupped import * update endpoints and add missing permissions * update queries with new api path * fix type errors * undo last commit * undo missing file * fix imports in logs page * import fixes * add settings link like in storage menu * sort imports, fix form submit * rename access tokens settings section * align dropdwn * add overflow to templates dropdown * add name as defaultvalue to udpate form * update rm collection dialog * capitalize * Update apps/studio/pages/project/[ref]/logs/explorer/index.tsx Co-authored-by: Joshen Lim <joshenlimek@gmail.com> * fix typo --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
93 lines
2.5 KiB
TypeScript
93 lines
2.5 KiB
TypeScript
import type {
|
|
ProductMenuGroup,
|
|
ProductMenuGroupItem,
|
|
} from 'components/ui/ProductMenu/ProductMenu.types'
|
|
import type { Project } from 'data/projects/project-detail-query'
|
|
import { IS_PLATFORM } from 'lib/constants'
|
|
|
|
export const generateLogsMenu = (
|
|
project?: Project,
|
|
features?: { auth?: boolean; storage?: boolean; realtime?: boolean }
|
|
): ProductMenuGroup[] => {
|
|
const ref = project?.ref ?? 'default'
|
|
|
|
const authEnabled = features?.auth ?? true
|
|
const storageEnabled = features?.storage ?? true
|
|
const realtimeEnabled = features?.realtime ?? true
|
|
|
|
return [
|
|
{
|
|
title: 'Explorer',
|
|
items: (
|
|
[
|
|
{ key: 'explorer', name: 'Query', root: true },
|
|
IS_PLATFORM ? { key: 'saved', name: 'Saved Queries' } : null,
|
|
{ key: 'recent', name: 'Recent Queries' },
|
|
IS_PLATFORM ? { key: 'templates', name: 'Templates' } : null,
|
|
].filter((item) => item) as { name: string; key: string; root: boolean }[]
|
|
).map(({ key, name, root }) => ({
|
|
name,
|
|
key,
|
|
url: `/project/${ref}/logs/explorer${root ? '' : '/' + key}`,
|
|
items: [],
|
|
})),
|
|
},
|
|
{
|
|
title: 'Infrastructure Logs',
|
|
items: [
|
|
{
|
|
name: 'API Gateway',
|
|
key: 'edge-logs',
|
|
url: `/project/${ref}/logs/edge-logs`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Postgres',
|
|
key: 'postgres-logs',
|
|
url: `/project/${ref}/logs/postgres-logs`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'PostgREST',
|
|
key: 'postgrest-logs',
|
|
url: `/project/${ref}/logs/postgrest-logs`,
|
|
items: [],
|
|
},
|
|
IS_PLATFORM
|
|
? {
|
|
name: 'Pooler',
|
|
key: 'pooler-logs',
|
|
url: `/project/${ref}/logs/pooler-logs`,
|
|
items: [],
|
|
}
|
|
: null,
|
|
,
|
|
authEnabled
|
|
? {
|
|
name: 'Auth',
|
|
key: 'auth-logs',
|
|
url: `/project/${ref}/logs/auth-logs`,
|
|
items: [],
|
|
}
|
|
: null,
|
|
storageEnabled
|
|
? {
|
|
name: 'Storage',
|
|
key: 'storage-logs',
|
|
url: `/project/${ref}/logs/storage-logs`,
|
|
items: [],
|
|
}
|
|
: null,
|
|
realtimeEnabled
|
|
? {
|
|
name: 'Realtime',
|
|
key: 'realtime-logs',
|
|
url: `/project/${ref}/logs/realtime-logs`,
|
|
items: [],
|
|
}
|
|
: null,
|
|
].filter((item) => item) as ProductMenuGroupItem[],
|
|
},
|
|
]
|
|
}
|