fix: auto refresh table

This commit is contained in:
bennykok
2024-02-01 15:24:43 +08:00
parent d8951df35f
commit bef6ce35de
5 changed files with 104 additions and 76 deletions
+10
View File
@@ -1,5 +1,6 @@
"use server";
import { RunDisplay } from "@/components/RunDisplay";
import { db } from "@/db/db";
import { deploymentsTable, workflowRunsTable } from "@/db/schema";
import { count, desc, eq, sql } from "drizzle-orm";
@@ -56,6 +57,15 @@ export async function findAllRuns({
});
}
export async function getAllRunstableContent(props: RunsSearchTypes) {
const data = await findAllRunsWithCounts(props);
return {
table: data?.allRuns.map((run) => <RunDisplay run={run} key={run.id} />),
total: data?.total,
};
}
export async function findAllRunsWithCounts(props: RunsSearchTypes) {
const a = await db
.select({