mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-17 01:01:03 +02:00
Merge commit 'a8390532f7' as 'ai-context/workbench-ui'
This commit is contained in:
commit
1a72bfdec0
310 changed files with 56430 additions and 0 deletions
47
ai-context/workbench-ui/src/model/ontologies-table.tsx
Normal file
47
ai-context/workbench-ui/src/model/ontologies-table.tsx
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { createColumnHelper } from "@tanstack/react-table";
|
||||
import { Ontology } from "@trustgraph/react-state";
|
||||
|
||||
export type OntologyTableRow = [string, Ontology];
|
||||
|
||||
const columnHelper = createColumnHelper<OntologyTableRow>();
|
||||
|
||||
export const ontologyColumns = [
|
||||
columnHelper.accessor((row) => row[0], {
|
||||
id: "id",
|
||||
header: "ID",
|
||||
cell: (info) => info.getValue(),
|
||||
}),
|
||||
columnHelper.accessor((row) => row[1].metadata.name, {
|
||||
id: "name",
|
||||
header: "Name",
|
||||
cell: (info) => info.getValue(),
|
||||
}),
|
||||
columnHelper.accessor((row) => row[1].metadata.description, {
|
||||
id: "description",
|
||||
header: "Description",
|
||||
cell: (info) => info.getValue() || "-",
|
||||
}),
|
||||
columnHelper.accessor((row) => Object.keys(row[1].classes || {}).length, {
|
||||
id: "classCount",
|
||||
header: "Classes",
|
||||
cell: (info) => info.getValue(),
|
||||
}),
|
||||
columnHelper.accessor(
|
||||
(row) =>
|
||||
Object.keys(row[1].objectProperties || {}).length +
|
||||
Object.keys(row[1].datatypeProperties || {}).length,
|
||||
{
|
||||
id: "propertyCount",
|
||||
header: "Properties",
|
||||
cell: (info) => info.getValue(),
|
||||
},
|
||||
),
|
||||
columnHelper.accessor((row) => row[1].metadata.modified, {
|
||||
id: "modified",
|
||||
header: "Last Modified",
|
||||
cell: (info) => {
|
||||
const date = new Date(info.getValue());
|
||||
return date.toLocaleDateString() + " " + date.toLocaleTimeString();
|
||||
},
|
||||
}),
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue