[]>(
() => [
{
id: "name",
accessorKey: "name",
header: ({ column }) => (
),
cell: ({ row }) => {
const cert = row.original
const cfg = STATUS_CONFIG[cert.status]
const expanded = row.getIsExpanded()
return (
{expanded ? (
) : (
)}
{cfg.icon}
{cert.name}
{cert.commonName}
)
},
meta: {
headerTitle: "Сертификат",
headerClassName: DATA_GRID_CELL_PAD_FIRST,
cellClassName: DATA_GRID_CELL_PAD_FIRST,
expandedContent: (row: CertificateView) => ,
},
},
{
id: "server",
accessorKey: "serverId",
header: ({ column }) => ,
cell: ({ row }) => {
const cert = row.original
const server = serverMap.get(cert.serverId)
return server ? (
{server.name}
) : (
{cert.serverName ?? cert.serverId}
)
},
meta: {
headerTitle: "Сервер",
headerClassName: DATA_GRID_CELL_PAD,
cellClassName: DATA_GRID_CELL_PAD,
},
},
{
id: "issuedBy",
accessorKey: "issuedBy",
header: ({ column }) => ,
cell: ({ row }) => (
{row.original.issuedBy}
),
meta: {
headerTitle: "Издатель",
headerClassName: DATA_GRID_CELL_PAD,
cellClassName: DATA_GRID_CELL_PAD,
},
},
{
id: "daysLeft",
accessorKey: "daysLeft",
header: ({ column }) => ,
cell: ({ row }) => (
),
meta: {
headerTitle: "Срок",
headerClassName: DATA_GRID_CELL_PAD,
cellClassName: DATA_GRID_CELL_PAD,
},
},
{
id: "usage",
accessorKey: "usage",
header: () => Использование,
enableSorting: false,
cell: ({ row }) => (
{row.original.usage.map((u) => (
{u}
))}
),
meta: {
headerTitle: "Использование",
headerClassName: DATA_GRID_CELL_PAD,
cellClassName: DATA_GRID_CELL_PAD,
},
},
{
id: "status",
accessorKey: "status",
header: ({ column }) => ,
cell: ({ row }) => {
const cfg = STATUS_CONFIG[row.original.status]
return (
{cfg.label}
)
},
meta: {
headerTitle: "Статус",
headerClassName: DATA_GRID_CELL_PAD_LAST,
cellClassName: DATA_GRID_CELL_PAD_LAST,
},
},
],
[serverMap],
)
const table = useTable({
features: dataGridFeatures,
manualPagination: true,
data: certificates,
columns,
getRowId: (row) => row.id,
getRowCanExpand: () => true,
})
if (!isLoading && certificates.length === 0) {
return (
}
title={emptyTitle}
description={emptyDescription}
className="border-0 py-12"
/>
)
}
return (
table.getRow(row.id).toggleExpanded()}
/>
)
}
export { CertificatesDataGrid, STATUS_CONFIG, type CertificatesDataGridProps }