Files
supabase/apps/studio/components/interfaces/Integrations/Queues/Queues.utils.tsx
T
Saxon FletcherandJoshen Lim 6490f6ecdc Refine the integrations page (#38113)
* integrations refine

* refactoring

* integration page updates

* div

* clean up

* prettier

* Couple of minor refactors and fixes

* Fix missing base path for integration card image

* Fix editing a cron job in the previous job run tab, not updating the cron job details in the page header

* Cron job bread crumb to use job name instead of id if available, and add loading state for cron job subtitle

* Fixy fix

* Small fi

* ANother one

* Do not reroute after purging queue

* nit

* Final final final v3

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-27 21:18:30 +07:00

110 lines
2.8 KiB
TypeScript

import { Column } from 'react-data-grid'
import { PostgresQueue } from 'data/database-queues/database-queues-query'
import { cn } from 'ui'
import {
QueueCreatedAtCell,
QueueNameCell,
QueueRLSCell,
QueueSizeCell,
QueueTypeCell,
QueueWithMetrics,
} from './QueueCells'
export const formatQueueColumns = (): Column<QueueWithMetrics>[] => {
return [
{
key: 'queue_name',
name: 'Name',
resizable: true,
minWidth: 200,
headerCellClass: undefined,
renderHeaderCell: () => {
return (
<div className={cn('flex items-center justify-between font-normal text-xs w-full ml-8')}>
<p className="!text-foreground">Name</p>
</div>
)
},
renderCell: (props) => {
return <QueueNameCell queue={props.row} />
},
},
{
key: 'type',
name: 'Type',
resizable: true,
minWidth: 120,
headerCellClass: undefined,
renderHeaderCell: () => {
return (
<div className={cn('flex items-center justify-between font-normal text-xs w-full')}>
<p className="!text-foreground">Type</p>
</div>
)
},
renderCell: (props) => {
return <QueueTypeCell queue={props.row} />
},
},
{
key: 'rls_enabled',
name: 'RLS enabled',
resizable: true,
minWidth: 120,
headerCellClass: undefined,
renderHeaderCell: () => {
return (
<div className={cn('flex items-center justify-between font-normal text-xs w-full')}>
<p className="!text-foreground">RLS enabled</p>
</div>
)
},
renderCell: (props) => {
return <QueueRLSCell queue={props.row} />
},
},
{
key: 'created_at',
name: 'Created at',
resizable: true,
minWidth: 180,
headerCellClass: undefined,
renderHeaderCell: () => {
return (
<div className={cn('flex items-center justify-between font-normal text-xs w-full')}>
<p className="!text-foreground">Created at</p>
</div>
)
},
renderCell: (props) => {
return <QueueCreatedAtCell queue={props.row} />
},
},
{
key: 'queue_size',
name: 'Size',
resizable: true,
minWidth: 120,
headerCellClass: undefined,
renderHeaderCell: () => {
return (
<div className={cn('flex items-center justify-between font-normal text-xs w-full')}>
<p className="!text-foreground">Size</p>
</div>
)
},
renderCell: (props) => {
return <QueueSizeCell queue={props.row} />
},
},
]
}
export const prepareQueuesForDataGrid = (queues: PostgresQueue[]): QueueWithMetrics[] => {
return queues.map((queue) => ({
...queue,
id: queue.queue_name, // Use queue_name as unique id
}))
}