import React from 'react'; import { PLUGIN_CATEGORIES, PLUGINS } from './data/plugins'; import { getCategoryAnchor } from './utils/categoryUtils'; import type { Plugin, PluginCategory } from './data/plugins'; type GroupedPlugins = Record; interface PluginTableProps { vulnerabilityType?: string; shouldRenderCategory?: boolean; shouldRenderDescription?: boolean; shouldRenderPluginId?: boolean; shouldGroupByCategory?: boolean; showApplicationTypes?: boolean; showRemoteStatus?: boolean; } const styles = { table: { width: '100%', borderCollapse: 'collapse' as const, tableLayout: 'fixed' as const, }, th: { padding: '12px 8px', textAlign: 'left' as const, whiteSpace: 'nowrap' as const, borderBottom: '2px solid var(--ifm-table-border-color)', overflow: 'hidden', textOverflow: 'ellipsis', }, td: { padding: '8px', borderBottom: '1px solid var(--ifm-table-border-color)', verticalAlign: 'top' as const, overflow: 'hidden', textOverflow: 'ellipsis', }, // Column-specific widths columns: { category: { width: '15%', fontWeight: 'bold' }, name: { width: '20%', fontWeight: 'bold' }, description: { width: '40%', whiteSpace: 'normal' as const }, pluginId: { width: '15%' }, indicator: { width: '5%', textAlign: 'center' as const }, }, code: { whiteSpace: 'nowrap' as const, fontSize: '0.9em', }, link: { display: 'block', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' as const, }, }; const PluginTable = ({ vulnerabilityType, shouldRenderCategory = true, shouldRenderDescription = true, shouldRenderPluginId = true, shouldGroupByCategory = false, showApplicationTypes = false, showRemoteStatus = false, }: PluginTableProps) => { let filteredPlugins = PLUGINS; // Apply filters if specified if (vulnerabilityType) { filteredPlugins = filteredPlugins.filter( (plugin) => plugin.vulnerabilityType === vulnerabilityType, ); } // Group plugins by category if needed const groupedPlugins: GroupedPlugins = {} as GroupedPlugins; if (shouldGroupByCategory) { for (const category of PLUGIN_CATEGORIES) { groupedPlugins[category] = filteredPlugins .filter((plugin) => plugin.category === category) .sort((a, b) => a.name.localeCompare(b.name)); } } return ( {shouldRenderCategory && shouldGroupByCategory && ( )} {shouldRenderDescription && ( )} {shouldRenderPluginId && ( )} {showApplicationTypes && ( <> )} {shouldGroupByCategory ? Object.entries(groupedPlugins).map(([category, categoryPlugins]) => ( {categoryPlugins.map((plugin, index) => ( {index === 0 && shouldRenderCategory && ( )} {shouldRenderDescription && ( )} {shouldRenderPluginId && ( )} {showApplicationTypes && ( <> )} ))} )) : filteredPlugins.map((plugin) => ( {shouldRenderDescription && ( )} {shouldRenderPluginId && ( )} {showApplicationTypes && ( <> )} ))}
CategoryPlugin NameDescriptionPlugin IDRAG Agent Chatbot
{plugin.category} {plugin.name} {plugin.description} {showRemoteStatus && plugin.isRemote && ( 🌐 )} {plugin.pluginId} {plugin.applicationTypes?.rag ? '🚨' : '✅'} {plugin.applicationTypes?.agent ? '🚨' : '✅'} {plugin.applicationTypes?.chat ? '🚨' : '✅'}
{plugin.name} {plugin.description} {showRemoteStatus && plugin.isRemote && ( 🌐 )} {plugin.pluginId} {plugin.applicationTypes?.rag ? '🚨' : '✅'} {plugin.applicationTypes?.agent ? '🚨' : '✅'} {plugin.applicationTypes?.chat ? '🚨' : '✅'}
); }; export default PluginTable;