|
1 | | -"use server"; |
2 | | - |
3 | | -import { NavigationMenu } from "../navigationMenu"; |
4 | | -import { DataTable } from "@/components/ui/data-table"; |
5 | | -import { columns, RepositoryColumnInfo } from "./columns"; |
6 | | -import { listRepositories } from "@/lib/server/searchService"; |
7 | | -import { isServiceError } from "@/lib/utils"; |
8 | 1 | import { Suspense } from "react"; |
| 2 | +import { NavigationMenu } from "../navigationMenu"; |
| 3 | +import { RepositoryTable } from "./repositoryTable"; |
9 | 4 |
|
10 | | -export default async function ReposPage() { |
11 | | - const _repos = await listRepositories(); |
12 | | - |
13 | | - if (isServiceError(_repos)) { |
14 | | - return <div>Error fetching repositories</div>; |
15 | | - } |
16 | | - const repos = _repos.List.Repos.map((repo): RepositoryColumnInfo => { |
17 | | - return { |
18 | | - name: repo.Repository.Name, |
19 | | - branches: repo.Repository.Branches.map((branch) => { |
20 | | - return { |
21 | | - name: branch.Name, |
22 | | - version: branch.Version, |
23 | | - } |
24 | | - }), |
25 | | - repoSizeBytes: repo.Stats.ContentBytes, |
26 | | - indexSizeBytes: repo.Stats.IndexBytes, |
27 | | - shardCount: repo.Stats.Shards, |
28 | | - lastIndexed: repo.IndexMetadata.IndexTime, |
29 | | - latestCommit: repo.Repository.LatestCommitDate, |
30 | | - indexedFiles: repo.Stats.Documents, |
31 | | - commitUrlTemplate: repo.Repository.CommitURLTemplate, |
32 | | - } |
33 | | - }).sort((a, b) => { |
34 | | - return new Date(b.lastIndexed).getTime() - new Date(a.lastIndexed).getTime(); |
35 | | - }) |
| 5 | +export const dynamic = 'force-dynamic' |
36 | 6 |
|
| 7 | +export default async function ReposPage() { |
37 | 8 | return ( |
38 | 9 | <div className="h-screen flex flex-col items-center"> |
39 | 10 | <NavigationMenu /> |
40 | 11 | <Suspense fallback={<div>Loading...</div>}> |
41 | | - <DataTable |
42 | | - columns={columns} |
43 | | - data={repos} |
44 | | - searchKey="name" |
45 | | - searchPlaceholder="Search repositories..." |
46 | | - /> |
| 12 | + <RepositoryTable /> |
47 | 13 | </Suspense> |
48 | 14 | </div> |
49 | 15 | ) |
|
0 commit comments