mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-01 09:29:38 +02:00
git-subtree-dir: ai-context/workbench-ui git-subtree-split: 32e36a5c2131e429a7081cfaf67dabad3193cda3
32 lines
936 B
TypeScript
32 lines
936 B
TypeScript
import { useMemo } from "react";
|
|
import { getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
|
|
|
import { columns, type AgentTool } from "../../model/agent-tools-table";
|
|
import ClickableTable from "../common/ClickableTable";
|
|
|
|
const ToolsTable = ({ setSelected, tools }) => {
|
|
// Transform the raw tools data to match our table structure
|
|
const tableData: AgentTool[] = useMemo(() => {
|
|
return tools.map(([id, config]) => ({
|
|
id,
|
|
name: config?.name || "",
|
|
description: config?.description || "",
|
|
type: config?.type || "",
|
|
}));
|
|
}, [tools]);
|
|
|
|
// Initialize React Table with tool data and column configuration
|
|
const table = useReactTable({
|
|
data: tableData,
|
|
columns: columns,
|
|
getCoreRowModel: getCoreRowModel(),
|
|
});
|
|
|
|
const onSelect = (row) => {
|
|
setSelected(row.original.id);
|
|
};
|
|
|
|
return <ClickableTable table={table} onClick={onSelect} />;
|
|
};
|
|
|
|
export default ToolsTable;
|