mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 15:49:09 +03:00
* Make the title prop on ProjectIntegrationLayout mandatory. Fix the title on some of the integration pages. Fix wrong layout on wrappers/new. * Add code for the initial page. * Make the FilterPopover more type-safe. * Add a page to list message in a single queue. * Add feature flag for queues. * Handle the case where pgmq is not available on the database. * Minor fixes. * Some minor fixes. * Fix the query when fetching only archived messages. * Fix the filters when there's no choices selected. * Add a comment for local dev. * Add a max size to the queue name input.
71 lines
2.3 KiB
TypeScript
71 lines
2.3 KiB
TypeScript
import dayjs from 'dayjs'
|
|
import { includes, sortBy } from 'lodash'
|
|
import { ChevronRight } from 'lucide-react'
|
|
|
|
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
|
|
import Table from 'components/to-be-cleaned/Table'
|
|
import { PostgresQueue } from 'data/database-queues/database-queues-query'
|
|
import { DATETIME_FORMAT } from 'lib/constants'
|
|
import { useRouter } from 'next/router'
|
|
|
|
interface QueuesRowsProps {
|
|
queues: PostgresQueue[]
|
|
filterString: string
|
|
}
|
|
|
|
export const QueuesRows = ({ queues: fetchedQueues, filterString }: QueuesRowsProps) => {
|
|
const router = useRouter()
|
|
const { project: selectedProject } = useProjectContext()
|
|
|
|
const filteredQueues = fetchedQueues.filter((x) =>
|
|
includes(x.queue_name.toLowerCase(), filterString.toLowerCase())
|
|
)
|
|
const queues = sortBy(filteredQueues, (func) => func.queue_name.toLocaleLowerCase())
|
|
|
|
if (queues.length === 0 && filterString.length > 0) {
|
|
return (
|
|
<Table.tr>
|
|
<Table.td colSpan={4}>
|
|
<p className="text-sm text-foreground">No results found</p>
|
|
<p className="text-sm text-foreground-light">
|
|
Your search for "{filterString}" did not return any results
|
|
</p>
|
|
</Table.td>
|
|
</Table.tr>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<>
|
|
{queues.map((q) => {
|
|
const type = q.is_partitioned ? 'Partitioned' : q.is_unlogged ? 'Unlogged' : 'Regular'
|
|
|
|
return (
|
|
<Table.tr
|
|
key={q.queue_name}
|
|
onClick={() => {
|
|
router.push(`/project/${selectedProject?.ref}/integrations/queues/${q.queue_name}`)
|
|
}}
|
|
className="hover:"
|
|
>
|
|
<Table.td className="truncate">
|
|
<p title={q.queue_name}>{q.queue_name}</p>
|
|
</Table.td>
|
|
<Table.td className="table-cell overflow-auto">
|
|
<p title={type.toLocaleLowerCase()} className="truncate">
|
|
{type}
|
|
</p>
|
|
</Table.td>
|
|
<Table.td className="table-cell">
|
|
<p title={q.created_at}>{dayjs(q.created_at).format(DATETIME_FORMAT)}</p>
|
|
</Table.td>
|
|
<Table.td className="flex items-center justify-end">
|
|
<ChevronRight />
|
|
</Table.td>
|
|
</Table.tr>
|
|
)
|
|
})}
|
|
</>
|
|
)
|
|
}
|