Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Update create role into a side panel

Joshen Lim93fdde701baa
diff --git a/packages/ui/src/components/SidePanel/SidePanel.tsx b/packages/ui/src/components/SidePanel/SidePanel.tsx
index e105fe85d91..d04b062b3c2 100644
--- a/packages/ui/src/components/SidePanel/SidePanel.tsx
+++ b/packages/ui/src/components/SidePanel/SidePanel.tsx
@@ -67,7 +67,12 @@ const SidePanel = ({
<Button disabled={loading} type="default" onClick={() => (onCancel ? onCancel() : null)}>
{cancelText}
</Button>
- <Button loading={loading} onClick={() => (onConfirm ? onConfirm() : null)}>
+ <Button
+ htmlType="submit"
+ disabled={loading}
+ loading={loading}
+ onClick={() => (onConfirm ? onConfirm() : null)}
+ >
{confirmText}
</Button>
</div>
diff --git a/packages/ui/src/lib/Layout/FormLayout/FormLayout.tsx b/packages/ui/src/lib/Layout/FormLayout/FormLayout.tsx
index 14262972430..9715d795b1d 100644
--- a/packages/ui/src/lib/Layout/FormLayout/FormLayout.tsx
+++ b/packages/ui/src/lib/Layout/FormLayout/FormLayout.tsx
@@ -148,7 +148,7 @@ export function FormLayout({
>
{labelled && (
<label
- className={[__styles.label.base, __styles.label.size[size], 'break-all'].join(' ')}
+ className={[__styles.label.base, __styles.label.size[size]].join(' ')}
htmlFor={id}
>
{beforeLabel && (
diff --git a/studio/components/interfaces/Database/Roles/CreateRole.tsx b/studio/components/interfaces/Database/Roles/CreateRole.tsx
deleted file mode 100644
index 0b883998392..00000000000
--- a/studio/components/interfaces/Database/Roles/CreateRole.tsx
+++ /dev/null
@@ -1,171 +0,0 @@
-import Link from 'next/link'
-import { FC } from 'react'
-import { useRouter } from 'next/router'
-import * as Tooltip from '@radix-ui/react-tooltip'
-import { Button, Form, Input, IconArrowLeft, IconExternalLink, Toggle, IconHelpCircle } from 'ui'
-
-import { useParams, useStore } from 'hooks'
-import {
- FormActions,
- FormPanel,
- FormsContainer,
- FormSection,
- FormSectionLabel,
- FormSectionContent,
-} from 'components/ui/Forms'
-import { ROLE_PERMISSIONS } from './Roles.constants'
-
-interface Props {}
-
-// [Joshen] There are a lot of other parameters that pg/pg-meta supports for creating a role
-// but these are just the minimal parameters for now
-// https://github.com/supabase/postgres-meta/blob/3b4c3a0ea052389599cf5e2900f7185870d6f60c/src/lib/types.ts#L224
-
-const CreateRole: FC<Props> = ({}) => {
- const router = useRouter()
- const { ref } = useParams()
- const { ui, meta } = useStore()
-
- const formId = 'create-new-role'
- const initialValues = {
- name: '',
- is_superuser: false,
- can_login: false,
- can_create_role: false,
- can_create_db: false,
- is_replication_role: false,
- can_bypass_rls: false,
- }
-
- const onSubmit = async (values: any, { setSubmitting }: any) => {
- setSubmitting(true)
- const res = await meta.roles.create(values)
- if (res.error) {
- setSubmitting(false)
- return ui.setNotification({
- category: 'error',
- message: `Failed to create role: ${res.error.message}`,
- })
- } else {
- ui.setNotification({
- category: 'success',
- message: `Successfully created new role: ${res.name}`,
- })
- router.push(`/project/${ref}/database/roles`)
- }
- }
-
- return (
- <FormsContainer>
- <div>
- <div className="relative flex items-center justify-between mb-6">
- <div
- className={[
- 'transition cursor-pointer',
- 'absolute -left-20 top-1 opacity-75 hover:opacity-100',
- ].join(' ')}
- >
- <Link href={`/project/${ref}/database/roles`}>
- <a>
- <div className="flex items-center space-x-2">
- <IconArrowLeft strokeWidth={1.5} size={14} />
- <p className="text-sm">Back</p>
- </div>
- </a>
- </Link>
- </div>
- <h3 className="mb-2 text-xl text-scale-1200">Create a new role</h3>
- {/* <div className="flex items-center space-x-2">
- <Link href="https://supabase.github.io/wrappers/stripe/">
- <a target="_blank">
- <Button type="default" icon={<IconExternalLink strokeWidth={1.5} />}>
- Documentation
- </Button>
- </a>
- </Link>
- </div> */}
- </div>
-
- <Form id={formId} initialValues={initialValues} onSubmit={onSubmit}>
- {({ isSubmitting, handleReset, values, initialValues }: any) => {
- const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)
- return (
- <FormPanel
- disabled={false}
- footer={
- <div className="flex px-8 py-4">
- <FormActions
- form={formId}
- isSubmitting={isSubmitting}
- hasChanges={hasChanges}
- handleReset={handleReset}
- helper={
- !true
- ? 'You need additional permissions to create a database role'
- : undefined
- }
- />
- </div>
- }
- >
- <FormSection header={<FormSectionLabel>Role Configuration</FormSectionLabel>}>
- <FormSectionContent loading={false}>
- <Input id="name" label="Name" />
- </FormSectionContent>
- </FormSection>
- <FormSection header={<FormSectionLabel>Role Privileges</FormSectionLabel>}>
- <FormSectionContent loading={false}>
- <div className="space-y-[9px]">
- {Object.keys(ROLE_PERMISSIONS).map((permission) => (
- <Toggle
- size="small"
- disabled={ROLE_PERMISSIONS[permission].disabled}
- className={[
- 'roles-toggle',
- ROLE_PERMISSIONS[permission].disabled ? 'opacity-50' : '',
- ].join(' ')}
- key={permission}
- id={permission}
- name={permission}
- label={ROLE_PERMISSIONS[permission].description}
- afterLabel={
- ROLE_PERMISSIONS[permission].disabled && (
- <Tooltip.Root delayDuration={0}>
- <Tooltip.Trigger type="button">
- <IconHelpCircle
- size="tiny"
- strokeWidth={2}
- className="ml-2 relative top-[3px]"
- />
- </Tooltip.Trigger>
- <Tooltip.Content align="center" side="bottom">
- <Tooltip.Arrow className="radix-tooltip-arrow" />
- <div
- className={[
- 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
- 'border border-scale-200 space-y-1',
- ].join(' ')}
- >
- <span className="text-xs">
- This privilege cannot be granted via the dashboard
- </span>
- </div>
- </Tooltip.Content>
- </Tooltip.Root>
- )
- }
- />
- ))}
- </div>
- </FormSectionContent>
- </FormSection>
- </FormPanel>
- )
- }}
- </Form>
- </div>
- </FormsContainer>
- )
-}
-
-export default CreateRole
diff --git a/studio/components/interfaces/Database/Roles/CreateRolePanel.tsx b/studio/components/interfaces/Database/Roles/CreateRolePanel.tsx
new file mode 100644
index 00000000000..c313ec041f5
--- /dev/null
+++ b/studio/components/interfaces/Database/Roles/CreateRolePanel.tsx
@@ -0,0 +1,164 @@
+import { FC, useRef, useState } from 'react'
+import * as Tooltip from '@radix-ui/react-tooltip'
+import { Form, IconHelpCircle, Input, SidePanel, Button, Toggle } from 'ui'
+import { ROLE_PERMISSIONS } from './Roles.constants'
+import { FormSection, FormSectionLabel, FormSectionContent } from 'components/ui/Forms'
+import { useStore } from 'hooks'
+interface Props {
+ visible: boolean
+ onClose: () => void
+}
+
+const CreateRolePanel: FC<Props> = ({ visible, onClose }) => {
+ const formId = 'create-new-role'
+ const submitRef: any = useRef()
+ const { ui, meta } = useStore()
+ const [isSubmitting, setIsSubmitting] = useState(false)
+
+ const initialValues = {
+ name: '',
+ is_superuser: false,
+ can_login: false,
+ can_create_role: false,
+ can_create_db: false,
+ is_replication_role: false,
+ can_bypass_rls: false,
+ }
+
+ const validate = (values: any) => {
+ const errors: any = {}
+ if (values.name.length === 0) errors.name = 'Please provide a name for your role'
+ return errors
+ }
+
+ const onSubmit = async (values: any) => {
+ setIsSubmitting(true)
+ const res = await meta.roles.create(values)
+ setIsSubmitting(false)
+
+ if (res.error) {
+ return ui.setNotification({
+ category: 'error',
+ message: `Failed to create role: ${res.error.message}`,
+ })
+ } else {
+ ui.setNotification({
+ category: 'success',
+ message: `Successfully created new role: ${res.name}`,
+ })
+ onClose()
+ }
+ }
+
+ return (
+ <SidePanel
+ size="large"
+ visible={visible}
+ header="Create a new role"
+ className="mr-0 transform transition-all duration-300 ease-in-out"
+ loading={false}
+ onCancel={onClose}
+ customFooter={
+ <div className="flex w-full justify-end space-x-3 border-t border-scale-500 px-3 py-4">
+ <Button
+ size="tiny"
+ type="default"
+ htmlType="button"
+ onClick={onClose}
+ disabled={isSubmitting}
+ >
+ Cancel
+ </Button>
+ <Button
+ size="tiny"
+ type="primary"
+ htmlType="button"
+ disabled={isSubmitting}
+ loading={isSubmitting}
+ onClick={() => submitRef?.current?.click()}
+ >
+ Create role
+ </Button>
+ </div>
+ }
+ >
+ <Form
+ validateOnBlur
+ id={formId}
+ initialValues={initialValues}
+ validate={validate}
+ onSubmit={onSubmit}
+ >
+ {({ isSubmitting, handleReset, values, initialValues }: any) => {
+ return (
+ <div>
+ <FormSection
+ header={
+ <FormSectionLabel className="lg:!col-span-4">Role Configuration</FormSectionLabel>
+ }
+ >
+ <FormSectionContent loading={false} className="lg:!col-span-8">
+ <Input id="name" label="Name" />
+ </FormSectionContent>
+ </FormSection>
+ <SidePanel.Separator />
+ <FormSection
+ header={
+ <FormSectionLabel className="lg:!col-span-4">Role Privileges</FormSectionLabel>
+ }
+ >
+ <FormSectionContent loading={false} className="lg:!col-span-8">
+ <div className="space-y-[9px]">
+ {Object.keys(ROLE_PERMISSIONS).map((permission) => (
+ <Toggle
+ size="small"
+ disabled={ROLE_PERMISSIONS[permission].disabled}
+ className={[
+ 'roles-toggle',
+ ROLE_PERMISSIONS[permission].disabled ? 'opacity-50' : '',
+ ].join(' ')}
+ key={permission}
+ id={permission}
+ name={permission}
+ label={ROLE_PERMISSIONS[permission].description}
+ afterLabel={
+ ROLE_PERMISSIONS[permission].disabled && (
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Trigger type="button">
+ <IconHelpCircle
+ size="tiny"
+ strokeWidth={2}
+ className="ml-2 relative top-[3px]"
+ />
+ </Tooltip.Trigger>
+ <Tooltip.Content align="center" side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200 space-y-1',
+ ].join(' ')}
+ >
+ <span className="text-xs">
+ This privilege cannot be granted via the dashboard
+ </span>
+ </div>
+ </Tooltip.Content>
+ </Tooltip.Root>
+ )
+ }
+ />
+ ))}
+ </div>
+ </FormSectionContent>
+ </FormSection>
+ <button ref={submitRef} type="submit" className="hidden" />
+ </div>
+ )
+ }}
+ </Form>
+ </SidePanel>
+ )
+}
+
+export default CreateRolePanel
diff --git a/studio/components/interfaces/Database/Roles/RoleRow.tsx b/studio/components/interfaces/Database/Roles/RoleRow.tsx
index 8f4bccd9e16..37e5bd96b93 100644
--- a/studio/components/interfaces/Database/Roles/RoleRow.tsx
+++ b/studio/components/interfaces/Database/Roles/RoleRow.tsx
@@ -12,16 +12,19 @@ import {
IconHelpCircle,
IconMoreVertical,
} from 'ui'
+
+import { useStore } from 'hooks'
import { ROLE_PERMISSIONS } from './Roles.constants'
interface Props {
role: PostgresRole
+ disabled?: boolean
onSelectDelete: (role: PostgresRole) => void
}
-const RoleRow: FC<Props> = ({ role, onSelectDelete }) => {
+const RoleRow: FC<Props> = ({ role, disabled = false, onSelectDelete }) => {
+ const { ui, meta } = useStore()
const [isExpanded, setIsExpanded] = useState(false)
- const [isSaving, setIsSaving] = useState(false)
const {
is_superuser,
@@ -32,10 +35,22 @@ const RoleRow: FC<Props> = ({ role, onSelectDelete }) => {
can_bypass_rls,
} = role
- const onSaveChanges = async (values: any) => {
- setIsSaving(true)
- console.log(values)
- setIsSaving(false)
+ const onSaveChanges = async (values: any, { setSubmitting }: any) => {
+ setSubmitting(true)
+ const res = await meta.roles.update(role.id, values)
+ setSubmitting(false)
+
+ if (res.error) {
+ ui.setNotification({
+ category: 'error',
+ message: `Failed to update role "${role.name}": ${res.error.message}`,
+ })
+ } else {
+ ui.setNotification({
+ category: 'success',
+ message: `Successfully updated role "${role.name}"`,
+ })
+ }
}
return (
@@ -63,7 +78,7 @@ const RoleRow: FC<Props> = ({ role, onSelectDelete }) => {
'last:rounded-bl last:rounded-br',
].join(' ')}
>
- {({ values, initialValues, handleReset }: any) => {
+ {({ values, initialValues, handleReset, isSubmitting }: any) => {
const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)
return (
@@ -79,42 +94,65 @@ const RoleRow: FC<Props> = ({ role, onSelectDelete }) => {
>
<div className="flex items-start space-x-3">
<IconChevronUp
+ id="collapsible-trigger"
className="text-scale-800 transition data-open-parent:rotate-0 data-closed-parent:rotate-180"
strokeWidth={2}
width={14}
/>
<div className="space-x-2 flex items-center">
- <p className="text-left text-sm">{role.name}</p>
- <p className="text-left text-sm text-scale-1000">(ID: {role.id})</p>
+ <p className="text-left text-sm" id="collapsible-trigger">
+ {role.name}
+ </p>
+ <p className="text-left text-sm text-scale-1000" id="collapsible-trigger">
+ (ID: {role.id})
+ </p>
</div>
</div>
<div className="flex items-center space-x-4">
+ {role.active_connections > 0 && (
+ <div className="relative h-2 w-2">
+ <span className="flex h-2 w-2">
+ <span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-brand-900 opacity-75"></span>
+ <span className="relative inline-flex h-2 w-2 rounded-full bg-brand-900 opacity-75"></span>
+ </span>
+ </div>
+ )}
<p
+ id="collapsible-trigger"
className={`text-sm ${
role.active_connections > 0 ? 'text-scale-1100' : 'text-scale-1000'
}`}
>
{role.active_connections} connections
</p>
- <Dropdown
- side="bottom"
- className="w-[120px]"
- overlay={
- <>
- <Dropdown.Item
- icon={<IconTrash className="text-red-800" size="tiny" strokeWidth={2} />}
- onClick={(event: any) => {
- event.stopPropagation()
- onSelectDelete(role)
- }}
- >
- Delete
- </Dropdown.Item>
- </>
- }
- >
- <Button as="span" type="default" className="px-1" icon={<IconMoreVertical />} />
- </Dropdown>
+ {!disabled && (
+ <Dropdown
+ side="bottom"
+ className="w-[120px]"
+ overlay={
+ <>
+ <Dropdown.Item
+ icon={
+ <IconTrash className="text-red-800" size="tiny" strokeWidth={2} />
+ }
+ onClick={(event: any) => {
+ event.stopPropagation()
+ onSelectDelete(role)
+ }}
+ >
+ Delete
+ </Dropdown.Item>
+ </>
+ }
+ >
+ <Button
+ as="span"
+ type="default"
+ className="px-1"
+ icon={<IconMoreVertical />}
+ />
+ </Dropdown>
+ )}
</div>
</button>
</Collapsible.Trigger>
@@ -128,12 +166,13 @@ const RoleRow: FC<Props> = ({ role, onSelectDelete }) => {
id={permission}
name={permission}
label={ROLE_PERMISSIONS[permission].description}
- disabled={ROLE_PERMISSIONS[permission].disabled}
+ disabled={disabled || ROLE_PERMISSIONS[permission].disabled}
className={[
'roles-toggle',
ROLE_PERMISSIONS[permission].disabled ? 'opacity-50' : '',
].join(' ')}
afterLabel={
+ !disabled &&
ROLE_PERMISSIONS[permission].disabled && (
<Tooltip.Root delayDuration={0}>
<Tooltip.Trigger type="button">
@@ -162,18 +201,25 @@ const RoleRow: FC<Props> = ({ role, onSelectDelete }) => {
/>
))}
</div>
- <div className="py-4 flex items-center space-x-2 justify-end">
- <Button
- type="default"
- disabled={!hasChanges || isSaving}
- onClick={() => handleReset()}
- >
- Cancel
- </Button>
- <Button type="primary" disabled={!hasChanges || isSaving} loading={isSaving}>
- Save
- </Button>
- </div>
+ {!disabled && (
+ <div className="py-4 flex items-center space-x-2 justify-end">
+ <Button
+ type="default"
+ disabled={!hasChanges || isSubmitting}
+ onClick={() => handleReset()}
+ >
+ Cancel
+ </Button>
+ <Button
+ type="primary"
+ htmlType="submit"
+ disabled={!hasChanges || isSubmitting}
+ loading={isSubmitting}
+ >
+ Save
+ </Button>
+ </div>
+ )}
</div>
</Collapsible.Content>
</Collapsible>
diff --git a/studio/components/interfaces/Database/Roles/RolesList.tsx b/studio/components/interfaces/Database/Roles/RolesList.tsx
index c8290fde5db..1195188b429 100644
--- a/studio/components/interfaces/Database/Roles/RolesList.tsx
+++ b/studio/components/interfaces/Database/Roles/RolesList.tsx
@@ -1,15 +1,17 @@
-import Link from 'next/link'
import { FC, useState } from 'react'
import { observer } from 'mobx-react-lite'
import * as Tooltip from '@radix-ui/react-tooltip'
import { PostgresRole } from '@supabase/postgres-meta'
-import { Button, Input, IconPlus, IconSearch } from 'ui'
+import { Button, Input, IconPlus, IconSearch, IconX, Badge } from 'ui'
import { useParams, useStore } from 'hooks'
import SparkBar from 'components/ui/SparkBar'
import { FormHeader } from 'components/ui/Forms'
import RoleRow from './RoleRow'
import DeleteRoleModal from './DeleteRoleModal'
+import { SUPABASE_ROLES } from './Roles.constants'
+import { partition } from 'lodash'
+import CreateRolePanel from './CreateRolePanel'
interface Props {
onSelectRole: (role: any) => void
@@ -21,6 +23,7 @@ const RolesList: FC<Props> = ({}) => {
const [filterString, setFilterString] = useState('')
const [filterType, setFilterType] = useState<'all' | 'active'>('all')
+ const [isCreatingRole, setIsCreatingRole] = useState(false)
const [selectedRoleToDelete, setSelectedRoleToDelete] = useState<any>()
const roles = meta.roles.list()
@@ -29,6 +32,9 @@ const RolesList: FC<Props> = ({}) => {
? meta.roles.list((role: PostgresRole) => role.active_connections > 0)
: meta.roles.list()
).filter((role: PostgresRole) => role.name.includes(filterString))
+ const [supabaseRoles, otherRoles] = partition(filteredRoles, (role: PostgresRole) =>
+ SUPABASE_ROLES.includes(role.name)
+ )
const connectionLimit = Math.max(...roles.map((role: PostgresRole) => role.connection_limit))
const totalActiveConnections = roles
@@ -54,12 +60,25 @@ const RolesList: FC<Props> = ({}) => {
size="small"
placeholder="Search for a role"
icon={<IconSearch size="tiny" />}
+ value={filterString}
onChange={(event: any) => setFilterString(event.target.value)}
+ actions={
+ filterString && (
+ <Button
+ size="tiny"
+ type="text"
+ onClick={() => setFilterString('')}
+ className="px-1 mr-1"
+ >
+ <IconX size={12} strokeWidth={2} />
+ </Button>
+ )
+ }
/>
<div className="flex items-center border border-scale-700 rounded-full w-min h-[34px]">
<button
className={[
- 'text-sm w-[100px] h-full text-center rounded-l-full flex items-center justify-center transition',
+ 'text-xs w-[90px] h-full text-center rounded-l-full flex items-center justify-center transition',
filterType === 'all'
? 'bg-scale-500 text-scale-1200'
: 'hover:bg-scale-400 text-scale-1100',
@@ -71,7 +90,7 @@ const RolesList: FC<Props> = ({}) => {
<div className="h-full w-[1px] border-r border-scale-700"></div>
<button
className={[
- 'text-sm w-[100px] h-full text-center rounded-r-full flex items-center justify-center transition',
+ 'text-xs w-[90px] h-full text-center rounded-r-full flex items-center justify-center transition',
filterType === 'active'
? 'bg-scale-500 text-scale-1200'
: 'hover:bg-scale-400 text-scale-1100',
@@ -119,31 +138,58 @@ const RolesList: FC<Props> = ({}) => {
</div>
</Tooltip.Content>
</Tooltip.Root>
- <Link href={`/project/${ref}/database/roles/new`}>
- <a>
- <Button type="primary" icon={<IconPlus size="tiny" />}>
- Add role
- </Button>
- </a>
- </Link>
+ <Button
+ type="primary"
+ icon={<IconPlus size="tiny" />}
+ onClick={() => setIsCreatingRole(true)}
+ >
+ Add role
+ </Button>
</div>
</div>
- <div>
- {filteredRoles.map((role: PostgresRole, i: number) => (
- <RoleRow key={role.id} role={role} onSelectDelete={setSelectedRoleToDelete} />
- ))}
- {filterString.length > 0 && filteredRoles.length === 0 && (
- <div className="bg-scale-100 dark:bg-scale-300 border border-scale-300 dark:border-scale-500 px-6 py-4 rounded space-y-1">
- <p className="text-sm text-scale-1100">No results found</p>
- <p className="text-sm text-scale-1000">
- Your search for "{filterString}" did not return any results
- </p>
- </div>
- )}
+ <div className="space-y-4">
+ <div>
+ {supabaseRoles.length > 0 && (
+ <div className="bg-scale-100 dark:bg-scale-200 border border-scale-300 dark:border-scale-500 px-6 py-3 rounded-t flex items-center space-x-4">
+ <p className="text-sm text-scale-1100">Roles from Supabase</p>
+ <Badge color="green">Protected</Badge>
+ </div>
+ )}
+ {supabaseRoles.map((role: PostgresRole, i: number) => (
+ <RoleRow
+ disabled
+ key={role.id}
+ role={role}
+ onSelectDelete={setSelectedRoleToDelete}
+ />
+ ))}
+ </div>
+
+ <div>
+ {otherRoles.length > 0 && (
+ <div className="bg-scale-100 dark:bg-scale-200 border border-scale-300 dark:border-scale-500 px-6 py-3 rounded-t">
+ <p className="text-sm text-scale-1100">Other database roles</p>
+ </div>
+ )}
+ {otherRoles.map((role: PostgresRole, i: number) => (
+ <RoleRow key={role.id} role={role} onSelectDelete={setSelectedRoleToDelete} />
+ ))}
+ </div>
</div>
+
+ {filterString.length > 0 && filteredRoles.length === 0 && (
+ <div className="bg-scale-100 dark:bg-scale-300 border border-scale-300 dark:border-scale-500 px-6 py-4 rounded space-y-1">
+ <p className="text-sm text-scale-1100">No results found</p>
+ <p className="text-sm text-scale-1000">
+ Your search for "{filterString}" did not return any results
+ </p>
+ </div>
+ )}
</div>
+ <CreateRolePanel visible={isCreatingRole} onClose={() => setIsCreatingRole(false)} />
+
<DeleteRoleModal
role={selectedRoleToDelete}
visible={selectedRoleToDelete !== undefined}
diff --git a/studio/pages/project/[ref]/database/roles/new.tsx b/studio/pages/project/[ref]/database/roles/new.tsx
deleted file mode 100644
index 5b234350727..00000000000
--- a/studio/pages/project/[ref]/database/roles/new.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { observer } from 'mobx-react-lite'
-import { PermissionAction } from '@supabase/shared-types/out/constants'
-
-import { DatabaseLayout } from 'components/layouts'
-import { NextPageWithLayout } from 'types'
-import { checkPermissions } from 'hooks'
-import NoPermission from 'components/ui/NoPermission'
-import CreateRole from 'components/interfaces/Database/Roles/CreateRole'
-
-const CreateNewRole: NextPageWithLayout = () => {
- const canReadRoles = checkPermissions(PermissionAction.TENANT_SQL_ADMIN_READ, 'roles')
- if (!canReadRoles) {
- return <NoPermission isFullPage resourceText="view database roles" />
- }
-
- return <CreateRole />
-}
-
-CreateNewRole.getLayout = (page) => <DatabaseLayout title="Database">{page}</DatabaseLayout>
-
-export default observer(CreateNewRole)