The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Logs layout fixes (#29249)
Jordi Enric3d9b509fb15a
diff --git a/apps/studio/components/interfaces/Settings/Logs/LogEventChart.tsx b/apps/studio/components/interfaces/Settings/Logs/LogEventChart.tsxindex d403fda3a5b..b11c069706c 100644--- a/apps/studio/components/interfaces/Settings/Logs/LogEventChart.tsx+++ b/apps/studio/components/interfaces/Settings/Logs/LogEventChart.tsx@@ -5,10 +5,12 @@ import type { EventChartData } from './Logs.types'export interface LogEventChartProps {data: EventChartData[]onBarClick: (isoTimestamp: string) => void+ className?: string}-const LogEventChart = ({ data, onBarClick }: LogEventChartProps) => (+const LogEventChart = ({ data, onBarClick, className }: LogEventChartProps) => (<BarChart+ className={className}minimalHeadersize="tiny"yAxisKey="count"diff --git a/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx b/apps/studio/components/interfaces/Settings/Logs/LogTable.tsxindex bb2b0e33270..e1b0926318e 100644--- a/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx+++ b/apps/studio/components/interfaces/Settings/Logs/LogTable.tsx@@ -364,76 +364,75 @@ const LogTable = ({if (!data) return nullreturn (- <section className={'flex w-full flex-col h-full'} style={{ maxHeight }}>+ <section className={'flex w-full flex-col h-screen'} style={{ maxHeight }}>{!queryType && <LogsExplorerTableHeader />}- <div className={`flex h-full flex-row overflow-x-auto`}>- <ResizablePanelGroup direction="horizontal">- <ResizablePanel defaultSize={focusedLog ? 60 : 100}>- <DataGrid- role="table"- style={{ height: '100%' }}- className={cn('flex-1 flex-grow h-full', {- 'data-grid--simple-logs': queryType,- 'data-grid--logs-explorer': !queryType,- })}- rowHeight={40}- headerRowHeight={queryType ? 0 : 28}- onSelectedCellChange={(row) => {- setFocusedLog(row.row as LogData)- setCellPosition(row)- }}- selectedRows={new Set([])}- columns={columns}- rowClass={(row: LogData) =>- [- 'font-mono tracking-tight',- isEqual(row, focusedLog)- ? '!bg-surface-300 rdg-row--focused'- : ' !bg-studio hover:!bg-surface-100 cursor-pointer',- ].join(' ')- }- rows={logDataRows}- rowKeyGetter={(r) => {- if (!hasId) return JSON.stringify(r)- const row = r as LogData- return row.id- }}- renderers={{- renderRow: RowRenderer,- noRowsFallback: !isLoading ? (- <div className="mx-auto flex h-full items-center justify-center space-y-12 py-4 transition-all delay-200 duration-500">- {!error && renderNoResultAlert()}- {error && renderErrorAlert()}- </div>- ) : null,- }}++ <ResizablePanelGroup direction="horizontal">+ <ResizablePanel defaultSize={focusedLog ? 60 : 100}>+ <DataGrid+ role="table"+ style={{ height: '100%' }}+ className={cn('flex-1 flex-grow h-full', {+ 'data-grid--simple-logs': queryType,+ 'data-grid--logs-explorer': !queryType,+ })}+ rowHeight={40}+ headerRowHeight={queryType ? 0 : 28}+ onSelectedCellChange={(row) => {+ setFocusedLog(row.row as LogData)+ setCellPosition(row)+ }}+ selectedRows={new Set([])}+ columns={columns}+ rowClass={(row: LogData) =>+ [+ 'font-mono tracking-tight',+ isEqual(row, focusedLog)+ ? '!bg-surface-300 rdg-row--focused'+ : ' !bg-studio hover:!bg-surface-100 cursor-pointer',+ ].join(' ')+ }+ rows={logDataRows}+ rowKeyGetter={(r) => {+ if (!hasId) return JSON.stringify(r)+ const row = r as LogData+ return row.id+ }}+ renderers={{+ renderRow: RowRenderer,+ noRowsFallback: !isLoading ? (+ <div className="mx-auto flex h-full items-center justify-center space-y-12 py-4 transition-all delay-200 duration-500">+ {!error && renderNoResultAlert()}+ {error && renderErrorAlert()}+ </div>+ ) : null,+ }}+ />+ {typeof window !== 'undefined' &&+ createPortal(+ <Menu id={LOGS_EXPLORER_CONTEXT_MENU_ID} animation={false}>+ <Item onClick={onCopyCell}>+ <Clipboard size={14} />+ <span className="ml-2 text-xs">Copy cell content</span>+ </Item>+ </Menu>,+ document.body+ )}+ </ResizablePanel>+ <ResizableHandle />+ {focusedLog && (+ <ResizablePanel defaultSize={40}>+ <LogSelection+ projectRef={projectRef}+ onClose={() => setFocusedLog(null)}+ log={focusedLog}+ queryType={queryType}+ params={params}+ collectionName={collectionName}/>- {typeof window !== 'undefined' &&- createPortal(- <Menu id={LOGS_EXPLORER_CONTEXT_MENU_ID} animation={false}>- <Item onClick={onCopyCell}>- <Clipboard size={14} />- <span className="ml-2 text-xs">Copy cell content</span>- </Item>- </Menu>,- document.body- )}</ResizablePanel>- <ResizableHandle />- {focusedLog && (- <ResizablePanel defaultSize={40}>- <LogSelection- projectRef={projectRef}- onClose={() => setFocusedLog(null)}- log={focusedLog}- queryType={queryType}- params={params}- collectionName={collectionName}- />- </ResizablePanel>- )}- </ResizablePanelGroup>- </div>+ )}+ </ResizablePanelGroup></section>)}diff --git a/apps/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx b/apps/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsxindex 22d16b44199..acee66e0bd2 100644--- a/apps/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx+++ b/apps/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx@@ -12,7 +12,7 @@ import useLogsPreview from 'hooks/analytics/useLogsPreview'import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'import { useUpgradePrompt } from 'hooks/misc/useUpgradePrompt'import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'-import { Button } from 'ui'+import { Button, cn } from 'ui'import LogEventChart from './LogEventChart'import LogTable from './LogTable'import { LOGS_TABLES, LOG_ROUTES_WITH_REPLICA_SUPPORT, LogsTableName } from './Logs.constants'@@ -78,14 +78,14 @@ export const LogsPreviewer = ({useEffect(() => {setFilters((prev) => ({...prev,- search_query: s as string,- database: db as string,+ search_query: s,+ database: db,}))if (ite || its) {setParams((prev) => ({...prev,- iso_timestamp_start: (its || '') as string,- iso_timestamp_end: (ite || '') as string,+ iso_timestamp_start: its || '',+ iso_timestamp_end: ite || '',}))}}, [db, s, ite, its])@@ -180,8 +180,14 @@ export const LogsPreviewer = ({}}+ const footerHeight = '48px'+ const navBarHeight = '48px'+ const filterPanelHeight = '54px'+ const chartHeight = showChart ? '114px' : '0px'+ const maxHeight = `calc(100vh - ${navBarHeight} - ${filterPanelHeight} - ${footerHeight} - ${chartHeight})`+return (- <div className="flex flex-col flex-grow h-full">+ <div><PreviewFilterPanelcsvData={logData}isLoading={isLoading}@@ -219,14 +225,15 @@ export const LogsPreviewer = ({<divclassName={'transition-all duration-500 ' +- (showChart && !isLoading && logData.length > 0- ? 'mb-4 h-24 pt-4 opacity-100'- : 'h-0 opacity-0')+ (showChart && logData.length > 0 ? 'mb-4 h-24 pt-4 opacity-100' : 'h-0 opacity-0')}><div className={condensedLayout ? 'px-4' : ''}>- {!isLoading && showChart && (+ {showChart && (<LogEventChart+ className={cn({+ 'opacity-40': isLoading,+ })}data={eventChartData}onBarClick={(isoTimestamp) => {handleSearch('event-chart-bar-click', {@@ -243,6 +250,7 @@ export const LogsPreviewer = ({<ShimmerLine active={isLoading} /><LoadingOpacity active={isLoading}><LogTable+ maxHeight={maxHeight}projectRef={projectRef}isLoading={isLoading}data={logData}@@ -253,23 +261,26 @@ export const LogsPreviewer = ({error={error}/></LoadingOpacity>- {!error && (- <div className="border-t flex flex-row justify-between p-2">- <Button- onClick={loadOlder}- icon={<Rewind />}- type="default"- loading={isLoadingOlder}- disabled={isLoadingOlder}- >- Load older- </Button>- <div className="flex flex-row justify-end mt-2">- <UpgradePrompt show={showUpgradePrompt} setShowUpgradePrompt={setShowUpgradePrompt} />- </div>- </div>- )}</div>+ {!error && logData.length > 0 && (+ <div className="border-t flex flex-row justify-between p-2">+ <Button+ className={cn({+ 'opacity-0': isLoadingOlder || isLoading,+ })}+ onClick={loadOlder}+ icon={<Rewind />}+ type="default"+ loading={isLoadingOlder}+ disabled={isLoadingOlder}+ >+ Load older+ </Button>+ <div className="flex flex-row justify-end mt-2">+ <UpgradePrompt show={showUpgradePrompt} setShowUpgradePrompt={setShowUpgradePrompt} />+ </div>+ </div>+ )}</div>)}diff --git a/apps/studio/components/layouts/LogsLayout/LogsLayout.tsx b/apps/studio/components/layouts/LogsLayout/LogsLayout.tsxindex 6252fbf70d2..2f8388587fc 100644--- a/apps/studio/components/layouts/LogsLayout/LogsLayout.tsx+++ b/apps/studio/components/layouts/LogsLayout/LogsLayout.tsx@@ -132,9 +132,7 @@ const LogsLayout = ({ title, children }: PropsWithChildren<LogsLayoutProps>) =></>}>- <main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto">- {children}- </main>+ <main>{children}</main></ProjectLayout>)}