mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
use force-dynamic
This commit is contained in:
parent
957f499584
commit
fa48ae79a0
2 changed files with 48 additions and 39 deletions
|
|
@ -1,49 +1,15 @@
|
|||
"use server";
|
||||
|
||||
import { NavigationMenu } from "../navigationMenu";
|
||||
import { DataTable } from "@/components/ui/data-table";
|
||||
import { columns, RepositoryColumnInfo } from "./columns";
|
||||
import { listRepositories } from "@/lib/server/searchService";
|
||||
import { isServiceError } from "@/lib/utils";
|
||||
import { Suspense } from "react";
|
||||
import { NavigationMenu } from "../navigationMenu";
|
||||
import { RepositoryTable } from "./repositoryTable";
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
|
||||
export default async function ReposPage() {
|
||||
const _repos = await listRepositories();
|
||||
|
||||
if (isServiceError(_repos)) {
|
||||
return <div>Error fetching repositories</div>;
|
||||
}
|
||||
const repos = _repos.List.Repos.map((repo): RepositoryColumnInfo => {
|
||||
return {
|
||||
name: repo.Repository.Name,
|
||||
branches: repo.Repository.Branches.map((branch) => {
|
||||
return {
|
||||
name: branch.Name,
|
||||
version: branch.Version,
|
||||
}
|
||||
}),
|
||||
repoSizeBytes: repo.Stats.ContentBytes,
|
||||
indexSizeBytes: repo.Stats.IndexBytes,
|
||||
shardCount: repo.Stats.Shards,
|
||||
lastIndexed: repo.IndexMetadata.IndexTime,
|
||||
latestCommit: repo.Repository.LatestCommitDate,
|
||||
indexedFiles: repo.Stats.Documents,
|
||||
commitUrlTemplate: repo.Repository.CommitURLTemplate,
|
||||
}
|
||||
}).sort((a, b) => {
|
||||
return new Date(b.lastIndexed).getTime() - new Date(a.lastIndexed).getTime();
|
||||
})
|
||||
|
||||
return (
|
||||
<div className="h-screen flex flex-col items-center">
|
||||
<NavigationMenu />
|
||||
<Suspense fallback={<div>Loading...</div>}>
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={repos}
|
||||
searchKey="name"
|
||||
searchPlaceholder="Search repositories..."
|
||||
/>
|
||||
<RepositoryTable />
|
||||
</Suspense>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
43
src/app/repos/repositoryTable.tsx
Normal file
43
src/app/repos/repositoryTable.tsx
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
'use server';
|
||||
|
||||
import { DataTable } from "@/components/ui/data-table";
|
||||
import { columns, RepositoryColumnInfo } from "./columns";
|
||||
import { listRepositories } from "@/lib/server/searchService";
|
||||
import { isServiceError } from "@/lib/utils";
|
||||
|
||||
export const RepositoryTable = async () => {
|
||||
const _repos = await listRepositories();
|
||||
|
||||
if (isServiceError(_repos)) {
|
||||
return <div>Error fetching repositories</div>;
|
||||
}
|
||||
const repos = _repos.List.Repos.map((repo): RepositoryColumnInfo => {
|
||||
return {
|
||||
name: repo.Repository.Name,
|
||||
branches: repo.Repository.Branches.map((branch) => {
|
||||
return {
|
||||
name: branch.Name,
|
||||
version: branch.Version,
|
||||
}
|
||||
}),
|
||||
repoSizeBytes: repo.Stats.ContentBytes,
|
||||
indexSizeBytes: repo.Stats.IndexBytes,
|
||||
shardCount: repo.Stats.Shards,
|
||||
lastIndexed: repo.IndexMetadata.IndexTime,
|
||||
latestCommit: repo.Repository.LatestCommitDate,
|
||||
indexedFiles: repo.Stats.Documents,
|
||||
commitUrlTemplate: repo.Repository.CommitURLTemplate,
|
||||
}
|
||||
}).sort((a, b) => {
|
||||
return new Date(b.lastIndexed).getTime() - new Date(a.lastIndexed).getTime();
|
||||
});
|
||||
|
||||
return (
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={repos}
|
||||
searchKey="name"
|
||||
searchPlaceholder="Search repositories..."
|
||||
/>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue