feat(ui): new CertificateList UI using antd

This commit is contained in:
Fu Diwei
2024-12-05 21:52:27 +08:00
parent c522196029
commit 65d9c6fe2f
13 changed files with 216 additions and 56 deletions

View File

@@ -1,26 +1,20 @@
import { Certificate } from "@/domain/certificate";
import { getPocketBase } from "./pocketbase";
import { RecordListOptions } from "pocketbase";
import { getTimeAfter } from "@/lib/time";
import { type RecordListOptions } from "pocketbase";
type CertificateListReq = {
import { Certificate } from "@/domain/certificate";
import { getTimeAfter } from "@/lib/time";
import { getPocketBase } from "./pocketbase";
export type CertificateListReq = {
page?: number;
perPage?: number;
state?: string;
state?: "expireSoon" | "expired";
};
export const list = async (req: CertificateListReq) => {
const pb = getPocketBase();
let page = 1;
if (req.page) {
page = req.page;
}
let perPage = 2;
if (req.perPage) {
perPage = req.perPage;
}
const page = req.page || 1;
const perPage = req.perPage || 10;
const options: RecordListOptions = {
sort: "-created",
@@ -37,7 +31,5 @@ export const list = async (req: CertificateListReq) => {
});
}
const response = pb.collection("certificate").getList<Certificate>(page, perPage, options);
return response;
return pb.collection("certificate").getList<Certificate>(page, perPage, options);
};

View File

@@ -10,15 +10,17 @@ export type WorkflowListReq = {
};
export const list = async (req: WorkflowListReq) => {
const pb = getPocketBase();
const page = req.page || 1;
const perPage = req.perPage || 10;
const options: RecordListOptions = { sort: "-created" };
if (req.enabled != null) {
options.filter = getPocketBase().filter("enabled={:enabled}", { enabled: req.enabled });
options.filter = pb.filter("enabled={:enabled}", { enabled: req.enabled });
}
return await getPocketBase().collection("workflow").getList<Workflow>(page, perPage, options);
return await pb.collection("workflow").getList<Workflow>(page, perPage, options);
};
export const get = async (id: string) => {