'use client'; import { Globe2, Pencil, ShieldCheck, Trash2 } from 'lucide-react'; import { useTranslations } from 'next-intl'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/table'; import type { WAFRule } from '@/lib/services/openflare'; import { formatDateTime } from '@/lib/utils'; interface RuleGroupsTableProps { groups: WAFRule[]; onEdit: (group: WAFRule) => void; onDelete: (group: WAFRule) => void; } export function RuleGroupsTable({ groups, onEdit, onDelete, }: RuleGroupsTableProps) { const t = useTranslations('waf'); return ( {t('columns.name')} {t('columns.type')} {t('columns.status')} {t('columns.nodeCount')} {t('columns.scope')} {t('columns.updatedAt')} {t('columns.actions')} {groups.map((group) => (
{group.is_global ? ( ) : ( )} {group.name}
{group.is_global ? t('global') : t('custom')} {group.enabled ? t('enable') : t('disable')} {group.graph.nodes.length} {group.is_global ? t('allSites') : t('siteCount', { count: group.applied_site_count })} {group.updated_at ? formatDateTime(group.updated_at) : '—'}
{!group.is_global ? ( ) : null}
))}
); }