Skip to content

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

Merge branch 'master' into feat/abac

Jonathan Summers-Muirea2653b94af2
diff --cc studio/components/interfaces/Billing/Subscription/Subscription.tsx
index 9b9f5cdc85b,470f6625baa..2b82b6cd11a
--- a/studio/components/interfaces/Billing/Subscription/Subscription.tsx
+++ b/studio/components/interfaces/Billing/Subscription/Subscription.tsx
@@@ -1,18 -1,17 +1,21 @@@
--import { FC } from 'react'
++import { Button, Loading } from '@supabase/ui'
import dayjs from 'dayjs'
import { sum } from 'lodash'
import { useRouter } from 'next/router'
- import { Button, Loading } from '@supabase/ui'
-import { Loading, Button } from '@supabase/ui'
++import { FC } from 'react'
- import { formatBytes } from 'lib/helpers'
++import { usePermissions, useStore } from 'hooks'
+import { STRIPE_PRODUCT_IDS } from 'lib/constants'
- import { usePermissions, useStore, useSubscriptionStats } from 'hooks'
- import CostBreakdownRow from './CostBreakdownRow'
- import { StripeSubscription } from './Subscription.types'
- import { deriveFeatureCost, deriveProductCost } from '../PAYGUsage/PAYGUsage.utils'
+ import { formatBytes } from 'lib/helpers'
-import { PRICING_TIER_PRODUCT_IDS, STRIPE_PRODUCT_IDS } from 'lib/constants'
-import { useStore, useFlag } from 'hooks'
-import CostBreakdownRow from './CostBreakdownRow'
-import { StripeSubscription } from './Subscription.types'
-import { deriveFeatureCost, deriveProductCost } from '../PAYGUsage/PAYGUsage.utils'
++
++import { PermissionAction } from '@supabase/shared-types/out/constants'
++import { useFlag } from 'hooks'
++import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
import { chargeableProducts } from '../PAYGUsage/PAYGUsage.constants'
import { PaygStats, ProductFeature } from '../PAYGUsage/PAYGUsage.types'
- import { PermissionAction } from '@supabase/shared-types/out/constants'
++import { deriveFeatureCost, deriveProductCost } from '../PAYGUsage/PAYGUsage.utils'
++import CostBreakdownRow from './CostBreakdownRow'
++import { StripeSubscription } from './Subscription.types'
interface Props {
project: any
@@@ -36,16 -35,13 +39,18 @@@ const Subscription: FC<Props> = (
const router = useRouter()
const { ui } = useStore()
const isOrgOwner = ui.selectedOrganization?.is_owner
+ const projectUpdateDisabled = useFlag('disableProjectCreationAndUpdate')
+ const canChangeSubscription = usePermissions(
+ PermissionAction.BILLING_WRITE,
+ 'stripe.subscriptions'
+ )
+
const isPayg = subscription?.tier.prod_id === STRIPE_PRODUCT_IDS.PAYG
+ const isEnterprise = subscription.tier.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.ENTERPRISE
+
const addOns = subscription?.addons ?? []
const paid = subscription && subscription.tier.unit_amount > 0
-
const basePlanCost = subscription?.tier.unit_amount / 100
const deriveTotalCost = (): number => {
diff --cc studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
index d8c26f34f2c,086546ada09..07ca2162dce
--- a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
@@@ -1,16 -1,15 +1,16 @@@
--import { FC, useRef } from 'react'
--import { useRouter } from 'next/router'
- import { observer } from 'mobx-react-lite'
- import { find, isUndefined } from 'lodash'
- import { Dictionary, parseSupaTable, SupabaseGrid, SupabaseGridRef } from '@supabase/grid'
++import { Dictionary, parseSupaTable, SupabaseGrid, SupabaseGridRef } from 'components/grid'
+import { PostgresColumn, PostgresTable } from '@supabase/postgres-meta'
++import { find, isUndefined } from 'lodash'
+ import { observer } from 'mobx-react-lite'
-import { isUndefined, find } from 'lodash'
-import { SupabaseGrid, SupabaseGridRef, parseSupaTable, Dictionary } from 'components/grid'
-import { PostgresTable, PostgresColumn } from '@supabase/postgres-meta'
++import { useRouter } from 'next/router'
++import { FC, useRef } from 'react'
-import { useStore } from 'hooks'
-import NotFoundState from './NotFoundState'
++import { PermissionAction } from '@supabase/shared-types/out/constants'
++import { SchemaView } from 'components/layouts/TableEditorLayout/TableEditorLayout.types'
+import { usePermissions, useStore } from 'hooks'
- import NotFoundState from './NotFoundState'
import GridHeaderActions from './GridHeaderActions'
++import NotFoundState from './NotFoundState'
import SidePanelEditor from './SidePanelEditor'
--import { SchemaView } from 'components/layouts/TableEditorLayout/TableEditorLayout.types'
- import { PermissionAction } from '@supabase/shared-types/out/constants'
interface Props {
/** Theme for the editor */
@@@ -64,13 -63,11 +64,17 @@@ const TableGridEditor: FC<Props> = (
}
const tableId = selectedTable?.id
+ const canAdminWrite = usePermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, String(tableId))
+ const canInsert = usePermissions(PermissionAction.TENANT_SQL_INSERT, String(tableId))
+ const canUpdate = usePermissions(PermissionAction.TENANT_SQL_UPDATE, String(tableId))
+ // const canEdit = canAdminWrite && canInsert && canUpdate
+ const canEdit = true
+
+ // @ts-ignore
+ const schema = meta.schemas.list().find((schema) => schema.name === selectedSchema)
const isViewSelected = Object.keys(selectedTable).length === 2
+ const isLocked = meta.excludedSchemas.includes(schema?.name ?? '')
+
const gridTable = !isViewSelected
? parseSupaTable({
table: selectedTable as PostgresTable,
@@@ -140,7 -138,7 +145,7 @@@
theme={theme}
gridProps={{ height: '100%' }}
storageRef={projectRef}
- editable={!isViewSelected && selectedTable.schema === 'public' && canEdit}
- editable={!isViewSelected && !isLocked}
++ editable={!isViewSelected && !isLocked && canEdit}
schema={selectedTable.schema}
table={gridTable}
headerActions={
diff --cc studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx
index 09d2e7d94dc,dd8f38a36dd..468728720e4
--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx
+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.tsx
@@@ -1,13 -1,13 +1,13 @@@
--import React, { FC } from 'react'
--import Link from 'next/link'
++import { Button, Dropdown, IconHome, IconSettings, IconUser } from '@supabase/ui'
++import { isUndefined } from 'lodash'
import { observer } from 'mobx-react-lite'
++import Link from 'next/link'
import { useRouter } from 'next/router'
--import { isUndefined } from 'lodash'
- import { Button, Dropdown, IconHome, IconSettings, IconUser } from '@supabase/ui'
-import { Button, IconHome, Dropdown, IconUser, IconSettings } from '@supabase/ui'
++import { FC } from 'react'
++import { useFlag, useStore } from 'hooks'
import { IS_PLATFORM } from 'lib/constants'
- import { useStore } from 'hooks'
-import { useStore, useFlag } from 'hooks'
-import { generateProductRoutes, generateOtherRoutes } from './NavigationBar.utils'
+import { generateOtherRoutes, generateProductRoutes } from './NavigationBar.utils'
import NavigationIconButton from './NavigationIconButton'
interface Props {}
diff --cc studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
index c705f0a42a5,0606720ca9b..f64216f8275
--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
@@@ -1,24 -1,22 +1,23 @@@
import {
- IconUsers,
- IconFileText,
IconArchive,
- IconSettings,
- IconDatabase,
IconBarChart,
- IconList,
IconCode,
+ IconDatabase,
+ IconFileText,
+ IconList,
+ IconSettings,
- IconUsers,
++ IconUsers
} from '@supabase/ui'
import SVG from 'react-inlinesvg'
--import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'
import { Route } from 'components/ui/ui.types'
++import { IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'
- import { useFlag, usePermissions } from 'hooks'
- import { ProjectBase } from 'types'
-import { useFlag } from 'hooks'
+import { PermissionAction } from '@supabase/shared-types/out/constants'
++import { usePermissions } from 'hooks'
+ import { ProjectBase } from 'types'
export const generateProductRoutes = (ref: string, project?: ProjectBase): Route[] => {
- const functionsUi = useFlag('functionsUi')
const isProjectBuilding = project?.status !== PROJECT_STATUS.ACTIVE_HEALTHY
const buildingUrl = `/project/${ref}/building`
diff --cc studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx
index 95e4d6ecf50,537268647ee..8e61fea4c2e
--- a/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx
+++ b/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx
@@@ -1,22 -1,23 +1,23 @@@
-import { FC, useState, useEffect } from 'react'
+import { FC, useEffect, useState } from 'react'
import { useRouter } from 'next/router'
import Link from 'next/link'
+ import { partition } from 'lodash'
import {
+ Alert,
Button,
Dropdown,
- Typography,
- Listbox,
- Menu,
- Input,
- IconCopy,
IconChevronDown,
+ IconCopy,
IconEdit,
- IconTrash,
- IconSearch,
- IconX,
IconLoader,
IconRefreshCw,
- Alert,
+ IconSearch,
+ IconTrash,
+ IconX,
+ Input,
+ Listbox,
+ Menu,
+ Typography,
} from '@supabase/ui'
import { PostgresSchema, PostgresTable } from '@supabase/postgres-meta'
diff --cc studio/hooks/queries/useOrganizationDetail.ts
index 51a5bf0eb4b,589407972c8..a22ef2ec7ca
--- a/studio/hooks/queries/useOrganizationDetail.ts
+++ b/studio/hooks/queries/useOrganizationDetail.ts
@@@ -4,13 -4,36 +4,37 @@@ import { Member } from 'types
import { API_URL } from 'lib/constants'
export function useOrganizationDetail(slug: string) {
+ // Get org members
- const url = `${API_URL}/props/org/${slug}`
+ const url = `${API_URL}/props/org/${slug}?member_roles`
const { data, error } = useSWR<any>(url, get)
- const members = data?.members ?? []
- const anyError = data?.error || error
+ let { members, products } = data ?? []
+
+ // Get pending invite users
+ const pendingInviteUrl = `${API_URL}/organizations/${slug}/members/invite`
+ const { data: inviteData, error: inviteError } = useSWR<any>(pendingInviteUrl, get)
+
+ if (data && inviteData && inviteData.length > 0) {
+ // remap invite data to look like existing members data
+ const invitedMembers = inviteData.map((x: any) => ({
+ is_owner: false,
+ invited_at: x.invited_at,
+ invited_id: x.invited_id,
+ profile: {
+ // Use the first letter of the email to allow for member list sorting
+ username: x.invited_email.slice(0, 1),
+ primary_email: x.invited_email,
+ },
+ }))
+
+ members = [...members, ...invitedMembers]
+ }
+
+ const anyError = data?.error || error || inviteError
+
+
function mutateOrgMembers(updatedMembers: Member[], revalidate?: boolean) {
mutate(url, { members: updatedMembers }, revalidate ?? true)
+ mutate(pendingInviteUrl, {}, revalidate ?? true)
}
return {
diff --cc studio/package.json
index f3bb1ca73fd,fae49c445ed..2df58382bc3
--- a/studio/package.json
+++ b/studio/package.json
@@@ -33,9 -36,11 +36,12 @@@
"configcat-js": "^5.6.0",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.0",
+ "json-logic-js": "^2.0.2",
+ "file-saver": "^2.0.5",
+ "generate-password": "^1.7.0",
+ "immutability-helper": "^3.1.1",
"lodash": "^4.17.21",
- "lottie-react": "^2.1.0",
+ "lottie-react": "^2.2.1",
"markdown-table": "=2.0.0",
"mobx": "^6.3.2",
"mobx-react-lite": "^3.2.0",
@@@ -80,7 -94,7 +95,8 @@@
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"@types/crypto-js": "^4.0.2",
+ "@types/json-logic-js": "^1.2.1",
+ "@types/file-saver": "^2.0.2",
"@types/lodash": "^4.14.172",
"@types/markdown-table": "^3.0.0",
"@types/papaparse": "^5.3.1",
diff --cc studio/pages/org/[slug]/settings.tsx
index 8a34ef49981,dc8dff77e13..ff18965e0b1
--- a/studio/pages/org/[slug]/settings.tsx
+++ b/studio/pages/org/[slug]/settings.tsx
@@@ -1,40 -1,41 +1,43 @@@
- import { createContext, useContext, useEffect, useState } from 'react'
-import { createContext, useEffect, useContext, useState } from 'react'
--import { useRouter } from 'next/router'
--import { observer, useLocalObservable } from 'mobx-react-lite'
--import { toJS } from 'mobx'
--import { pluckJsonSchemaFields, pluckObjectFields, timeout } from 'lib/helpers'
--import { AutoField } from 'uniforms-bootstrap4'
--import { organizations } from 'stores/jsonSchema'
import {
- Loading,
- Button,
+ Alert,
+ Badge,
+ Button,
+ Dropdown,
+ Form,
IconMoreHorizontal,
- Tabs,
- Typography,
+ IconSearch,
IconTrash,
- Alert,
Input,
- Dropdown,
+ Loading,
Modal,
- IconSearch,
+ Tabs,
+ Typography,
+ IconUser,
- Form,
} from '@supabase/ui'
++import { pluckJsonSchemaFields, pluckObjectFields, timeout } from 'lib/helpers'
++import { toJS } from 'mobx'
++import { observer, useLocalObservable } from 'mobx-react-lite'
++import { useRouter } from 'next/router'
++import { createContext, useContext, useEffect, useState } from 'react'
++import { organizations } from 'stores/jsonSchema'
++import { AutoField } from 'uniforms-bootstrap4'
--import { API_URL } from 'lib/constants'
-import { useOrganizationDetail, useStore, withAuth } from 'hooks'
-import { post, delete_, patch } from 'lib/common/fetch'
-import { AccountLayoutWithoutAuth } from 'components/layouts'
+ import { BillingSettings, InvoicesSettings } from 'components/interfaces/Organization'
++import { AccountLayoutWithoutAuth } from 'components/layouts'
+import { useOrganizationDetail, usePermissions, useStore, withAuth } from 'hooks'
+import { delete_, get, patch, post } from 'lib/common/fetch'
- import { AccountLayoutWithoutAuth } from 'components/layouts'
- import { BillingSettings, InvoicesSettings } from 'components/interfaces/Organization'
++import { API_URL } from 'lib/constants'
--import Table from 'components/to-be-cleaned/Table'
- import Panel from 'components/to-be-cleaned/Panel'
-import Panel from 'components/ui/Panel'
-import { confirmAlert } from 'components/to-be-cleaned/ModalsDeprecated/ConfirmModal'
++import { PermissionAction } from '@supabase/shared-types/out/constants'
+ import InviteMemberModal from 'components/interfaces/Organization/InviteMemberModal'
-import TextConfirmModal from 'components/ui/Modals/TextConfirmModal'
+ import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel'
-import { Member, NextPageWithLayout, Project } from 'types'
+import { confirmAlert } from 'components/to-be-cleaned/ModalsDeprecated/ConfirmModal'
- import InviteMemberModal from 'components/to-be-cleaned/ModalsDeprecated/InviteMemberModal'
++import Table from 'components/to-be-cleaned/Table'
+import TextConfirmModal from 'components/ui/Modals/TextConfirmModal'
- import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel'
- import { NextPageWithLayout, Project } from 'types'
++import Panel from 'components/ui/Panel'
+import useSWR from 'swr'
- import { PermissionAction } from '@supabase/shared-types/out/constants'
++import { Member, NextPageWithLayout, Project, User } from 'types'
+ import Image from 'next/image'
// [Joshen] Low prio refactor: Bring out general and team settings into their own components too
@@@ -49,20 -60,27 +62,30 @@@ const OrgSettingsLayout = withAuth
organization: {},
projects: [],
members: [],
- products: [],
membersFilterString: '',
get isOrgOwner() {
- return this.members.find((x: any) => x.user_id === this.user?.id && x.is_owner) != undefined
++ console.log(this.members[0])
++ console.log(this.user.id)
+ return (
- this.members.find((x: any) => x.profile.id === this.user?.id && x.is_owner) != undefined
++ this.members.find((x: Member) => {
++ return x.profile.id === this.user?.id && x.is_owner
++ }) != undefined
+ )
},
get filteredMembers() {
- const temp = this.members.filter(
- ({ username, primary_email }: { username: string; primary_email: string }) => {
+ const temp = this.members.filter((x: any) => {
+ let profile = x.profile
+ if (profile) {
return (
- username.includes(this.membersFilterString) ||
- primary_email.includes(this.membersFilterString)
+ profile.username.includes(this.membersFilterString) ||
+ profile.primary_email.includes(this.membersFilterString)
)
}
- )
- return temp.sort((a: any, b: any) => a.username.localeCompare(b.username))
+ if (x.invited_email) {
+ return x.invited_email.includes(this.membersFilterString)
+ }
+ })
+ return temp.sort((a: any, b: any) => a.profile.username.localeCompare(b.profile.username))
},
initData(organization: any, user: any, projects: any) {
this.organization = organization
@@@ -508,19 -529,24 +549,29 @@@ const MembersView = observer(() =>
</div>
</div>
</Table.td>
+
+ <Table.td>
+ {x.invited_id && (
+ <Badge color={inviteExpired(x.invited_at) ? 'yellow' : 'red'}>
+ {inviteExpired(x.invited_at) ? 'Invited' : 'Expired'}
+ </Badge>
+ )}
+ </Table.td>
+
<Table.td>
<Typography.Text type="secondary">
- {x.is_owner ? 'Owner' : 'Developer'}
+ {roles &&
++ x.role_ids &&
+ x.role_ids
+ .map((roleId) => roles.find(({ id }) => roleId === id).name)
+ .sort()
+ .join(', ')}
</Typography.Text>
</Table.td>
<Table.td>
-- {PageState.isOrgOwner && !x.is_owner && (
++ {PageState.isOrgOwner && (
// @ts-ignore
- <OwnerDropdown members={PageState.members} member={x} />
+ <OwnerDropdown members={PageState.members} member={x} roles={roles} />
)}
</Table.td>
</Table.tr>
@@@ -615,43 -633,53 +661,86 @@@ const OwnerDropdown = observer(({ membe
if (newOwner) newOwner.is_owner = true
mutateOrgMembers(updatedMembers)
setOwnerTransferIsVisble(false)
- ui.setNotification({ category: 'success', message: 'Successfully transfered organization' })
+ ui.setNotification({
+ category: 'success',
+ message: 'Successfully transfered organization',
+ })
+ }
+ }
+
+ async function handleRoleChecked(checked: boolean, roleId: number) {
+ setLoading(true)
+ const response = await (checked ? post : delete_)(
+ `${API_URL}/users/${member.gotrue_id}/roles/${roleId}`,
+ {}
+ )
+ if (response.error) {
+ ui.setNotification({
+ category: 'error',
+ message: `Failed to ${checked ? 'add' : 'remove'} member's role: ${response.error.message}`,
+ })
+ } else {
+ const updatedMembers = [...members]
+ const updatedMember = updatedMembers.find((x) => x.id == member.id)
+ if (checked) {
+ updatedMember.role_ids.push(roleId)
+ } else {
+ updatedMember.role_ids = updatedMember.role_ids.filter(
+ (role_id: number) => role_id != roleId
+ )
+ }
+ mutateOrgMembers(updatedMembers)
+ ui.setNotification({
+ category: 'success',
+ message: `Successfully ${checked ? 'added' : 'removed'} member's role`,
+ })
}
+ setLoading(false)
}
+ async function handleResendInvite(member: Member) {
+ setLoading(true)
+
+ const response = await post(`${API_URL}/organizations/${orgSlug}/members/invite`, {
+ invited_email: member.profile.primary_email,
+ owner_id: member.invited_id,
+ })
+
+ if (response.error) {
+ ui.setNotification({
+ category: 'error',
+ message: `Failed to resend invitation: ${response.error.message}`,
+ })
+ setLoading(false)
+ } else {
+ const updatedMembers = [...members]
+ mutateOrgMembers(updatedMembers)
+ ui.setNotification({ category: 'success', message: 'Resent the invitation.' })
+ setLoading(false)
+ }
+ }
+
+ async function handleRevokeInvitation(id: number) {
+ setLoading(true)
+
+ const response = await delete_(
+ `${API_URL}/organizations/${orgSlug}/members/invite?invited_id=${id}`,
+ {}
+ )
+
+ if (response.error) {
+ ui.setNotification({
+ category: 'error',
+ message: `Failed to revoke invitation: ${response.error.message}`,
+ })
+ setLoading(false)
+ } else {
+ const updatedMembers = [...members]
+ mutateOrgMembers(updatedMembers)
+ ui.setNotification({ category: 'success', message: 'Successfully revoked the invitation.' })
+ }
+ }
+
return (
<div className="flex items-center justify-end">
<Dropdown
@@@ -659,28 -687,46 +748,59 @@@
align="end"
overlay={
<>
+ <Dropdown.Label>Roles</Dropdown.Label>
- {roles
- ?.filter(({ name }: { name: string }) => name !== 'Owner')
- .map(({ id, name }: { id: number; name: string }) => (
- <Dropdown.Checkbox
- checked={member.role_ids.includes(id)}
- onChange={(checked) => handleRoleChecked(checked, id)}
- >
- {name}
- </Dropdown.Checkbox>
- ))}
++ {roles &&
++ roles
++ ?.filter(({ name }: { name: string }) => name !== 'Owner')
++ .map(({ id, name }: { id: number; name: string }) => (
++ <Dropdown.Checkbox
++ checked={member?.role_ids?.includes(id)}
++ onChange={(checked) => handleRoleChecked(checked, id)}
++ >
++ {name}
++ </Dropdown.Checkbox>
++ ))}
+ <Dropdown.Seperator />
- <Dropdown.Item onClick={() => setOwnerTransferIsVisble(!ownerTransferIsVisble)}>
- <div className="flex flex-col">
- <p>Make owner</p>
- <p className="block opacity-50">Transfer ownership of "{orgName}"</p>
- </div>
- </Dropdown.Item>
- <Dropdown.Seperator />
- <Dropdown.Item icon={<IconTrash size="tiny" />} onClick={handleMemberDelete}>
- Remove member
- </Dropdown.Item>
+ {!member.invited_at && (
+ <Dropdown.Item onClick={() => setOwnerTransferIsVisble(!ownerTransferIsVisble)}>
+ <div className="flex flex-col">
+ <p>Make owner</p>
+ <p className="block opacity-50">Transfer ownership of "{orgName}"</p>
+ </div>
+ </Dropdown.Item>
+ )}
+
+ {member.invited_at && (
+ <>
+ <Dropdown.Item onClick={() => handleRevokeInvitation(member.invited_id)}>
+ <div className="flex flex-col">
+ <p>Cancel invitation</p>
+ <p className="block opacity-50">Revoke this invitation.</p>
+ </div>
+ </Dropdown.Item>
+
+ {!inviteExpired(member.invited_at) && (
+ <>
+ <Dropdown.Seperator />
+ <Dropdown.Item onClick={() => handleResendInvite(member)}>
+ <div className="flex flex-col">
+ <p>Resend invitation</p>
+ <p className="block opacity-50">Invites expire after 24hrs.</p>
+ </div>
+ </Dropdown.Item>
+ </>
+ )}
+ </>
+ )}
+
+ {!member.invited_at && (
+ <>
+ <Dropdown.Seperator />
+ <Dropdown.Item icon={<IconTrash size="tiny" />} onClick={handleMemberDelete}>
+ Remove member
+ </Dropdown.Item>
+ </>
+ )}
</>
}
>
diff --cc studio/pages/project/[ref]/auth/settings.tsx
index e410659e1cd,792bed5f2e8..d16e339d1cd
--- a/studio/pages/project/[ref]/auth/settings.tsx
+++ b/studio/pages/project/[ref]/auth/settings.tsx
@@@ -1,1215 -1,36 +1,43 @@@
- import useSWR from 'swr'
-import React, { useEffect } from 'react'
import { observer } from 'mobx-react-lite'
- import { useEffect, useState } from 'react'
- import { useRouter } from 'next/router'
- import { AutoField, NumField } from 'uniforms-bootstrap4'
- import { Button, Toggle as UIToggle, Typography } from '@supabase/ui'
- import Divider from 'components/ui/Divider'
++import { useEffect } from 'react'
- import { API_URL } from 'lib/constants'
-import { useStore } from 'hooks'
++import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { usePermissions, useStore } from 'hooks'
- import { authConfig } from 'stores/jsonSchema'
- import { get, patch } from 'lib/common/fetch'
- import { pluckJsonSchemaFields } from 'lib/helpers'
- import { AuthLayout } from 'components/layouts'
- import Table from 'components/to-be-cleaned/Table'
- import Panel from 'components/to-be-cleaned/Panel'
- import ToggleField from 'components/to-be-cleaned/forms/ToggleField'
- import SecretField from 'components/to-be-cleaned/forms/SecretField'
- import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel'
import { NextPageWithLayout } from 'types'
- import { PermissionAction } from '@supabase/shared-types/out/constants'
-
- const Auth: NextPageWithLayout = () => {
- return (
- <div className="p-4">
- <Settings />
- </div>
- )
- }
-import { AuthLayout } from 'components/layouts'
-import { FormsContainer } from 'components/ui/Forms'
+
- Auth.getLayout = (page) => <AuthLayout title="Auth">{page}</AuthLayout>
+ import { AuthProvidersForm } from 'components/interfaces'
-import RedirectDomains from 'components/interfaces/Auth/RedirectDomains/RedirectDomains'
+ import AutoSchemaForm from 'components/interfaces/Auth/AutoSchemaForm'
++import RedirectDomains from 'components/interfaces/Auth/RedirectDomains/RedirectDomains'
++import { AuthLayout } from 'components/layouts'
++import { FormsContainer } from 'components/ui/Forms'
- export default observer(Auth)
+ const PageLayout: NextPageWithLayout = () => {
+ const { ui, authConfig } = useStore()
- const Settings = () => {
- const router = useRouter()
- const { ui } = useStore()
+ useEffect(() => {
+ authConfig.load()
+ }, [ui.selectedProjectRef])
- const [model, setModel] = useState<any>({})
- const [smsProviderModel, setSmsProviderModel] = useState<any>({})
- const [externalProvidersModel, setExternalProvidersModel] = useState<any>({})
- const [isCustomSMTPEnabled, setCustomSMTP] = useState<boolean>(false)
- const URL = `${API_URL}/auth/${router.query.ref}/config`
- const { data: config, error }: any = useSWR(URL, get)
+ const canUpdate = usePermissions(
+ PermissionAction.SQL_UPDATE,
+ 'postgres.public.custom_config_gotrue'
+ )
- const { ref: projectRef } = router.query
+
- if (error) {
+ if (authConfig) {
return (
- <Typography.Text type="danger">
- <p>Error connecting to API</p>
- <p>{`${error}`}</p>
- </Typography.Text>
+ <FormsContainer>
+ <AutoSchemaForm />
+ <RedirectDomains />
+ <AuthProvidersForm />
+ </FormsContainer>
)
+ } else {
+ return <div />
}
-
- useEffect(() => {
- if (config) {
- const temp =
- config.SMTP_ADMIN_EMAIL ||
- config.SMTP_HOST ||
- config.SMTP_PORT ||
- config.SMTP_USER ||
- config.SMTP_PASS
- setCustomSMTP(temp)
- }
- setModel({ ...config })
- setExternalProvidersModel({ ...config })
- }, [config])
-
- const onFormSubmit = async (model: any) => {
- for (const [key, value] of Object.entries(model)) {
- // remove any whitespaces in OAuth or Sms provider credentials
- if ((key.includes('EXTERNAL') || key.includes('SMS')) && typeof value === 'string') {
- model[key] = value.replace(/\s/g, '')
- }
- }
- const response = await patch(URL, model)
- if (response.error) {
- ui.setNotification({
- category: 'error',
- message: `Update config failed: ${response.error.message}`,
- })
- } else {
- const updates = response
- setModel({ ...updates })
- ui.setNotification({ category: 'success', message: 'Settings saved' })
- }
- }
-
- /*
- * handleToggle
- *
- * This can be used for toggles that are not in a schema form
- */
- const handleToggle = async (key: any, value?: any) => {
- const payload = {
- [key]: value ? value : !model[key],
- }
-
- try {
- const response = await patch(URL, payload)
- if (response.error) throw response.error
- const updates = response
- setModel({ ...updates })
- ui.setNotification({ category: 'success', message: 'Settings saved' })
- } catch (error: any) {
- ui.setNotification({
- category: 'error',
- message: `Update config failed: ${error.message}`,
- })
- }
- }
-
- const onFormReset = () => {
- setExternalProvidersModel({ ...config })
- }
-
- return (
- <div className="">
- <div className="my-8 mt-0">
- <SchemaFormPanel
- title="General"
- schema={pluckJsonSchemaFields(authConfig, [
- 'SITE_URL',
- 'URI_ALLOW_LIST',
- 'JWT_EXP',
- 'DISABLE_SIGNUP',
- 'PASSWORD_MIN_LENGTH',
- 'SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION',
- ])}
- model={{
- SITE_URL: model.SITE_URL || undefined,
- URI_ALLOW_LIST: model.URI_ALLOW_LIST || undefined,
- DISABLE_SIGNUP: model.DISABLE_SIGNUP,
- JWT_EXP: model.JWT_EXP || undefined,
- PASSWORD_MIN_LENGTH: model.PASSWORD_MIN_LENGTH || undefined,
- SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION:
- model.SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION || false,
- }}
- onSubmit={(model: any) => onFormSubmit(model)}
- >
- <AutoField
- name="SITE_URL"
- showInlineError
- errorMessage="Please enter a valid site url."
- disabled={!canUpdate}
- />
- <AutoField
- name="URI_ALLOW_LIST"
- showInlineError
- errorMessage="Must be a comma separated list of exact URIs. No spaces."
- disabled={!canUpdate}
- />
- <NumField name="JWT_EXP" step="1" disabled={!canUpdate} />
- <NumField name="PASSWORD_MIN_LENGTH" step="1" disabled={!canUpdate} />
- <ToggleField
- name="SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION"
- disabled={!canUpdate}
- />
- <ToggleField name="DISABLE_SIGNUP" disabled={!canUpdate} />
- </SchemaFormPanel>
- </div>
- <div className="my-8 mt-0">
- <SchemaFormPanel
- title="Email Auth"
- schema={pluckJsonSchemaFields(authConfig, [
- 'MAILER_SECURE_EMAIL_CHANGE_ENABLED',
- 'SMTP_ADMIN_EMAIL',
- 'SMTP_HOST',
- 'SMTP_PORT',
- 'SMTP_USER',
- 'SMTP_PASS',
- 'SMTP_SENDER_NAME',
- 'RATE_LIMIT_EMAIL_SENT',
- ])}
- model={{
- MAILER_SECURE_EMAIL_CHANGE_ENABLED: model.MAILER_SECURE_EMAIL_CHANGE_ENABLED,
- SMTP_ADMIN_EMAIL: isCustomSMTPEnabled ? model.SMTP_ADMIN_EMAIL : '',
- SMTP_HOST: isCustomSMTPEnabled ? model.SMTP_HOST : '',
- SMTP_PORT: isCustomSMTPEnabled ? model.SMTP_PORT : '',
- SMTP_USER: isCustomSMTPEnabled ? model.SMTP_USER : '',
- SMTP_PASS: isCustomSMTPEnabled ? model.SMTP_PASS : '',
- SMTP_SENDER_NAME: isCustomSMTPEnabled ? model.SMTP_SENDER_NAME : '',
- RATE_LIMIT_EMAIL_SENT: isCustomSMTPEnabled ? model.RATE_LIMIT_EMAIL_SENT : 30,
- }}
- onSubmit={(model: any) =>
- onFormSubmit({
- ...model,
- })
- }
- >
- <UIToggle
- layout="horizontal"
- className="mb-4"
- label={authConfig.properties.EXTERNAL_EMAIL_ENABLED.title}
- onChange={(value) => {
- handleToggle('EXTERNAL_EMAIL_ENABLED', value)
- }}
- checked={model.EXTERNAL_EMAIL_ENABLED}
- descriptionText={authConfig.properties.EXTERNAL_EMAIL_ENABLED.help}
- disabled={!canUpdate}
- />
-
- <UIToggle
- layout="horizontal"
- className="mb-4"
- label={authConfig.properties.MAILER_SECURE_EMAIL_CHANGE_ENABLED.title}
- onChange={(value) => {
- handleToggle('MAILER_SECURE_EMAIL_CHANGE_ENABLED', value)
- }}
- checked={model.MAILER_SECURE_EMAIL_CHANGE_ENABLED}
- descriptionText={authConfig.properties.MAILER_SECURE_EMAIL_CHANGE_ENABLED.help}
- disabled={!canUpdate}
- />
-
- <UIToggle
- layout="horizontal"
- className="mb-4"
- label={authConfig.properties.MAILER_AUTOCONFIRM.title}
- onChange={(value) => {
- // If MAILER_AUTOCONFIRM is set to true, it means we are disabling email confirmations.
- // "Enable email confirmations" should be toggled off.
- handleToggle('MAILER_AUTOCONFIRM', !value)
- }}
- checked={!model.MAILER_AUTOCONFIRM}
- descriptionText={authConfig.properties.MAILER_AUTOCONFIRM.help}
- disabled={!canUpdate}
- />
-
- <UIToggle
- layout="horizontal"
- className="mb-4"
- label="Enable Custom SMTP"
- checked={isCustomSMTPEnabled}
- onChange={(value: any) => {
- /*
- * temporary solution
- * clear the values of SMTP when toggling
- */
- if (!value) {
- onFormSubmit({
- SMTP_ADMIN_EMAIL: '',
- SMTP_HOST: '',
- SMTP_PORT: '',
- SMTP_USER: '',
- SMTP_PASS: '',
- SMTP_SENDER_NAME: '',
- RATE_LIMIT_EMAIL_SENT: 30,
- })
- }
- setCustomSMTP(!isCustomSMTPEnabled)
- }}
- disabled={!canUpdate}
- />
- {isCustomSMTPEnabled && (
- <>
- <AutoField
- name="SMTP_ADMIN_EMAIL"
- showInlineError
- errorMessage="Please enter from email address."
- disabled={!canUpdate}
- />
- <AutoField
- name="SMTP_HOST"
- showInlineError
- errorMessage="Please enter host."
- disabled={!canUpdate}
- />
- <AutoField
- name="SMTP_PORT"
- showInlineError
- errorMessage="Please enter port."
- disabled={!canUpdate}
- />
- <AutoField
- name="SMTP_USER"
- showInlineError
- errorMessage="Please enter user."
- disabled={!canUpdate}
- />
- <SecretField
- name="SMTP_PASS"
- errorMessage="Please enter password."
- disabled={!canUpdate}
- />
- <AutoField
- name="SMTP_SENDER_NAME"
- showInlineError
- errorMessage="Please enter from name."
- disabled={!canUpdate}
- />
- <NumField
- showInlineError
- step="1"
- name="RATE_LIMIT_EMAIL_SENT"
- errorMessage="Please enter a value between 1 to 32767"
- disabled={!canUpdate}
- />
- </>
- )}
- </SchemaFormPanel>
- </div>
-
- <div className="my-8 mt-0">
- <SchemaFormPanel
- title="Phone Auth"
- schema={pluckJsonSchemaFields(authConfig, [
- 'SMS_PROVIDER',
- 'SMS_TWILIO_ACCOUNT_SID',
- 'SMS_TWILIO_AUTH_TOKEN',
- 'SMS_TWILIO_MESSAGE_SERVICE_SID',
- 'SMS_MESSAGEBIRD_ORIGINATOR',
- 'SMS_MESSAGEBIRD_ACCESS_KEY',
- 'SMS_TEXTLOCAL_API_KEY',
- 'SMS_TEXTLOCAL_SENDER',
- 'SMS_VONAGE_API_KEY',
- 'SMS_VONAGE_API_SECRET',
- 'SMS_VONAGE_FROM',
- ])}
- model={{
- SMS_PROVIDER: model.SMS_PROVIDER,
- SMS_TEXTLOCAL_API_KEY: model.SMS_TEXTLOCAL_API_KEY || undefined,
- SMS_TEXTLOCAL_SENDER: model.SMS_TEXTLOCAL_SENDER || undefined,
- SMS_TWILIO_ACCOUNT_SID: model.SMS_TWILIO_ACCOUNT_SID || undefined,
- SMS_TWILIO_AUTH_TOKEN: model.SMS_TWILIO_AUTH_TOKEN || undefined,
- SMS_TWILIO_MESSAGE_SERVICE_SID: model.SMS_TWILIO_MESSAGE_SERVICE_SID || undefined,
- SMS_MESSAGEBIRD_ORIGINATOR: model.SMS_MESSAGEBIRD_ORIGINATOR || undefined,
- SMS_MESSAGEBIRD_ACCESS_KEY: model.SMS_MESSAGEBIRD_ACCESS_KEY || undefined,
- SMS_VONAGE_API_KEY: model.SMS_VONAGE_API_KEY || undefined,
- SMS_VONAGE_API_SECRET: model.SMS_VONAGE_API_SECRET || undefined,
- SMS_VONAGE_FROM: model.SMS_VONAGE_FROM || undefined,
- }}
- onChangeModel={(model: any) => setSmsProviderModel(model)}
- onSubmit={(model: any) => onFormSubmit(model)}
- >
- <>
- <UIToggle
- layout="horizontal"
- className="mb-4"
- label={authConfig.properties.EXTERNAL_PHONE_ENABLED.title}
- onChange={() => {
- handleToggle('EXTERNAL_PHONE_ENABLED')
- }}
- checked={model.EXTERNAL_PHONE_ENABLED}
- descriptionText={authConfig.properties.EXTERNAL_PHONE_ENABLED.help}
- disabled={!canUpdate}
- />
-
- {model.EXTERNAL_PHONE_ENABLED && (
- <>
- <AutoField
- name="SMS_PROVIDER"
- showInlineError
- errorMessage="Please enter the phone provider."
- disabled={!canUpdate}
- />
- {smsProviderModel?.SMS_PROVIDER === 'messagebird' ? (
- <>
- <SecretField
- name="SMS_MESSAGEBIRD_ACCESS_KEY"
- showInlineError
- errorMessage="Please enter the messagebird access key."
- disabled={!canUpdate}
- />
- <AutoField
- name="SMS_MESSAGEBIRD_ORIGINATOR"
- showInlineError
- errorMessage="Please enter the messagebird originator."
- disabled={!canUpdate}
- />
- </>
- ) : smsProviderModel?.SMS_PROVIDER === 'textlocal' ? (
- <>
- <AutoField
- name="SMS_TEXTLOCAL_API_KEY"
- showInlineError
- errorMessage="Please enter the vonage account sid."
- disabled={!canUpdate}
- />
- <SecretField
- name="SMS_TEXTLOCAL_SENDER"
- showInlineError
- errorMessage="Please enter the vonage auth token."
- disabled={!canUpdate}
- />
- </>
- ) : smsProviderModel?.SMS_PROVIDER === 'vonage' ? (
- <>
- <AutoField
- name="SMS_VONAGE_API_KEY"
- showInlineError
- errorMessage="Please enter the vonage account sid."
- disabled={!canUpdate}
- />
- <SecretField
- name="SMS_VONAGE_API_SECRET"
- showInlineError
- errorMessage="Please enter the vonage auth token."
- disabled={!canUpdate}
- />
- <AutoField
- name="SMS_VONAGE_FROM"
- showInlineError
- errorMessage="Please enter the vonage message service sid."
- disabled={!canUpdate}
- />
- </>
- ) : (
- <>
- <AutoField
- name="SMS_TWILIO_ACCOUNT_SID"
- showInlineError
- errorMessage="Please enter the twilio account sid."
- disabled={!canUpdate}
- />
- <SecretField
- name="SMS_TWILIO_AUTH_TOKEN"
- showInlineError
- errorMessage="Please enter the twilio auth token."
- disabled={!canUpdate}
- />
- <AutoField
- name="SMS_TWILIO_MESSAGE_SERVICE_SID"
- showInlineError
- errorMessage="Please enter the twilio message service sid."
- disabled={!canUpdate}
- />
- </>
- )}
- </>
- )}
- <UIToggle
- layout="horizontal"
- label={authConfig.properties.SMS_AUTOCONFIRM.title}
- onChange={(value) => {
- // If SMS_AUTOCONFIRM is set to true, it means we are disabling phone confirmations.
- // "Enable phone confirmations" should be toggled off.
- handleToggle('SMS_AUTOCONFIRM', !value)
- }}
- //
- checked={!model.SMS_AUTOCONFIRM}
- descriptionText={authConfig.properties.SMS_AUTOCONFIRM.help}
- disabled={!canUpdate}
- />
- </>
- </SchemaFormPanel>
- </div>
- <div className="my-8 mt-0">
- <SchemaFormPanel
- title="External OAuth Providers"
- schema={pluckJsonSchemaFields(authConfig, [
- 'EXTERNAL_APPLE_ENABLED',
- 'EXTERNAL_APPLE_CLIENT_ID',
- 'EXTERNAL_APPLE_SECRET',
- 'EXTERNAL_AZURE_ENABLED',
- 'EXTERNAL_AZURE_CLIENT_ID',
- 'EXTERNAL_AZURE_SECRET',
- 'EXTERNAL_AZURE_URL',
- 'EXTERNAL_BITBUCKET_ENABLED',
- 'EXTERNAL_BITBUCKET_CLIENT_ID',
- 'EXTERNAL_BITBUCKET_SECRET',
- 'EXTERNAL_DISCORD_ENABLED',
- 'EXTERNAL_DISCORD_CLIENT_ID',
- 'EXTERNAL_DISCORD_SECRET',
- 'EXTERNAL_FACEBOOK_ENABLED',
- 'EXTERNAL_FACEBOOK_CLIENT_ID',
- 'EXTERNAL_FACEBOOK_SECRET',
- 'EXTERNAL_GOOGLE_ENABLED',
- 'EXTERNAL_GOOGLE_CLIENT_ID',
- 'EXTERNAL_GOOGLE_SECRET',
- 'EXTERNAL_GITHUB_ENABLED',
- 'EXTERNAL_GITHUB_CLIENT_ID',
- 'EXTERNAL_GITHUB_SECRET',
- 'EXTERNAL_GITLAB_ENABLED',
- 'EXTERNAL_GITLAB_CLIENT_ID',
- 'EXTERNAL_GITLAB_SECRET',
- 'EXTERNAL_KEYCLOAK_ENABLED',
- 'EXTERNAL_KEYCLOAK_CLIENT_ID',
- 'EXTERNAL_KEYCLOAK_SECRET',
- 'EXTERNAL_KEYCLOAK_URL',
- 'EXTERNAL_LINKEDIN_ENABLED',
- 'EXTERNAL_LINKEDIN_CLIENT_ID',
- 'EXTERNAL_LINKEDIN_SECRET',
- 'EXTERNAL_NOTION_ENABLED',
- 'EXTERNAL_NOTION_CLIENT_ID',
- 'EXTERNAL_NOTION_SECRET',
- 'EXTERNAL_TWITCH_ENABLED',
- 'EXTERNAL_TWITCH_CLIENT_ID',
- 'EXTERNAL_TWITCH_SECRET',
- 'EXTERNAL_TWITTER_ENABLED',
- 'EXTERNAL_TWITTER_CLIENT_ID',
- 'EXTERNAL_TWITTER_SECRET',
- 'EXTERNAL_SLACK_ENABLED',
- 'EXTERNAL_SLACK_CLIENT_ID',
- 'EXTERNAL_SLACK_SECRET',
- 'EXTERNAL_SPOTIFY_ENABLED',
- 'EXTERNAL_SPOTIFY_CLIENT_ID',
- 'EXTERNAL_SPOTIFY_SECRET',
- 'EXTERNAL_WORKOS_ENABLED',
- 'EXTERNAL_WORKOS_CLIENT_ID',
- 'EXTERNAL_WORKOS_SECRET',
- 'EXTERNAL_WORKOS_URL',
- 'EXTERNAL_ZOOM_ENABLED',
- 'EXTERNAL_ZOOM_CLIENT_ID',
- 'EXTERNAL_ZOOM_SECRET',
- ])}
- model={{
- EXTERNAL_APPLE_ENABLED: model.EXTERNAL_APPLE_ENABLED,
- EXTERNAL_APPLE_CLIENT_ID: model.EXTERNAL_APPLE_CLIENT_ID || undefined,
- EXTERNAL_APPLE_SECRET: model.EXTERNAL_APPLE_SECRET || undefined,
- EXTERNAL_AZURE_ENABLED: model.EXTERNAL_AZURE_ENABLED,
- EXTERNAL_AZURE_CLIENT_ID: model.EXTERNAL_AZURE_CLIENT_ID || undefined,
- EXTERNAL_AZURE_SECRET: model.EXTERNAL_AZURE_SECRET || undefined,
- EXTERNAL_AZURE_URL: model.EXTERNAL_AZURE_URL || undefined,
- EXTERNAL_BITBUCKET_ENABLED: model.EXTERNAL_BITBUCKET_ENABLED,
- EXTERNAL_BITBUCKET_CLIENT_ID: model.EXTERNAL_BITBUCKET_CLIENT_ID || undefined,
- EXTERNAL_BITBUCKET_SECRET: model.EXTERNAL_BITBUCKET_SECRET || undefined,
- EXTERNAL_DISCORD_ENABLED: model.EXTERNAL_DISCORD_ENABLED,
- EXTERNAL_DISCORD_CLIENT_ID: model.EXTERNAL_DISCORD_CLIENT_ID || undefined,
- EXTERNAL_DISCORD_SECRET: model.EXTERNAL_DISCORD_SECRET || undefined,
- EXTERNAL_FACEBOOK_ENABLED: model.EXTERNAL_FACEBOOK_ENABLED,
- EXTERNAL_FACEBOOK_CLIENT_ID: model.EXTERNAL_FACEBOOK_CLIENT_ID || undefined,
- EXTERNAL_FACEBOOK_SECRET: model.EXTERNAL_FACEBOOK_SECRET || undefined,
- EXTERNAL_GITHUB_ENABLED: model.EXTERNAL_GITHUB_ENABLED,
- EXTERNAL_GITHUB_CLIENT_ID: model.EXTERNAL_GITHUB_CLIENT_ID || undefined,
- EXTERNAL_GITHUB_SECRET: model.EXTERNAL_GITHUB_SECRET || undefined,
- EXTERNAL_GITLAB_ENABLED: model.EXTERNAL_GITLAB_ENABLED,
- EXTERNAL_GITLAB_CLIENT_ID: model.EXTERNAL_GITLAB_CLIENT_ID || undefined,
- EXTERNAL_GITLAB_SECRET: model.EXTERNAL_GITLAB_SECRET || undefined,
- EXTERNAL_GOOGLE_ENABLED: model.EXTERNAL_GOOGLE_ENABLED,
- EXTERNAL_GOOGLE_CLIENT_ID: model.EXTERNAL_GOOGLE_CLIENT_ID || undefined,
- EXTERNAL_GOOGLE_SECRET: model.EXTERNAL_GOOGLE_SECRET || undefined,
- EXTERNAL_KEYCLOAK_ENABLED: model.EXTERNAL_KEYCLOAK_ENABLED,
- EXTERNAL_KEYCLOAK_CLIENT_ID: model.EXTERNAL_KEYCLOAK_CLIENT_ID || undefined,
- EXTERNAL_KEYCLOAK_SECRET: model.EXTERNAL_KEYCLOAK_SECRET || undefined,
- EXTERNAL_KEYCLOAK_URL: model.EXTERNAL_KEYCLOAK_URL || undefined,
- EXTERNAL_LINKEDIN_ENABLED: model.EXTERNAL_LINKEDIN_ENABLED,
- EXTERNAL_LINKEDIN_CLIENT_ID: model.EXTERNAL_LINKEDIN_CLIENT_ID || undefined,
- EXTERNAL_LINKEDIN_SECRET: model.EXTERNAL_LINKEDIN_SECRET || undefined,
- EXTERNAL_NOTION_ENABLED: model.EXTERNAL_NOTION_ENABLED,
- EXTERNAL_NOTION_CLIENT_ID: model.EXTERNAL_NOTION_CLIENT_ID || undefined,
- EXTERNAL_NOTION_SECRET: model.EXTERNAL_NOTION_SECRET || undefined,
- EXTERNAL_TWITCH_ENABLED: model.EXTERNAL_TWITCH_ENABLED,
- EXTERNAL_TWITCH_CLIENT_ID: model.EXTERNAL_TWITCH_CLIENT_ID || undefined,
- EXTERNAL_TWITCH_SECRET: model.EXTERNAL_TWITCH_SECRET || undefined,
- EXTERNAL_TWITTER_ENABLED: model.EXTERNAL_TWITTER_ENABLED,
- EXTERNAL_TWITTER_CLIENT_ID: model.EXTERNAL_TWITTER_CLIENT_ID || undefined,
- EXTERNAL_TWITTER_SECRET: model.EXTERNAL_TWITTER_SECRET || undefined,
- EXTERNAL_SLACK_ENABLED: model.EXTERNAL_SLACK_ENABLED,
- EXTERNAL_SLACK_CLIENT_ID: model.EXTERNAL_SLACK_CLIENT_ID || undefined,
- EXTERNAL_SLACK_SECRET: model.EXTERNAL_SLACK_SECRET || undefined,
- EXTERNAL_SPOTIFY_ENABLED: model.EXTERNAL_SPOTIFY_ENABLED,
- EXTERNAL_SPOTIFY_CLIENT_ID: model.EXTERNAL_SPOTIFY_CLIENT_ID || undefined,
- EXTERNAL_SPOTIFY_SECRET: model.EXTERNAL_SPOTIFY_SECRET || undefined,
- EXTERNAL_WORKOS_ENABLED: model.EXTERNAL_WORKOS_ENABLED,
- EXTERNAL_WORKOS_CLIENT_ID: model.EXTERNAL_WORKOS_CLIENT_ID || undefined,
- EXTERNAL_WORKOS_SECRET: model.EXTERNAL_WORKOS_SECRET || undefined,
- EXTERNAL_WORKOS_URL: model.EXTERNAL_WORKOS_URL || undefined,
- EXTERNAL_ZOOM_ENABLED: model.EXTERNAL_ZOOM_ENABLED,
- EXTERNAL_ZOOM_CLIENT_ID: model.EXTERNAL_ZOOM_CLIENT_ID || undefined,
- EXTERNAL_ZOOM_SECRET: model.EXTERNAL_ZOOM_SECRET || undefined,
- }}
- onChangeModel={(model) => setExternalProvidersModel(model)}
- onReset={() => onFormReset()}
- onSubmit={(model: any) => onFormSubmit(model)}
- >
- <ToggleField
- name="EXTERNAL_APPLE_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_APPLE_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://developer.apple.com/account/resources/identifiers/add/bundleId"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_APPLE_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_APPLE_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_APPLE_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_AZURE_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_AZURE_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_AZURE_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_AZURE_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_AZURE_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- <AutoField
- name="EXTERNAL_AZURE_URL"
- showInlineError
- errorMessage="Please enter the azure tenant url."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_BITBUCKET_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_BITBUCKET_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_BITBUCKET_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_BITBUCKET_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_BITBUCKET_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_DISCORD_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_DISCORD_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://discord.com/developers/applications#top"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_DISCORD_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_DISCORD_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_DISCORD_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_FACEBOOK_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_FACEBOOK_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://developers.facebook.com/apps/"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_FACEBOOK_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_FACEBOOK_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_FACEBOOK_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_GITHUB_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_GITHUB_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://github.com/settings/applications/new"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_GITHUB_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_GITHUB_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_GITHUB_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_GITLAB_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_GITLAB_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://gitlab.com/oauth/applications"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_GITLAB_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_GITLAB_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_GITLAB_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_GOOGLE_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_GOOGLE_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://console.developers.google.com/apis/credentials"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_GOOGLE_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_GOOGLE_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_GOOGLE_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_KEYCLOAK_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_KEYCLOAK_ENABLED && (
- <a className="text-scale-900 pl-4" href="https://www.keycloak.org/" target="_blank">
- Create new credentials
- </a>
- )
- }
- />
- {externalProvidersModel.EXTERNAL_KEYCLOAK_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_KEYCLOAK_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- />
- <SecretField
- name="EXTERNAL_KEYCLOAK_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- />
- <AutoField
- name="EXTERNAL_KEYCLOAK_URL"
- showInlineError
- errorMessage="Please enter the Keycloak url."
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_LINKEDIN_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_LINKEDIN_ENABLED && (
- <a
- className="pl-4 text-gray-400"
- href="https://www.linkedin.com/developers/apps"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_LINKEDIN_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_LINKEDIN_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_LINKEDIN_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_NOTION_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_NOTION_ENABLED && (
- <a
- className="pl-4 text-gray-400"
- href="https://www.notion.so/my-integrations"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_NOTION_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_NOTION_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_NOTION_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_TWITCH_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_TWITCH_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://dev.twitch.tv/console"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_TWITCH_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_TWITCH_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_TWITCH_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_TWITTER_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_TWITTER_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://developer.twitter.com/en/portal/dashboard"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_TWITTER_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_TWITTER_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_TWITTER_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_SLACK_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_SLACK_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://api.slack.com/apps"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_SLACK_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_SLACK_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_SLACK_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_SPOTIFY_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_SPOTIFY_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://developer.spotify.com/dashboard/"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_SPOTIFY_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_SPOTIFY_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_SPOTIFY_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_WORKOS_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_WORKOS_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://dashboard.workos.com"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- />
- {externalProvidersModel.EXTERNAL_WORKOS_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_WORKOS_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- />
- <SecretField
- name="EXTERNAL_WORKOS_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- />
- <AutoField
- name="EXTERNAL_WORKOS_URL"
- showInlineError
- errorMessage="Please enter the WorkOS url."
- />
- </>
- )}
- <Divider light />
- <ToggleField
- name="EXTERNAL_ZOOM_ENABLED"
- addOns={
- externalProvidersModel.EXTERNAL_ZOOM_ENABLED && (
- <a
- className="text-scale-900 pl-4"
- href="https://developers.zoom.us/"
- target="_blank"
- >
- Create new credentials
- </a>
- )
- }
- disabled={!canUpdate}
- />
- {externalProvidersModel.EXTERNAL_ZOOM_ENABLED && (
- <>
- <AutoField
- name="EXTERNAL_ZOOM_CLIENT_ID"
- showInlineError
- errorMessage="Please enter the client id."
- disabled={!canUpdate}
- />
- <SecretField
- name="EXTERNAL_ZOOM_SECRET"
- showInlineError
- errorMessage="Please enter the secret."
- disabled={!canUpdate}
- />
- </>
- )}
- </SchemaFormPanel>
- </div>
-
- <div className="my-8 mt-0">
- {config && (
- <AuditLog interval={config.isFreeTier ? '1 hour' : '7 days'} projectRef={projectRef} />
- )}
- </div>
- </div>
- )
}
- const AuditLog = ({ interval, projectRef }: any) => {
- const { meta } = useStore()
- const [logs, setLogs] = useState<any>([])
- const [isLoading, setIsLoading] = useState<any>(false)
-
- const refreshLogs = async () => {
- setIsLoading(true)
- try {
- let query = `
- select *
- from auth.audit_log_entries
- where created_at > current_timestamp - interval '${interval}'
- order by created_at desc
- limit 1000;
- `
- const response = await meta.query(query)
- if (response.error) throw response.error
- setLogs(response)
- } catch (error) {
- console.error('Refresh logs error:', error)
- } finally {
- setIsLoading(false)
- }
- }
-
- useEffect(() => {
- refreshLogs()
- }, [])
-
- if (!logs.length) return <div></div>
- const cellCss = 'table-cell px-4 py-3 text-gray-200 font-mono text-xs'
- return (
- <Panel
- title={
- <div className=" flex w-full items-center justify-between">
- <Typography.Title level={5} className="block flex-1">
- Audit Trail
- </Typography.Title>
- <div className="flex-1 text-right">
- <Button
- type="default"
- className="hover:border-gray-400"
- disabled={isLoading}
- loading={isLoading}
- onClick={() => refreshLogs()}
- >
- Refresh
- </Button>
- </div>
- </div>
- }
- >
- <Table
- borderless
- head={
- <>
- <Table.th>Time</Table.th>
- <Table.th>Action</Table.th>
- <Table.th>User ID</Table.th>
- <Table.th>Identity</Table.th>
- </>
- }
- body={logs.map((x: any, i: number) => (
- <Table.tr key={x.id} className={`${i % 2 ? '' : 'bg-gray-500'}`}>
- <Table.td className={cellCss}>
- <Typography.Text>{x.payload.timestamp.replace('T', ' ')}</Typography.Text>
- </Table.td>
- <Table.td className={cellCss + ''}>
- <Typography.Text>{x.payload.action}</Typography.Text>
- </Table.td>
- <Table.td className={cellCss}>
- <Typography.Text>{x.payload.actor_id || x.payload.traits?.user_id}</Typography.Text>
- </Table.td>
- <Table.td className={cellCss}>
- <Typography.Text>
- {x.payload.actor_username || x.payload.traits?.user_email}
- </Typography.Text>
- </Table.td>
- </Table.tr>
- ))}
- />
- </Panel>
- )
+ PageLayout.getLayout = (page) => {
+ return <AuthLayout>{page}</AuthLayout>
}
+
+ export default observer(PageLayout)
diff --cc studio/pages/project/[ref]/settings/general.tsx
index aa0f4402678,a696d037af6..dbc740524c4
--- a/studio/pages/project/[ref]/settings/general.tsx
+++ b/studio/pages/project/[ref]/settings/general.tsx
@@@ -1,22 -1,23 +1,26 @@@
- import { FC, useState } from 'react'
- import { useRouter } from 'next/router'
--import { observer } from 'mobx-react-lite'
++import { Alert, Input } from '@supabase/ui'
import { toJS } from 'mobx'
++import { observer } from 'mobx-react-lite'
import { projects } from 'stores/jsonSchema'
import { AutoField } from 'uniforms-bootstrap4'
- import { Alert, Button, IconRefreshCcw, Input } from '@supabase/ui'
-import { Alert, Input } from '@supabase/ui'
- import { API_URL } from 'lib/constants'
- import { pluckJsonSchemaFields, pluckObjectFields } from 'lib/helpers'
- import { delete_, post } from 'lib/common/fetch'
- import { usePermissions, useStore } from 'hooks'
-import { useFlag, useStore } from 'hooks'
-import { NextPageWithLayout } from 'types'
++import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { SettingsLayout } from 'components/layouts'
- import Panel from 'components/to-be-cleaned/Panel'
- import ConfirmModal from 'components/ui/Dialogs/ConfirmDialog'
+import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel'
- import TextConfirmModal from 'components/ui/Modals/TextConfirmModal'
++import Panel from 'components/ui/Panel'
++import { usePermissions, useStore } from 'hooks'
+ import { post } from 'lib/common/fetch'
-import { API_URL, PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
++import { API_URL } from 'lib/constants'
+ import { pluckJsonSchemaFields, pluckObjectFields } from 'lib/helpers'
-import { SettingsLayout } from 'components/layouts'
+import { NextPageWithLayout } from 'types'
- import { PermissionAction } from '@supabase/shared-types/out/constants'
++
+ import {
- RestartServerButton,
- PauseProjectButton,
+ DeleteProjectButton,
++ PauseProjectButton,
++ RestartServerButton,
+ } from 'components/interfaces/Settings/General'
-
-import Panel from 'components/ui/Panel'
-import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel'
++import { useFlag } from 'hooks'
++import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
const ProjectSettings: NextPageWithLayout = () => {
return (
@@@ -90,8 -43,7 +46,9 @@@ const GeneralSettings = observer(() =>
const formModel = toJS(project)
const BASIC_FIELDS = ['name']
+ const canReboot = usePermissions(PermissionAction.TENANT_INFRA_EXECUTE, 'reboot')
+ const canUpdateProject = usePermissions(PermissionAction.SQL_UPDATE, 'postgres.public.projects')
+ const isFreeProject = project?.subscription_tier === PRICING_TIER_PRODUCT_IDS.FREE
const handleUpdateProject = async (model: any) => {
const response = await post(`${API_URL}/projects/${project?.ref}/update`, model)
@@@ -148,7 -92,20 +105,21 @@@
<Panel.Content className="border-panel-border-interior-light dark:border-panel-border-interior-dark border-t">
<Input readOnly disabled value={project?.region} label="Region" layout="horizontal" />
</Panel.Content>
- {canRebot && (
+ <Panel.Content className="border-panel-border-interior-light dark:border-panel-border-interior-dark border-t">
+ <div className="flex w-full items-center justify-between">
+ <div>
+ <p>Restart server</p>
+ <div className="max-w-[420px]">
+ <p className="text-scale-1100 text-sm">
+ Your project will not be available for a few minutes.
+ </p>
+ </div>
++ {project && <RestartServerButton projectId={project.id} projectRef={project.ref} />}
+ </div>
+ {project && <RestartServerButton projectId={project.id} projectRef={project.ref} />}
+ </div>
+ </Panel.Content>
+ {isProjectPauseEnabled && isFreeProject && (
<Panel.Content className="border-panel-border-interior-light dark:border-panel-border-interior-dark border-t">
<div className="flex w-full items-center justify-between">
<div>