feat(ui): new CertificateList UI using antd
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user