Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"jsrsasign": "^11.0.0",
"katex": "^0.16.21",
"libpg-query": "15.2.0",
"lodash-es": "^4.17.21",
"lodash-es": "catalog:",
"lucide-react": "*",
"mdast": "^3.0.0",
"mdast-util-from-markdown": "^1.2.0",
Expand Down
2 changes: 2 additions & 0 deletions apps/docs/public/humans.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Matthew Hambright
Matt Johnston
Matt Rossman
Matthias Luft
Mert Yerekapan
Michal Kleczek
Miles Thomas
Monica Khoury
Expand All @@ -148,6 +149,7 @@ Nick Nowlan
Nyannyacha
Oli R
Pamela Chia
Patrick Crane
Paul Caselton
Paul Cioanca
Paul Copplestone
Expand Down
51 changes: 29 additions & 22 deletions apps/studio/components/interfaces/Settings/Addons/Addons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,21 @@ export const Addons = () => {
title="Compute size has moved"
description="Compute size is now managed alongside Disk configuration on the new Compute and Disk page."
actions={
<Button type="default" asChild>
<Link href={`/project/${projectRef}/settings/compute-and-disk`}>
Go to Compute and Disk
</Link>
</Button>
<ProjectUpdateDisabledTooltip
projectUpdateDisabled={projectUpdateDisabled}
projectNotActive={!isProjectActive}
>
<Button
asChild
type="default"
className="pointer-events-auto"
disabled={projectUpdateDisabled || !isProjectActive}
>
<Link href={`/project/${projectRef}/settings/compute-and-disk`}>
Go to Compute and Disk
</Link>
</Button>
</ProjectUpdateDisabledTooltip>
}
/>

Expand Down Expand Up @@ -393,24 +403,21 @@ export const Addons = () => {
? 'Dedicated IPv4 address is enabled'
: 'Dedicated IPv4 address is not enabled'}
</p>
<ButtonTooltip
type="default"
className="mt-2 pointer-events-auto"
onClick={() => setPanel('ipv4')}
disabled={
!isProjectActive || projectUpdateDisabled || !(canUpdateIPv4 || ipv4)
}
tooltip={{
content: {
side: 'bottom',
text: !(canUpdateIPv4 || ipv4)
? 'Temporarily disabled while we are migrating to IPv6, please check back later.'
: undefined,
},
}}
<ProjectUpdateDisabledTooltip
projectUpdateDisabled={projectUpdateDisabled}
projectNotActive={!isProjectActive}
>
Change dedicated IPv4 address
</ButtonTooltip>
<Button
type="default"
className="mt-2 pointer-events-auto"
onClick={() => setPanel('ipv4')}
disabled={
!isProjectActive || projectUpdateDisabled || !(canUpdateIPv4 || ipv4)
}
>
Change dedicated IPv4 address
</Button>
</ProjectUpdateDisabledTooltip>
</div>
</div>
</ScaffoldSectionContent>
Expand Down
21 changes: 11 additions & 10 deletions apps/studio/components/interfaces/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Link from 'next/link'
import { useRouter } from 'next/router'
import { ComponentProps, ComponentPropsWithoutRef, FC, ReactNode, useEffect } from 'react'

import { PROJECT_STATUS } from '@/lib/constants'
import { LOCAL_STORAGE_KEYS, useFlag, useIsMFAEnabled, useParams } from 'common'
import {
generateOtherRoutes,
Expand Down Expand Up @@ -42,6 +43,7 @@ import {
Sidebar as SidebarPrimitive,
useSidebar,
} from 'ui'
import { Route } from '../ui/ui.types'
import {
useIsAPIDocsSidePanelEnabled,
useUnifiedLogsPreview,
Expand Down Expand Up @@ -162,7 +164,7 @@ export function SideBarNavLink({
disabled,
...props
}: {
route: any
route: Route
active?: boolean
disabled?: boolean
onClick?: () => void
Expand Down Expand Up @@ -228,6 +230,8 @@ const ProjectLinks = () => {
const showReports = useIsFeatureEnabled('reports:all')
const { mutate: sendEvent } = useSendEventMutation()

const isProjectActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY

const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled()
const { isEnabled: isUnifiedLogsEnabled } = useUnifiedLogsPreview()

Expand Down Expand Up @@ -278,6 +282,7 @@ const ProjectLinks = () => {
{toolRoutes.map((route, i) => (
<SideBarNavLink
key={`tools-routes-${i}`}
disabled={!isProjectActive}
route={route}
active={activeRoute === route.key}
/>
Expand All @@ -288,6 +293,7 @@ const ProjectLinks = () => {
{productRoutes.map((route, i) => (
<SideBarNavLink
key={`product-routes-${i}`}
disabled={route.key !== 'functions' && !isProjectActive}
route={route}
active={activeRoute === route.key}
/>
Expand Down Expand Up @@ -326,33 +332,28 @@ const ProjectLinks = () => {
: route
}
active={activeRoute === route.key}
disabled={!isProjectActive}
onClick={handleApiClick}
/>
)
} else if (route.key === 'advisors') {
return (
<div className="relative" key={route.key}>
{ActiveDot(errorLints, securityLints)}
{isProjectActive && ActiveDot(errorLints, securityLints)}
<SideBarNavLink
key={`other-routes-${i}`}
route={route}
disabled={!isProjectActive}
active={activeRoute === route.key}
/>
</div>
)
} else if (route.key === 'logs') {
return (
<SideBarNavLink
key={`other-routes-${i}`}
route={route}
active={activeRoute === route.key}
/>
)
} else {
return (
<SideBarNavLink
key={`other-routes-${i}`}
route={route}
disabled={!isProjectActive}
active={activeRoute === route.key}
/>
)
Expand Down
11 changes: 2 additions & 9 deletions apps/studio/components/layouts/Integrations/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ProjectLayout } from 'components/layouts/ProjectLayout'
import AlertError from 'components/ui/AlertError'
import { ProductMenu } from 'components/ui/ProductMenu'
import { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
import ProductMenuItem from 'components/ui/ProductMenu/ProductMenuItem'
import { ProductMenuItem } from 'components/ui/ProductMenu/ProductMenuItem'
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { withAuth } from 'hooks/misc/withAuth'
Expand Down Expand Up @@ -88,14 +88,7 @@ const IntegrationsLayout = ({ children }: PropsWithChildren) => {
{isSuccess && (
<div>
{installedIntegrationItems.map((item) => (
<ProductMenuItem
key={item.key}
url={item.url}
name={item.name}
icon={item.icon}
isActive={page === item.key}
label={item.label}
/>
<ProductMenuItem key={item.key} isActive={page === item.key} item={item} />
))}
</div>
)}
Expand Down
12 changes: 3 additions & 9 deletions apps/studio/components/layouts/ProjectLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const routesToIgnoreDBConnection = [
'/project/[ref]/database/backups/scheduled',
'/project/[ref]/database/backups/pitr',
'/project/[ref]/settings/addons',
'/project/[ref]/functions',
]

const routesToIgnorePostgrestConnection = [
Expand Down Expand Up @@ -103,13 +104,6 @@ export const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<Projec
const organizationName = selectedOrganization?.name

const isPaused = selectedProject?.status === PROJECT_STATUS.INACTIVE
const showProductMenu = selectedProject
? selectedProject.status === PROJECT_STATUS.ACTIVE_HEALTHY ||
(selectedProject.status === PROJECT_STATUS.COMING_UP &&
router.pathname.includes('/project/[ref]/settings')) ||
router.pathname.includes('/project/[ref]/branches') ||
router.pathname.includes('/project/[ref]/functions')
: true

const ignorePausedState =
router.pathname === '/project/[ref]' ||
Expand Down Expand Up @@ -140,7 +134,7 @@ export const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<Projec
<div className="flex flex-row h-full w-full">
{/* autoSaveId="project-layout" */}
<ResizablePanelGroup direction="horizontal">
{showProductMenu && productMenu && (
{productMenu && (
<ResizablePanel
order={1}
minSize={sidebarMinSizePercentage}
Expand Down Expand Up @@ -180,7 +174,7 @@ export const ProjectLayout = forwardRef<HTMLDivElement, PropsWithChildren<Projec
)}
</ResizablePanel>
)}
{showProductMenu && productMenu && sideBarIsOpen && (
{productMenu && sideBarIsOpen && (
<ResizableHandle
withHandle
disabled={resizableSidebar ? false : true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export const generateSettingsMenu = (
},
]
}

const isProjectActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY
const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP
const buildingUrl = `/project/${ref}`

Expand All @@ -60,32 +62,37 @@ export const generateSettingsMenu = (
key: 'compute-and-disk',
url: `/project/${ref}/settings/compute-and-disk`,
items: [],
disabled: !isProjectActive,
},
{
name: 'Infrastructure',
key: 'infrastructure',
url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/infrastructure`,
items: [],
disabled: !isProjectActive,
},

{
name: 'Integrations',
key: 'integrations',
url: `/project/${ref}/settings/integrations`,
items: [],
disabled: !isProjectActive,
},

{
name: 'Data API',
key: 'api',
url: isProjectBuilding ? buildingUrl : `/project/${ref}/settings/api`,
items: [],
disabled: !isProjectActive,
},
{
name: 'API Keys',
key: 'api-keys',
url: `/project/${ref}/settings/api-keys/new`,
items: [],
disabled: !isProjectActive,
},
{
name: 'JWT Keys',
Expand All @@ -94,13 +101,15 @@ export const generateSettingsMenu = (
? `/project/${ref}/settings/jwt`
: `/project/${ref}/settings/jwt/signing-keys`,
items: [],
disabled: !isProjectActive,
},

{
name: `Log Drains`,
key: `log-drains`,
url: `/project/${ref}/settings/log-drains`,
items: [],
disabled: !isProjectActive,
},
{
name: 'Add Ons',
Expand All @@ -115,6 +124,7 @@ export const generateSettingsMenu = (
items: [],
rightIcon: <ArrowUpRight strokeWidth={1} className="h-4 w-4" />,
label: 'Beta',
disabled: !isProjectActive,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Link from 'next/link'
import { type CSSProperties } from 'react'
import { toast } from 'sonner'

import { formatSql } from '@/lib/formatSql'
import { useFlag, useParams } from 'common'
import { useTableFilter } from 'components/grid/hooks/useTableFilter'
import { buildTableEditorUrl } from 'components/grid/SupabaseGrid.utils'
Expand All @@ -18,7 +19,6 @@ import type { TableApiAccessData, TableApiAccessMap } from 'data/privileges/tabl
import { useTableRowsCountQuery } from 'data/table-rows/table-rows-count-query'
import { useQuerySchemaState } from 'hooks/misc/useSchemaQueryState'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { formatSql } from 'lib/formatSql'
import {
useRoleImpersonationStateSnapshot,
type RoleImpersonationState,
Expand Down Expand Up @@ -263,23 +263,22 @@ export const EntityListItem = ({
e.stopPropagation()
const toastId = toast.loading('Getting table schema...')

const tableDefinition = await getTableDefinition({
const formattedSchema = getTableDefinition({
id: entity.id,
projectRef: project?.ref,
connectionString: project?.connectionString,
}).then((tableDefinition) => {
if (!tableDefinition) {
throw new Error('Failed to get table schema')
}
return formatSql(tableDefinition)
})
if (!tableDefinition) {
return toast.error('Failed to get table schema', { id: toastId })
}

try {
const formatted = formatSql(tableDefinition)
await copyToClipboard(formatted)
await copyToClipboard(formattedSchema)
toast.success('Table schema copied to clipboard', { id: toastId })
} catch (err: any) {
toast.error('Failed to copy schema: ' + (err.message || err), {
id: toastId,
})
toast.error('Failed to copy schema: ' + (err.message || err), { id: toastId })
}
}}
>
Expand Down
Loading
Loading