Skip to content

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

Update database roles page to follow similar layout as wrappers and backups

Joshen Limc0b7dda02acc
diff --git a/studio/components/interfaces/Database/Roles/RolesList.tsx b/studio/components/interfaces/Database/Roles/RolesList.tsx
index c5059c26e05..fd7a2acfd87 100644
--- a/studio/components/interfaces/Database/Roles/RolesList.tsx
+++ b/studio/components/interfaces/Database/Roles/RolesList.tsx
@@ -1,5 +1,5 @@
import { partition } from 'lodash'
-import { FC, useState, useEffect } from 'react'
+import { useState, useEffect } from 'react'
import { observer } from 'mobx-react-lite'
import * as Tooltip from '@radix-ui/react-tooltip'
import { PostgresRole } from '@supabase/postgres-meta'
@@ -14,11 +14,7 @@ import { SUPABASE_ROLES } from './Roles.constants'
import CreateRolePanel from './CreateRolePanel'
import DeleteRoleModal from './DeleteRoleModal'
-interface Props {
- onSelectRole: (role: any) => void
-}
-
-const RolesList: FC<Props> = ({}) => {
+const RolesList = ({}) => {
const { meta } = useStore()
const [maxConnectionLimit, setMaxConnectionLimit] = useState(0)
diff --git a/studio/components/interfaces/Database/Roles/RolesSettings.tsx b/studio/components/interfaces/Database/Roles/RolesSettings.tsx
deleted file mode 100644
index 2ff4c1da8a6..00000000000
--- a/studio/components/interfaces/Database/Roles/RolesSettings.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-import { FC } from 'react'
-import { observer } from 'mobx-react-lite'
-import { Button, IconChevronLeft } from 'ui'
-import Divider from 'components/ui/Divider'
-
-import Panel from 'components/ui/Panel'
-
-interface Props {
- selectedRole: any
- onSelectBack: () => void
-}
-
-const RolesSettings: FC<Props> = ({ selectedRole, onSelectBack = () => {} }) => {
- return (
- <>
- <div className="mb-8">
- <div className="">
- <nav className="-mb-px flex">
- <div className="group mr-4 inline-flex items-center p-1 ">
- <Button
- type="outline"
- onClick={() => onSelectBack()}
- icon={<IconChevronLeft size="small" />}
- style={{ padding: '5px' }}
- />
- </div>
- <a
- href="#"
- className="
- group mx-4
- inline-flex items-center border-b-2 border-green-500 p-1 text-sm font-medium text-typography-body-strong-light focus:outline-none dark:text-typography-body-strong-dark "
- aria-current="page"
- >
- <span>Permissions</span>
- </a>
- </nav>
- </div>
- </div>
-
- <Panel>
- <Panel.Content className="flex w-full items-center justify-between">
- <p className="text-sm">Super user</p>
- <code className="text-sm">{selectedRole.is_superuser ? 'true' : 'false'}</code>
- </Panel.Content>
- <Divider light />
- <Panel.Content className="flex w-full items-center justify-between">
- <p className="text-sm">User can login</p>
- <code className="text-sm">{selectedRole.can_login ? 'true' : 'false'}</code>
- </Panel.Content>
- <Divider light />
- <Panel.Content className="flex w-full items-center justify-between">
- <p className="text-sm">User can create databases</p>
- <code className="text-sm">{selectedRole.can_create_db ? 'true' : 'false'}</code>
- </Panel.Content>
- <Divider light />
- <Panel.Content className="flex w-full items-center justify-between">
- <p className="text-sm">
- User can initiate streaming replication and put the system in and out of backup mode
- </p>
- <code className="text-sm">{selectedRole.is_replication_role ? 'true' : 'false'}</code>
- </Panel.Content>
- <Divider light />
- <Panel.Content className="flex w-full items-center justify-between">
- <p className="text-sm">User bypasses every row level security policy</p>
- <code className="text-sm">{selectedRole.can_bypass_rls ? 'true' : 'false'}</code>
- </Panel.Content>
- </Panel>
- </>
- )
-}
-
-export default observer(RolesSettings)
diff --git a/studio/components/interfaces/Database/index.ts b/studio/components/interfaces/Database/index.ts
index 94c664c2854..f2dabff52f7 100644
--- a/studio/components/interfaces/Database/index.ts
+++ b/studio/components/interfaces/Database/index.ts
@@ -2,7 +2,6 @@ import TableList from './Tables/TableList'
import ColumnList from './Tables/ColumnList'
import RolesList from './Roles/RolesList'
-import RolesSettings from './Roles/RolesSettings'
import Extensions from './Extensions/Extensions'
@@ -27,7 +26,6 @@ export {
TableList,
ColumnList,
RolesList,
- RolesSettings,
Extensions,
Wrappers,
CreateWrapper,
diff --git a/studio/pages/project/[ref]/database/roles/index.tsx b/studio/pages/project/[ref]/database/roles/index.tsx
index 9057f0cfa8e..4a85543cf2f 100644
--- a/studio/pages/project/[ref]/database/roles/index.tsx
+++ b/studio/pages/project/[ref]/database/roles/index.tsx
@@ -1,25 +1,14 @@
-import { useState } from 'react'
import { observer } from 'mobx-react-lite'
-import { isUndefined } from 'lodash'
-
import { DatabaseLayout } from 'components/layouts'
-import { RolesList, RolesSettings } from 'components/interfaces/Database'
+import { RolesList } from 'components/interfaces/Database'
import { NextPageWithLayout } from 'types'
+import { FormsContainer } from 'components/ui/Forms'
const DatabaseRoles: NextPageWithLayout = () => {
- const [selectedRole, setSelectedRole] = useState<any>()
-
return (
- <div className="1xl:px-28 mx-auto flex flex-col px-5 pt-6 pb-14 lg:px-16 xl:px-24 2xl:px-32">
- {isUndefined(selectedRole) ? (
- <RolesList onSelectRole={setSelectedRole} />
- ) : (
- <RolesSettings
- selectedRole={selectedRole}
- onSelectBack={() => setSelectedRole(undefined)}
- />
- )}
- </div>
+ <FormsContainer>
+ <RolesList />
+ </FormsContainer>
)
}