Files
supabase/apps/studio/components/layouts/RealtimeLayout/RealtimeMenu.utils.ts
T
Ivan VasilovandJoshen Lim ee8f901bfd feat: RLS policies for realtime channels (#27490)
* Add queries and mutations for realtime channels.

* Change the layout, add a link for policies and modal for creating a channel.

* Add a page for policies.

* Add templates for realtime tables.

* Fix the spacing in the PolicyDetails component. Add better types.

* Pass templateData to the template generating functions.

* Various CSS fixes.

* Add components for rendering the realtime policies page.

* Fix the editing policy flow.

* Fix refetching when adding or deleting policies.

* Minor various fixes.

* Remove an old console.log.

* More fixes for templates.

* Make the realtime policies open by default when clicking on realtime.

* Update the realtime policy templates.

* Use a dropdown button for the three types of policies.

* Fix a copy-paste mistake.

* Fix icons.

* Fix the toast.

* Clean up the previous components.

* Clean up more unneeded code.

* Remove templateData prop.

* Remove unneeded queries and mutations.

* More cleanup.

* Reuse the components from the Auth Policies.

* Minor fixes for the new components.

* Add a feature flag for AuthZ.

* Revert some changes.

* Fix a build error.

* Fix all definitions.

* Fix an issue with copying large lines which from templates which are word-wrapped.

* Addressed various comments by Joshen.

* Revert the UI changes in the Policy Editor.

* Update the template names.

* Small style fix

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-06-26 13:27:29 +02:00

39 lines
887 B
TypeScript

import type { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
import type { Project } from 'data/projects/project-detail-query'
export const generateRealtimeMenu = (
project: Project,
{ authzEnabled }: { authzEnabled: boolean }
): ProductMenuGroup[] => {
const ref = project?.ref ?? 'default'
return [
{
title: 'Tools',
items: [
{
name: 'Inspector',
key: 'inspector',
url: `/project/${ref}/realtime/inspector`,
items: [],
},
],
},
...(authzEnabled
? [
{
title: 'Configuration',
items: [
{
name: 'Policies',
key: 'policies',
url: `/project/${ref}/realtime/policies`,
items: [],
},
],
},
]
: []),
]
}