The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Chore/read replica final touches (#21420)
Joshen Limd1ab275beacd
diff --git a/apps/studio/components/interfaces/HomePageActions.tsx b/apps/studio/components/interfaces/HomePageActions.tsxindex 613181ec8d7..dae381e1fcc 100644--- a/apps/studio/components/interfaces/HomePageActions.tsx+++ b/apps/studio/components/interfaces/HomePageActions.tsx@@ -54,7 +54,7 @@ const HomePageActions = ({</DropdownMenuContent></DropdownMenu>- {IS_PLATFORM && organizationCreationEnabled && orgsLoaded && organizations.length !== 0 && (+ {IS_PLATFORM && organizationCreationEnabled && orgsLoaded && (<Button type="default" asChild><Link href="/new" className="flex items-center gap-2">New organizationdiff --git a/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseConnectionString.tsx b/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseConnectionString.tsxindex 6815fbe195b..a8373e8849e 100644--- a/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseConnectionString.tsx+++ b/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseConnectionString.tsx@@ -26,6 +26,8 @@ import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'import { useFlag } from 'hooks'import { pluckObjectFields } from 'lib/helpers'import Telemetry from 'lib/telemetry'+import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'+import { useDatabaseSettingsStateSnapshot } from 'state/database-settings'import { IPv4DeprecationNotice } from '../IPv4DeprecationNotice'import { UsePoolerCheckbox } from '../UsePoolerCheckbox'import {@@ -51,15 +53,14 @@ interface DatabaseConnectionStringProps {export const DatabaseConnectionString = ({ appearance }: DatabaseConnectionStringProps) => {const router = useRouter()- const { project: projectDetails, isLoading: isProjectLoading } = useProjectContext()- const { ref: projectRef, connectionString } = useParams()const telemetryProps = useTelemetryProps()+ const { ref: projectRef, connectionString } = useParams()+ const snap = useDatabaseSettingsStateSnapshot()+ const state = useDatabaseSelectorStateSnapshot()+ const { project: projectDetails, isLoading: isProjectLoading } = useProjectContext()const readReplicasEnabled = useFlag('readReplicas') && projectDetails?.is_read_replicas_enabledconst connectionStringsRef = useRef<HTMLDivElement>(null)- // [Joshen] Temp - so that behaviour for is similar to usePoolerCheckbox where the state is not synced with Connection Params- const [selectedDatabaseId, setSelectedDatabaseId] = useState(projectRef)- const [usePoolerConnection, setUsePoolerConnection] = useState(true)const [poolingMode, setPoolingMode] = useState<'transaction' | 'session' | 'statement'>('session')const [selectedTab, setSelectedTab] = useState<'uri' | 'psql' | 'golang' | 'jdbc' | 'dotnet' | 'nodejs' | 'php' | 'python'@@ -69,7 +70,7 @@ export const DatabaseConnectionString = ({ appearance }: DatabaseConnectionStrinprojectRef,})const poolingConfiguration = readReplicasEnabled- ? poolingInfo?.find((x) => x.identifier === selectedDatabaseId)+ ? poolingInfo?.find((x) => x.identifier === state.selectedDatabaseId): poolingInfo?.find((x) => x.database_type === 'PRIMARY')const {@@ -93,7 +94,9 @@ export const DatabaseConnectionString = ({ appearance }: DatabaseConnectionStrinconst isError = readReplicasEnabled ? isErrorReadReplicas : isErrorProjectSettingsconst isSuccess = readReplicasEnabled ? isSuccessReadReplicas : isSuccessProjectSettings- const selectedDatabase = (databases ?? []).find((db) => db.identifier === selectedDatabaseId)+ const selectedDatabase = (databases ?? []).find(+ (db) => db.identifier === state.selectedDatabaseId+ )const { project } = data ?? {}const DB_FIELDS = ['db_host', 'db_name', 'db_port', 'db_user', 'inserted_at']@@ -123,7 +126,7 @@ export const DatabaseConnectionString = ({ appearance }: DatabaseConnectionStrinisSuccessPoolingInfo && poolingConfiguration !== undefined? getConnectionStrings(connectionInfo, poolingConfiguration, {projectRef,- usePoolerConnection,+ usePoolerConnection: snap.usePoolerConnection,}): { uri: '', psql: '', golang: '', jdbc: '', dotnet: '', nodejs: '', php: '', python: '' }const poolerTld =@@ -134,12 +137,12 @@ export const DatabaseConnectionString = ({ appearance }: DatabaseConnectionStrinisSuccessPoolingInfo && poolingConfiguration !== undefined? constructConnStringSyntax(poolingConfiguration?.connectionString, {selectedTab,- usePoolerConnection,+ usePoolerConnection: snap.usePoolerConnection,ref: projectRef as string,cloudProvider: isProjectLoading ? '' : project?.cloud_provider || '',region: isProjectLoading ? '' : project?.region || '',- tld: usePoolerConnection ? poolerTld : connectionTld,- portNumber: usePoolerConnection+ tld: snap.usePoolerConnection ? poolerTld : connectionTld,+ portNumber: snap.usePoolerConnection? poolingMode === 'transaction'? poolingConfiguration?.db_port.toString(): '5432'@@ -153,7 +156,7 @@ export const DatabaseConnectionString = ({ appearance }: DatabaseConnectionStrinconnectionString !== undefined &&connectionStringsRef.current !== undefined) {- setSelectedDatabaseId(connectionString)+ state.setSelectedDatabaseId(connectionString)connectionStringsRef.current?.scrollIntoView({ block: 'center', behavior: 'smooth' })}}, [connectionString])@@ -195,12 +198,7 @@ export const DatabaseConnectionString = ({ appearance }: DatabaseConnectionStrinappearance === 'minimal' ? 'absolute -top-1 right-0' : '')}>- {readReplicasEnabled && (- <DatabaseSelector- selectedId={selectedDatabaseId}- setSelectedId={setSelectedDatabaseId}- />- )}+ {readReplicasEnabled && <DatabaseSelector />}<Button asChild type="default" icon={<IconExternalLink strokeWidth={1.5} />}><a href="https://supabase.com/docs/guides/database/connecting-to-postgres">Documentation@@ -233,12 +231,12 @@ export const DatabaseConnectionString = ({ appearance }: DatabaseConnectionStrin<div className="flex flex-col gap-y-4 pt-2"><UsePoolerCheckboxid="connection-string"- checked={usePoolerConnection}+ checked={snap.usePoolerConnection}poolingMode={poolingMode}- onCheckedChange={setUsePoolerConnection}+ onCheckedChange={snap.setUsePoolerConnection}onSelectPoolingMode={setPoolingMode}/>- {!usePoolerConnection && <IPv4DeprecationNotice />}+ {!snap.usePoolerConnection && <IPv4DeprecationNotice />}<InputcopyreadOnly@@ -275,7 +273,7 @@ export const DatabaseConnectionString = ({ appearance }: DatabaseConnectionStrin<div className="text-foreground-light"><p className="text-xs">You can use the following URI format to switch to a different database or user- {usePoolerConnection ? ' when using connection pooling' : ''}.+ {snap.usePoolerConnection ? ' when using connection pooling' : ''}.</p><p className="text-sm font-mono tracking-tight text-foreground-lighter">{poolerConnStringSyntax.map((x, idx) => {diff --git a/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseSettings.tsx b/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseSettings.tsxindex dafd86c1f8f..5eebfc8fbad 100644--- a/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseSettings.tsx+++ b/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseSettings.tsx@@ -13,6 +13,7 @@ import { useFlag, useSelectedProject } from 'hooks'import { pluckObjectFields } from 'lib/helpers'import Telemetry from 'lib/telemetry'import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'+import { useDatabaseSettingsStateSnapshot } from 'state/database-settings'import {AlertDescription_Shadcn_,AlertTitle_Shadcn_,@@ -28,13 +29,13 @@ const DatabaseSettings = () => {const router = useRouter()const { ref: projectRef, connectionString } = useParams()const telemetryProps = useTelemetryProps()+ const snap = useDatabaseSettingsStateSnapshot()const state = useDatabaseSelectorStateSnapshot()const selectedProject = useSelectedProject()const readReplicasEnabled = useFlag('readReplicas')const showReadReplicasUI = readReplicasEnabled && selectedProject?.is_read_replicas_enabledconst connectionStringsRef = useRef<HTMLDivElement>(null)- const [usePoolerConnection, setUsePoolerConnection] = useState(true)const [poolingMode, setPoolingMode] = useState<'transaction' | 'session' | 'statement'>('session')const {@@ -86,7 +87,7 @@ const DatabaseSettings = () => {? pluckObjectFields(selectedDatabase || emptyState, DB_FIELDS): pluckObjectFields(project || emptyState, DB_FIELDS)- const connectionInfo = usePoolerConnection+ const connectionInfo = snap.usePoolerConnection? {db_host: primaryConfig?.db_host,db_name: primaryConfig?.db_name,@@ -150,12 +151,12 @@ const DatabaseSettings = () => {<div className="space-y-4"><UsePoolerCheckboxid="connection-params"- checked={usePoolerConnection}+ checked={snap.usePoolerConnection}poolingMode={poolingMode}- onCheckedChange={setUsePoolerConnection}+ onCheckedChange={snap.setUsePoolerConnection}onSelectPoolingMode={setPoolingMode}/>- {!usePoolerConnection && <IPv4DeprecationNotice />}+ {!snap.usePoolerConnection && <IPv4DeprecationNotice />}{isMd5 && (<Alert_Shadcn_><IconAlertCircle strokeWidth={2} />@@ -200,7 +201,7 @@ const DatabaseSettings = () => {value={poolingMode === 'transaction' ? connectionInfo.db_port : '5432'}label="Port"/>- {isMd5 && usePoolerConnection && (+ {isMd5 && snap.usePoolerConnection && (<InputclassName="input-mono"layout="horizontal"diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DeployNewReplicaPanel.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DeployNewReplicaPanel.tsxindex 4413d7677b5..0faf37c0f5c 100644--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DeployNewReplicaPanel.tsx+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DeployNewReplicaPanel.tsx@@ -18,7 +18,8 @@ import { AVAILABLE_REPLICA_REGIONS, AWS_REGIONS_VALUES } from './InstanceConfiguimport { useReadReplicasQuery } from 'data/read-replicas/replicas-query'import Link from 'next/link'import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'-import { useSelectedOrganization } from 'hooks'+import { useSelectedOrganization, useSelectedProject } from 'hooks'+import { WarningIcon } from 'components/ui/Icons'// [Joshen] FYI this is purely for AWS only, need to update to support Fly eventually@@ -36,10 +37,13 @@ const DeployNewReplicaPanel = ({onClose,}: DeployNewReplicaPanelProps) => {const { ref: projectRef } = useParams()+ const project = useSelectedProject()const org = useSelectedOrganization()+const { data } = useReadReplicasQuery({ projectRef })const { data: addons, isSuccess } = useProjectAddonsQuery({ projectRef })const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: org?.slug })+const { mutate: setUpReplica, isLoading: isSettingUp } = useReadReplicaSetUpMutation({onSuccess: () => {const region = AVAILABLE_REPLICA_REGIONS.find((r) => r.key === selectedRegion)?.name@@ -49,13 +53,18 @@ const DeployNewReplicaPanel = ({},})+ const reachedMaxReplicas = (data ?? []).filter((db) => db.identifier !== projectRef).length >= 2const isFreePlan = subscription?.plan.id === 'free'const currentComputeAddon = addons?.selected_addons.find((addon) => addon.type === 'compute_instance')const currentPitrAddon = addons?.selected_addons.find((addon) => addon.type === 'pitr')const canDeployReplica =- !isFreePlan && currentComputeAddon !== undefined && currentPitrAddon !== undefined+ !reachedMaxReplicas &&+ project?.cloud_provider === 'AWS' &&+ !isFreePlan &&+ currentComputeAddon !== undefined &&+ currentPitrAddon !== undefinedconst computeAddons =addons?.available_addons.find((addon) => addon.type === 'compute_instance')?.variants ?? []@@ -104,9 +113,9 @@ const DeployNewReplicaPanel = ({header="Deploy a new read replica"><SidePanel.Content className="flex flex-col py-4 gap-y-8">- {!canDeployReplica && (+ {currentPitrAddon === undefined && (<Alert_Shadcn_>- <IconAlertCircle strokeWidth={2} />+ <WarningIcon /><AlertTitle_Shadcn_>Point in time recovery is required to deploy replicas</AlertTitle_Shadcn_>@@ -142,6 +151,17 @@ const DeployNewReplicaPanel = ({</AlertDescription_Shadcn_></Alert_Shadcn_>)}+ {reachedMaxReplicas && (+ <Alert_Shadcn_>+ <WarningIcon />+ <AlertTitle_Shadcn_>+ You can only deploy up to 2 read replicas at once+ </AlertTitle_Shadcn_>+ <AlertDescription_Shadcn_>+ If you'd like to spin up another read replica, please drop an existing replica first.+ </AlertDescription_Shadcn_>+ </Alert_Shadcn_>+ )}<Listboxsize="small"id="region"diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DropReplicaConfirmationModal.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DropReplicaConfirmationModal.tsxindex 9a9dcb09ccf..ae311a2ef92 100644--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DropReplicaConfirmationModal.tsx+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DropReplicaConfirmationModal.tsx@@ -1,8 +1,4 @@import { useParams } from 'common'-import ConfirmationModal from 'components/ui/ConfirmationModal'-import { useReadReplicaRemoveMutation } from 'data/read-replicas/replica-remove-mutation'-import { Database } from 'data/read-replicas/replicas-query'-import { formatDatabaseID } from 'data/read-replicas/replicas.utils'import toast from 'react-hot-toast'import {AlertDescription_Shadcn_,@@ -12,6 +8,11 @@ import {Modal,} from 'ui'+import ConfirmationModal from 'components/ui/ConfirmationModal'+import { useReadReplicaRemoveMutation } from 'data/read-replicas/replica-remove-mutation'+import { Database } from 'data/read-replicas/replicas-query'+import { formatDatabaseID } from 'data/read-replicas/replicas.utils'+interface DropReplicaConfirmationModalProps {selectedReplica?: DatabaseonSuccess: () => void@@ -27,7 +28,7 @@ const DropReplicaConfirmationModal = ({const formattedId = formatDatabaseID(selectedReplica?.identifier ?? '')const { mutateAsync: removeReadReplica } = useReadReplicaRemoveMutation({onSuccess: () => {- toast.success(`Successfully removed read replica (ID: ${formattedId})`)+ toast.success(`Tearing down read replica (ID: ${formattedId})`)onSuccess()onCancel()},diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsxindex 6325f596b89..a878354fdc8 100644--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx@@ -8,15 +8,16 @@ import 'reactflow/dist/style.css'import { Button } from 'ui'import AlertError from 'components/ui/AlertError'+import { useLoadBalancersQuery } from 'data/read-replicas/load-balancers-query'import { Database, useReadReplicasQuery } from 'data/read-replicas/replicas-query'import { useReadReplicasStatusesQuery } from 'data/read-replicas/replicas-status-query'import { AWS_REGIONS_KEYS } from 'lib/constants'+import { timeout } from 'lib/helpers'import DeployNewReplicaPanel from './DeployNewReplicaPanel'import DropReplicaConfirmationModal from './DropReplicaConfirmationModal'import { addRegionNodes, generateNodes, getDagreGraphLayout } from './InstanceConfiguration.utils'import { LoadBalancerNode, PrimaryNode, RegionNode, ReplicaNode } from './InstanceNode'import MapView from './MapView'-import { useLoadBalancersQuery } from 'data/read-replicas/load-balancers-query'// [Joshen] Just FYI, UI assumes single provider for primary + replicas// [Joshen] Idea to visualize grouping based on region: https://reactflow.dev/examples/layout/sub-flows@@ -59,14 +60,14 @@ const InstanceConfigurationUI = () => {{refetchInterval: refetchInterval as any,refetchOnWindowFocus: false,- onSuccess: (data) => {+ onSuccess: async (data) => {const comingUpReplicas = data.filter((db) => db.status === 'COMING_UP')const hasTransientStatus = comingUpReplicas.length > 0// If any replica's status has changed, refetch databasesif (numComingUp.current !== comingUpReplicas.length) {numComingUp.current = comingUpReplicas.length- refetch()+ await refetch()}// If all replicas are active healthy, stop fetching statuses@@ -89,31 +90,39 @@ const InstanceConfigurationUI = () => {onSelectDropReplica: setSelectedReplicaToDrop,}): [],- [isSuccessReplicas, isSuccessLoadBalancers]+ [isSuccessReplicas, isSuccessLoadBalancers, primary, replicas, loadBalancers])- const edges: Edge[] = [- ...((loadBalancers ?? []).length > 0- ? [- {- id: `load-balancer-${primary.identifier}`,- source: 'load-balancer',- target: primary.identifier,- type: 'smoothstep',- animated: true,- },- ]- : []),- ...replicas.map((database) => {- return {- id: `${primary.identifier}-${database.identifier}`,- source: primary.identifier,- target: database.identifier,- type: 'smoothstep',- animated: true,- }- }),- ]+ const edges: Edge[] = useMemo(+ () =>+ isSuccessReplicas && isSuccessLoadBalancers+ ? [+ ...((loadBalancers ?? []).length > 0+ ? [+ {+ id: `load-balancer-${primary.identifier}`,+ source: 'load-balancer',+ target: primary.identifier,+ type: 'smoothstep',+ animated: true,+ className: '!cursor-default',+ },+ ]+ : []),+ ...replicas.map((database) => {+ return {+ id: `${primary.identifier}-${database.identifier}`,+ source: primary.identifier,+ target: database.identifier,+ type: 'smoothstep',+ animated: true,+ className: '!cursor-default',+ }+ }),+ ]+ : [],+ [isSuccessLoadBalancers, isSuccessReplicas, loadBalancers, primary?.identifier, replicas]+ )const nodeTypes = useMemo(() => ({@@ -125,24 +134,27 @@ const InstanceConfigurationUI = () => {[])- const onConfirmDropReplica = () => {- console.log('Drop replica', selectedReplicaToDrop)- }-const onConfirmRestartReplica = () => {console.log('Restart replica', selectedReplicaToRestart)}+ const setReactFlow = async () => {+ const graph = getDagreGraphLayout(nodes, edges)+ const { nodes: updatedNodes } = addRegionNodes(graph.nodes, graph.edges)+ reactFlow.setNodes(updatedNodes)+ reactFlow.setEdges(graph.edges)++ // [Joshen] Odd fix to ensure that react flow snaps back to center when adding nodes+ await timeout(1)+ reactFlow.fitView({ maxZoom: 0.9, minZoom: 0.9 })+ }+// [Joshen] Just FYI this block is oddly triggering whenever we refocus on the viewport// even if I change the dependency array to just data. Not blocker, just an area to optimizeuseEffect(() => {- if (isSuccessReplicas && isSuccessLoadBalancers && replicas.length > 0) {- const graph = getDagreGraphLayout(nodes, edges)- const { nodes: updatedNodes } = addRegionNodes(graph.nodes, graph.edges)- reactFlow.setNodes(updatedNodes)- reactFlow.setEdges(graph.edges)- }- }, [isSuccessReplicas, isSuccessLoadBalancers])+ if (isSuccessReplicas && isSuccessLoadBalancers && nodes.length > 0 && view === 'flow')+ setReactFlow()+ }, [isSuccessReplicas, isSuccessLoadBalancers, nodes, edges, view])return (<>@@ -193,12 +205,6 @@ const InstanceConfigurationUI = () => {defaultNodes={[]}defaultEdges={[]}nodeTypes={nodeTypes}- onInit={() => {- const graph = getDagreGraphLayout(nodes, edges)- const { nodes: updatedNodes } = addRegionNodes(graph.nodes, graph.edges)- reactFlow.setNodes(updatedNodes)- reactFlow.setEdges(graph.edges)- }}proOptions={{ hideAttribution: true }}><Background color={backgroundPatternColor} />diff --git a/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx b/apps/studio/components/interfaces/Settings/Logs/LogTable.tsxindex d88fa9de66b..ae9c56950c8 100644--- a/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx+++ b/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx@@ -190,7 +190,7 @@ const LogTable = ({const RowRenderer = useCallback<(key: Key, props: RenderRowProps<LogData, unknown>) => ReactNode>((key, props) => {- return <Row {...props} isRowSelected={false} selectedCellIdx={undefined} />+ return <Row key={key} {...props} isRowSelected={false} selectedCellIdx={undefined} />},[])@@ -317,31 +317,12 @@ const LogTable = ({const renderNoResultAlert = () => (<div className="flex scale-100 flex-col items-center justify-center gap-6 text-center opacity-100"><div className="flex flex-col gap-1">- <div className="relative flex h-4 w-32 items-center rounded border border-dashed border-stronger px-2"></div>- <div className="relative flex h-4 w-32 items-center rounded border border-dashed border-stronger px-2">- <div className="absolute right-1 -bottom-4 text-foreground-light">- <svg- xmlns="http://www.w3.org/2000/svg"- className="h-6 w-6"- fill="none"- viewBox="0 0 24 24"- stroke="currentColor"- strokeWidth="2"- >- <path- strokeLinecap="round"- strokeLinejoin="round"- d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"- />- </svg>- </div>- </div>+ <div className="relative flex h-4 w-32 items-center rounded border border-dashed border-stronger px-2" />+ <div className="relative flex h-4 w-32 items-center rounded border border-dashed border-stronger px-2" /></div><div className="flex flex-col gap-1 px-5">- <h3 className="text-lg text-foreground">No results</h3>- <p className="text-sm text-foreground-lighter">- Try another search, or adjusting the filters- </p>+ <h3 className="text-lg text-foreground">No results found</h3>+ <p className="text-sm text-foreground-lighter">Try another search or adjust the filters</p></div></div>)diff --git a/apps/studio/components/interfaces/Settings/Logs/Logs.utils.ts b/apps/studio/components/interfaces/Settings/Logs/Logs.utils.tsindex d500548f006..a0133c2f4af 100644--- a/apps/studio/components/interfaces/Settings/Logs/Logs.utils.ts+++ b/apps/studio/components/interfaces/Settings/Logs/Logs.utils.ts@@ -1,12 +1,13 @@-import { Filters, LogData, LogsEndpointParams, LogsTableName, SQL_FILTER_TEMPLATES } from '.'+import { useMonaco } from '@monaco-editor/react'import dayjs, { Dayjs } from 'dayjs'import { get, isEqual } from 'lodash'-import { useMonaco } from '@monaco-editor/react'-import logConstants from 'shared-data/logConstants'-import BackwardIterator from 'components/ui/CodeEditor/Providers/BackwardIterator'import uniqBy from 'lodash/uniqBy'import { useEffect } from 'react'+import logConstants from 'shared-data/logConstants'++import BackwardIterator from 'components/ui/CodeEditor/Providers/BackwardIterator'import { PlanId } from 'data/subscriptions/types'+import { Filters, LogData, LogsEndpointParams, LogsTableName, SQL_FILTER_TEMPLATES } from '.'/*** Convert a micro timestamp from number/string to iso timestamp@@ -99,7 +100,18 @@ const genWhereStatement = (table: LogsTableName, filters: Filters) => {const statement = keys.map((rootKey) => {- if (typeof filters[rootKey] === 'object') {+ if (+ filters[rootKey] === undefined ||+ (typeof filters[rootKey] === 'string' && (filters[rootKey] as string).length === 0)+ ) {+ return null+ } else if (rootKey === 'database') {+ return table === 'edge_logs'+ ? `(request.host like '${filters[rootKey]}%')`+ : table === 'supavisor_logs'+ ? `(m.project like '${filters[rootKey]}%')`+ : null+ } else if (typeof filters[rootKey] === 'object') {// join all statements with an ORconst nestedStatements = getDotKeys(filters[rootKey] as Filters, rootKey).map(_resolveTemplateToStatement)@@ -172,6 +184,8 @@ export const genDefaultQuery = (table: LogsTableName, filters: Filters) => {${orderBy}limit 100`+ case 'supavisor_logs':+ return `select id, ${table}.timestamp, event_message from ${table} ${joins} ${where} ${orderBy} limit 100`default:return `select id, ${table}.timestamp, event_message from ${table}@@ -208,6 +222,9 @@ const genCrossJoinUnnests = (table: LogsTableName) => {cross join unnest(m.response) as responsecross join unnest(m.request) as request`+ case 'supavisor_logs':+ return `cross join unnest(metadata) as m`+default:return ''}diff --git a/apps/studio/components/interfaces/Settings/Logs/LogsFormatters.tsx b/apps/studio/components/interfaces/Settings/Logs/LogsFormatters.tsxindex 10e382b2432..581670464f4 100644--- a/apps/studio/components/interfaces/Settings/Logs/LogsFormatters.tsx+++ b/apps/studio/components/interfaces/Settings/Logs/LogsFormatters.tsx@@ -31,20 +31,22 @@ export const SelectionDetailedRow = ({}) => {return (<div className="grid grid-cols-12 group">- <span className="text-foreground-lighter text-sm col-span-4 whitespace-pre-wrap">+ <span className="text-foreground-lighter text-sm col-span-3 whitespace-pre-wrap">{label}</span>- <span className="text-foreground text-sm col-span-6 whitespace-pre-wrap break-all">+ <span+ title={value}+ className="truncate text-foreground text-sm col-span-8 whitespace-pre-wrap break-all"+ >{valueRender ?? value}</span><CopyButton+ iconOnlytext={value}- className="group-hover:opacity-100 opacity-0 my-auto transition col-span-2 h-4 w-4 px-0 py-0"+ className="group-hover:opacity-100 opacity-0 p-0 h-6 w-6 col-span-1"type="text"title="Copy to clipboard"- >- {''}- </CopyButton>+ /></div>)}diff --git a/apps/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx b/apps/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsxindex f2f33ed0bc1..92b94adb206 100644--- a/apps/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx+++ b/apps/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx@@ -21,8 +21,11 @@ import useLogsPreview from 'hooks/analytics/useLogsPreview'import { useUpgradePrompt } from 'hooks/misc/useUpgradePrompt'import { LOGS_TABLES } from './Logs.constants'import UpgradePrompt from './UpgradePrompt'-import { useSelectedOrganization } from 'hooks'+import { useFlag, useSelectedOrganization } from 'hooks'import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'+import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'+import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'+import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'/*** Acts as a container component for the entire log display@@ -50,9 +53,14 @@ export const LogsPreviewer = ({children,}: PropsWithChildren<LogsPreviewerProps>) => {const router = useRouter()- const { s, ite, its } = useParams()+ const { s, ite, its, db } = useParams()const [showChart, setShowChart] = useState(true)+ const { project } = useProjectContext()const organization = useSelectedOrganization()+ const state = useDatabaseSelectorStateSnapshot()+ const readReplicasEnabled = useFlag('readReplicas') && project?.is_read_replicas_enabled++ const { data: databases, isSuccess } = useReadReplicasQuery({ projectRef })const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: organization?.slug })const table = !tableName ? LOGS_TABLES[queryType] : tableName@@ -77,7 +85,11 @@ export const LogsPreviewer = ({)useEffect(() => {- setFilters((prev) => ({ ...prev, search_query: s as string }))+ setFilters((prev) => ({+ ...prev,+ search_query: s as string,+ ...(readReplicasEnabled ? { database: db as string } : {}),+ }))if (ite || its) {setParams((prev) => ({...prev,@@ -85,7 +97,7 @@ export const LogsPreviewer = ({iso_timestamp_end: (ite || '') as string,}))}- }, [s, ite, its])+ }, [db, s, ite, its])// Show the prompt on page load based on query paramsuseEffect(() => {@@ -97,6 +109,13 @@ export const LogsPreviewer = ({}}, [its, subscription])+ useEffect(() => {+ if (readReplicasEnabled && db !== undefined) {+ const database = databases?.find((d) => d.identifier === db)+ if (database !== undefined) state.setSelectedDatabaseId(db)+ }+ }, [readReplicasEnabled, db, isSuccess])+const onSelectTemplate = (template: LogTemplate) => {setFilters((prev: any) => ({ ...prev, search_query: template.searchString }))}@@ -172,15 +191,11 @@ export const LogsPreviewer = ({defaultSearchValue={filters.search_query as string}defaultToValue={params.iso_timestamp_end}defaultFromValue={params.iso_timestamp_start}- onExploreClick={() => {- router.push(- `/project/${projectRef}/logs/explorer?q=${encodeURIComponent(- params.sql || ''- )}&its=${encodeURIComponent(params.iso_timestamp_start || '')}&ite=${encodeURIComponent(- params.iso_timestamp_end || ''- )}`- )- }}+ queryUrl={`/project/${projectRef}/logs/explorer?q=${encodeURIComponent(+ params.sql || ''+ )}&its=${encodeURIComponent(params.iso_timestamp_start || '')}&ite=${encodeURIComponent(+ params.iso_timestamp_end || ''+ )}`}onSelectTemplate={onSelectTemplate}filters={filters}onFiltersChange={setFilters}@@ -188,6 +203,19 @@ export const LogsPreviewer = ({condensedLayout={condensedLayout}isShowingEventChart={showChart}onToggleEventChart={() => setShowChart(!showChart)}+ onSelectedDatabaseChange={(id: string) => {+ if (readReplicasEnabled) {+ setFilters((prev) => ({+ ...prev,+ database: id !== projectRef ? undefined : id,+ }))+ const { db, ...params } = router.query+ router.push({+ pathname: router.pathname,+ query: id !== projectRef ? { ...router.query, db: id } : params,+ })+ }+ }}/>{children}<div@@ -228,7 +256,7 @@ export const LogsPreviewer = ({/></LoadingOpacity>{!error && (- <div className="flex flex-row justify-between p-2">+ <div className="border-t flex flex-row justify-between p-2"><ButtononClick={loadOlder}icon={<IconRewind />}diff --git a/apps/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsx b/apps/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsxindex 8f804576745..193375a0ef0 100644--- a/apps/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsx+++ b/apps/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsx@@ -1,10 +1,26 @@+import Link from 'next/link'+import { useRouter } from 'next/router'import { useEffect, useState } from 'react'-import { Button, IconExternalLink, IconEye, IconEyeOff, IconRefreshCw, IconSearch, Input } from 'ui'+import {+ Button,+ IconEye,+ IconEyeOff,+ IconRefreshCw,+ IconSearch,+ IconTerminal,+ Input,+ TooltipContent_Shadcn_,+ TooltipTrigger_Shadcn_,+ Tooltip_Shadcn_,+} from 'ui'+import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'import CSVButton from 'components/ui/CSVButton'+import DatabaseSelector from 'components/ui/DatabaseSelector'+import { useFlag } from 'hooks'import { Filters, LogSearchCallback, LogTemplate, PREVIEWER_DATEPICKER_HELPERS } from '.'-import { FILTER_OPTIONS, LogsTableName } from './Logs.constants'import DatePickers from './Logs.DatePickers'+import { FILTER_OPTIONS, LogsTableName } from './Logs.constants'import LogsFilterPopover from './LogsFilterPopover'interface PreviewFilterPanelProps {@@ -17,6 +33,7 @@ interface PreviewFilterPanelProps {onRefresh?: () => voidonSearch?: LogSearchCallbackonExploreClick?: () => void+ queryUrl: stringonSelectTemplate: (template: LogTemplate) => voidtable: LogsTableNamecondensedLayout: Boolean@@ -25,6 +42,7 @@ interface PreviewFilterPanelProps {csvData?: unknown[]onFiltersChange: (filters: Filters) => voidfilters: Filters+ onSelectedDatabaseChange: (id: string) => void}/**@@ -39,6 +57,7 @@ const PreviewFilterPanel = ({defaultToValue = '',defaultFromValue = '',onExploreClick,+ queryUrl,condensedLayout,isShowingEventChart,onToggleEventChart,@@ -46,8 +65,18 @@ const PreviewFilterPanel = ({onFiltersChange,filters,table,+ onSelectedDatabaseChange,}: PreviewFilterPanelProps) => {+ const router = useRouter()const [search, setSearch] = useState('')+ const readReplicasEnabled = useFlag('readReplicas')+ const { project } = useProjectContext()++ // [Joshen] These are the routes tested that can show replica logs+ const showDatabaseSelector =+ readReplicasEnabled &&+ project?.is_read_replicas_enabled &&+ ['/project/[ref]/logs/edge-logs', '/project/[ref]/logs/pooler-logs'].includes(router.pathname)const hasEdits = search !== defaultSearchValue@@ -59,46 +88,49 @@ const PreviewFilterPanel = ({}, [defaultSearchValue])const RefreshButton = () => (- <Button- type="default"- icon={- <div className="relative">- {newCount > 0 && (- <div- className={[- 'absolute -top-3 right-3 flex items-center justify-center',- 'z-50 h-4 w-4',- ].join(' ')}- >- <div className="absolute z-20">- <p style={{ fontSize: '0.6rem' }} className="text-white">- {newCount > 1000 ? `${Math.floor(newCount / 100) / 10}K` : newCount}- </p>- </div>- <div className="h-full w-full animate-ping rounded-full bg-green-800 opacity-60"></div>- <div className="z-60 absolute top-0 right-0 h-full w-full rounded-full bg-green-900 opacity-80"></div>+ <Tooltip_Shadcn_ delayDuration={100}>+ <TooltipTrigger_Shadcn_ asChild>+ <Button+ type="default"+ className="px-1.5"+ icon={+ <div className="relative">+ {newCount > 0 && (+ <div className="absolute -top-3 right-3 flex items-center justify-center">+ <div className="absolute z-20">+ <p style={{ fontSize: '0.6rem' }} className="text-white">+ {newCount > 1000 ? `${Math.floor(newCount / 100) / 10}K` : newCount}+ </p>+ </div>+ <div className="h-full w-full animate-ping rounded-full bg-green-800 opacity-60"></div>+ <div className="z-60 absolute top-0 right-0 h-full w-full rounded-full bg-green-900 opacity-80"></div>+ </div>+ )}+ <IconRefreshCw /></div>- )}- <IconRefreshCw size={10} />- </div>- }- loading={isLoading}- disabled={isLoading}- onClick={onRefresh}- >- Refresh- </Button>+ }+ loading={isLoading}+ disabled={isLoading}+ onClick={onRefresh}+ />+ </TooltipTrigger_Shadcn_>+ <TooltipContent_Shadcn_ side="bottom" className="text-xs">+ Refresh logs+ </TooltipContent_Shadcn_>+ </Tooltip_Shadcn_>)+const handleDatepickerChange = ({ to, from }: Partial<Parameters<LogSearchCallback>[1]>) => {onSearch('datepicker-change', { to, from })}+const handleInputSearch = (query: string) => onSearch('search-input-change', { query })return (<div- className={'flex w-full items-center justify-between' + (condensedLayout ? ' px-5 pt-4' : '')}+ className={'flex w-full items-center justify-between' + (condensedLayout ? ' px-4 pt-4' : '')}>- <div className="flex flex-row items-center gap-4">+ <div className="flex flex-row items-center gap-x-2"><formid="log-panel-search"onSubmit={(e) => {@@ -135,6 +167,8 @@ const PreviewFilterPanel = ({/></form>+ <RefreshButton />+<DatePickersonChange={handleDatepickerChange}to={defaultToValue}@@ -142,36 +176,34 @@ const PreviewFilterPanel = ({helpers={PREVIEWER_DATEPICKER_HELPERS}/>- <div>- <RefreshButton />- </div>+ {FILTER_OPTIONS[table] !== undefined && (+ <div className="flex items-center">+ {FILTER_OPTIONS[table] &&+ Object.values(FILTER_OPTIONS[table]).map((x, i: number) => {+ const classes = []- <div className="flex items-center">- {FILTER_OPTIONS[table] &&- Object.values(FILTER_OPTIONS[table]).map((x, i: number) => {- const classes = []-- if (Object.values(FILTER_OPTIONS[table]).length >= 2) {- if (i === 0) {- classes.push('rounded-tr-none rounded-br-none')- } else if (i === Object.values(FILTER_OPTIONS[table]).length - 1) {- classes.push('rounded-tl-none rounded-bl-none')- } else {- classes.push('rounded-none')+ if (Object.values(FILTER_OPTIONS[table]).length >= 2) {+ if (i === 0) {+ classes.push('rounded-tr-none rounded-br-none')+ } else if (i === Object.values(FILTER_OPTIONS[table]).length - 1) {+ classes.push('rounded-tl-none rounded-bl-none')+ } else {+ classes.push('rounded-none')+ }}- }-- return (- <LogsFilterPopover- buttonClassName={classes.join(' ')}- key={`${x.key}-filter`}- options={x}- onFiltersChange={onFiltersChange}- filters={filters}- />- )- })}- </div>++ return (+ <LogsFilterPopover+ buttonClassName={classes.join(' ')}+ key={`${x.key}-filter`}+ options={x}+ onFiltersChange={onFiltersChange}+ filters={filters}+ />+ )+ })}+ </div>+ )}<div className="flex items-center space-x-2"><Buttontype="default"@@ -184,9 +216,25 @@ const PreviewFilterPanel = ({<CSVButton data={csvData} disabled={!Boolean(csvData)} title="Download data" /></div>- <Button type="default" onClick={onExploreClick} iconRight={<IconExternalLink size={10} />}>- Explore via query- </Button>+ {showDatabaseSelector ? (+ <div className="flex items-center justify-center gap-x-2">+ <Tooltip_Shadcn_ delayDuration={100}>+ <TooltipTrigger_Shadcn_ asChild>+ <Button asChild className="px-1" type="default" icon={<IconTerminal />}>+ <Link href={queryUrl} />+ </Button>+ </TooltipTrigger_Shadcn_>+ <TooltipContent_Shadcn_ side="bottom" className="text-xs">+ Open query in Logs Explorer+ </TooltipContent_Shadcn_>+ </Tooltip_Shadcn_>+ <DatabaseSelector onSelectId={onSelectedDatabaseChange} />+ </div>+ ) : (+ <Button asChild type="default" onClick={onExploreClick}>+ <Link href={queryUrl}>Explore via query</Link>+ </Button>+ )}</div>)}diff --git a/apps/studio/components/layouts/SQLEditorLayout/SQLEditorMenu.tsx b/apps/studio/components/layouts/SQLEditorLayout/SQLEditorMenu.tsxindex 2be0ab6e683..4ceef5b5b4f 100644--- a/apps/studio/components/layouts/SQLEditorLayout/SQLEditorMenu.tsx+++ b/apps/studio/components/layouts/SQLEditorLayout/SQLEditorMenu.tsx@@ -314,7 +314,7 @@ const SideBarContent = observer(() => {onClick={() => setSelectedQueries([])}/></TooltipTrigger_Shadcn_>- <TooltipContent_Shadcn_ side="bottom">+ <TooltipContent_Shadcn_ side="bottom" className="text-xs">Clear selection</TooltipContent_Shadcn_></Tooltip_Shadcn_>diff --git a/apps/studio/components/ui/CSVButton.tsx b/apps/studio/components/ui/CSVButton.tsxindex 3289641afe0..36db8de8ea2 100644--- a/apps/studio/components/ui/CSVButton.tsx+++ b/apps/studio/components/ui/CSVButton.tsx@@ -1,8 +1,13 @@-import { Button, IconDownloadCloud } from 'ui'-import { ButtonProps } from 'ui/src/components/Button/Button'-import { flattenDeep } from 'lodash'import React, { PropsWithChildren, useMemo, useRef } from 'react'import { CSVLink } from 'react-csv'+import {+ Button,+ IconDownload,+ TooltipContent_Shadcn_,+ TooltipTrigger_Shadcn_,+ Tooltip_Shadcn_,+} from 'ui'+import { ButtonProps } from 'ui/src/components/Button/Button'interface CSVButtonProps {buttonType?: ButtonProps['type']@@ -52,17 +57,25 @@ const CSVButton = ({filename={`supabase_logs.csv`}title={title}/>- <Button- type={buttonType}- icon={icon || <IconDownloadCloud />}- disabled={disabled}- onClick={(e) => {- if (onClick) onClick(e)- handleDownload()- }}- >- {children}- </Button>+ <Tooltip_Shadcn_ delayDuration={100}>+ <TooltipTrigger_Shadcn_ asChild>+ <Button+ type={buttonType}+ icon={icon || <IconDownload />}+ disabled={disabled}+ className="px-1.5"+ onClick={(e) => {+ if (onClick) onClick(e)+ handleDownload()+ }}+ >+ {children}+ </Button>+ </TooltipTrigger_Shadcn_>+ <TooltipContent_Shadcn_ side="bottom" className="text-xs">+ Download logs as CSV+ </TooltipContent_Shadcn_>+ </Tooltip_Shadcn_></>)}diff --git a/apps/studio/components/ui/DatabaseSelector.tsx b/apps/studio/components/ui/DatabaseSelector.tsxindex 6fe27c61c8e..ab43c7fa5ba 100644--- a/apps/studio/components/ui/DatabaseSelector.tsx+++ b/apps/studio/components/ui/DatabaseSelector.tsx@@ -1,7 +1,8 @@+import { useParams } from 'common'+import { noop } from 'lodash'import Link from 'next/link'import { useRouter } from 'next/router'import { useState } from 'react'-import { useParams } from 'common'import {Button,CommandGroup_Shadcn_,@@ -10,6 +11,7 @@ import {Command_Shadcn_,IconCheck,IconChevronDown,+ IconLoader,IconPlus,PopoverContent_Shadcn_,PopoverTrigger_Shadcn_,@@ -25,25 +27,26 @@ import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'interface DatabaseSelectorProps {variant?: 'regular' | 'connected-on-right' | 'connected-on-left' | 'connected-on-both'additionalOptions?: { id: string; name: string }[]- selectedId?: string // Optional to let parent component control its state (e.g Database Settings page)- setSelectedId?: (value: string) => void+ onSelectId?: (id: string) => void // Optional callback}const DatabaseSelector = ({variant = 'regular',additionalOptions = [],- selectedId,- setSelectedId,+ onSelectId = noop,}: DatabaseSelectorProps) => {const router = useRouter()const { ref: projectRef } = useParams()const [open, setOpen] = useState(false)const state = useDatabaseSelectorStateSnapshot()- const selectedDatabaseId = selectedId || state.selectedDatabaseId+ const selectedDatabaseId = state.selectedDatabaseId- const { data } = useReadReplicasQuery({ projectRef })+ const { data, isLoading, isSuccess } = useReadReplicasQuery({ projectRef })const databases = data ?? []+ const sortedDatabases = databases+ .sort((a, b) => (a.inserted_at > b.inserted_at ? 1 : 0))+ .sort((database) => (database.identifier === projectRef ? -1 : 0))const selectedDatabase = databases.find((db) => db.identifier === selectedDatabaseId)const selectedDatabaseRegion = formatDatabaseRegion(selectedDatabase?.region ?? '')@@ -63,6 +66,7 @@ const DatabaseSelector = ({variant === 'connected-on-left' && 'rounded-l-none border-l-0',variant === 'connected-on-both' && 'rounded-none border-x-0')}+ icon={isLoading && <IconLoader className="animate-spin" />}iconRight={<IconChevronDown className="text-foreground-light" strokeWidth={2} size={12} />}@@ -73,11 +77,11 @@ const DatabaseSelector = ({) : (<><span className="capitalize">- {selectedDatabase?.identifier === projectRef+ {isLoading || selectedDatabase?.identifier === projectRef? 'Primary database': 'Read replica'}</span>{' '}- {selectedDatabase?.identifier !== projectRef && (+ {isSuccess && selectedDatabase?.identifier !== projectRef && (<span>({selectedDatabaseRegion} - {formattedDatabaseId})</span>@@ -116,7 +120,7 @@ const DatabaseSelector = ({)}<CommandGroup_Shadcn_><ScrollArea className={(databases || []).length > 7 ? 'h-[210px]' : ''}>- {databases?.map((database) => {+ {sortedDatabases?.map((database) => {const region = formatDatabaseRegion(database.region)const id = formatDatabaseID(database.identifier)@@ -126,14 +130,14 @@ const DatabaseSelector = ({value={database.identifier}className="cursor-pointer w-full"onSelect={() => {- if (setSelectedId) setSelectedId(database.identifier)- else state.setSelectedDatabaseId(database.identifier)+ state.setSelectedDatabaseId(database.identifier)setOpen(false)+ onSelectId(database.identifier)}}onClick={() => {- if (setSelectedId) setSelectedId(database.identifier)- else state.setSelectedDatabaseId(database.identifier)+ state.setSelectedDatabaseId(database.identifier)setOpen(false)+ onSelectId(database.identifier)}}><div className="w-full flex items-center justify-between">@@ -160,9 +164,7 @@ const DatabaseSelector = ({><Linkhref={`/project/${projectRef}/settings/infrastructure`}- onClick={() => {- setOpen(false)- }}+ onClick={() => setOpen(false)}className="w-full flex items-center gap-2"><IconPlus size={14} strokeWidth={1.5} />diff --git a/apps/studio/components/ui/Logs/LogsExplorerHeader.tsx b/apps/studio/components/ui/Logs/LogsExplorerHeader.tsxindex 2202d62f3cc..e2ae887e49b 100644--- a/apps/studio/components/ui/Logs/LogsExplorerHeader.tsx+++ b/apps/studio/components/ui/Logs/LogsExplorerHeader.tsx@@ -1,7 +1,4 @@import * as Tooltip from '@radix-ui/react-tooltip'-import { LOGS_EXPLORER_DOCS_URL } from 'components/interfaces/Settings/Logs'-import Table from 'components/to-be-cleaned/Table'-import { copyToClipboard } from 'lib/helpers'import Link from 'next/link'import { useState } from 'react'import { logConstants } from 'shared-data'@@ -17,6 +14,10 @@ import {Tabs,} from 'ui'+import { LOGS_EXPLORER_DOCS_URL } from 'components/interfaces/Settings/Logs'+import Table from 'components/to-be-cleaned/Table'+import { copyToClipboard } from 'lib/helpers'+export interface LogsExplorerHeaderProps {subtitle?: string}diff --git a/apps/studio/data/read-replicas/replica-remove-mutation.ts b/apps/studio/data/read-replicas/replica-remove-mutation.tsindex 4c8d016d98d..be4f655bfa7 100644--- a/apps/studio/data/read-replicas/replica-remove-mutation.ts+++ b/apps/studio/data/read-replicas/replica-remove-mutation.ts@@ -20,7 +20,6 @@ export async function removeReadReplica({ projectRef, identifier }: ReadReplicaRdatabase_identifier: identifier,},})-if (error) throw errorreturn data}@@ -49,6 +48,7 @@ export const useReadReplicaRemoveMutation = ({setTimeout(async () => {await queryClient.invalidateQueries(replicaKeys.list(projectRef))+ await queryClient.invalidateQueries(replicaKeys.loadBalancers(projectRef))}, 5000)await onSuccess?.(data, variables, context)diff --git a/apps/studio/data/read-replicas/replica-setup-mutation.ts b/apps/studio/data/read-replicas/replica-setup-mutation.tsindex 157ffd06023..44f44e32e4e 100644--- a/apps/studio/data/read-replicas/replica-setup-mutation.ts+++ b/apps/studio/data/read-replicas/replica-setup-mutation.ts@@ -77,9 +77,10 @@ export const useReadReplicaSetUpMutation = ({return [...old, scaffoldNewDatabase]})+ // [Joshen] Wait 30 seconds before checking if the replica actually is coming upsetTimeout(async () => {await queryClient.invalidateQueries(replicaKeys.list(projectRef))- }, 5000)+ }, 30000)await onSuccess?.(data, variables, context)},diff --git a/apps/studio/pages/project/[ref]/logs/edge-logs.tsx b/apps/studio/pages/project/[ref]/logs/edge-logs.tsxindex 9c8b817e535..f414db60935 100644--- a/apps/studio/pages/project/[ref]/logs/edge-logs.tsx+++ b/apps/studio/pages/project/[ref]/logs/edge-logs.tsx@@ -4,6 +4,7 @@ import { observer } from 'mobx-react-lite'import { LogsLayout } from 'components/layouts'import LogsPreviewer from 'components/interfaces/Settings/Logs/LogsPreviewer'import { NextPageWithLayout } from 'types'+import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'export const LogPage: NextPageWithLayout = () => {const router = useRouter()diff --git a/apps/studio/pages/projects.tsx b/apps/studio/pages/projects.tsxindex 3c45b41afb7..cf8bda6dba0 100644--- a/apps/studio/pages/projects.tsx+++ b/apps/studio/pages/projects.tsx@@ -53,7 +53,7 @@ const ProjectsPage: NextPageWithLayout = () => {)}{!navLayoutV2 && (<div className="p-5">- {IS_PLATFORM && projectCreationEnabled && isSuccess && organizations.length !== 0 && (+ {IS_PLATFORM && projectCreationEnabled && isSuccess && (<HomePageActions search={search} setSearch={setSearch} organizations={organizations} />)}<div className="my-6 space-y-8">diff --git a/apps/studio/state/database-settings.tsx b/apps/studio/state/database-settings.tsxindex 93ce2c7723d..afd626df6bc 100644--- a/apps/studio/state/database-settings.tsx+++ b/apps/studio/state/database-settings.tsx@@ -5,6 +5,10 @@ import { useConstant } from 'common'export function createDatabaseSettingsState() {const state = proxy({+ usePoolerConnection: true,+ setUsePoolerConnection: (value: boolean) => {+ state.usePoolerConnection = value+ },showPoolingModeHelper: false,setShowPoolingModeHelper: (value: boolean) => {state.showPoolingModeHelper = valuediff --git a/packages/shared-data/logConstants.ts b/packages/shared-data/logConstants.tsindex d828202f53a..379c706b4d0 100644--- a/packages/shared-data/logConstants.ts+++ b/packages/shared-data/logConstants.ts@@ -225,8 +225,8 @@ const schemas = [],},{- name: 'PgBouncer',- reference: 'pgbouncer_logs',+ name: 'Supavisor',+ reference: 'supavisor_logs',fields: [{ path: 'event_message', type: 'string' },{ path: 'id', type: 'string' },