mirror of
https://github.com/woodchen-ink/certimate.git
synced 2025-07-18 17:31:55 +08:00
chore: remove unused code
This commit is contained in:
parent
cb162e063d
commit
929250810f
@ -1,5 +1,5 @@
|
|||||||
import { WorkflowRunLog } from "@/domain/workflow";
|
import { WorkflowRunLog } from "@/domain/workflow";
|
||||||
import { logs } from "@/repository/workflow";
|
import { list as logs } from "@/repository/workflowRunLog";
|
||||||
import { ColumnDef } from "@tanstack/react-table";
|
import { ColumnDef } from "@tanstack/react-table";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { DataTable } from "./DataTable";
|
import { DataTable } from "./DataTable";
|
||||||
|
@ -190,7 +190,7 @@ export type AccessProvider = {
|
|||||||
|
|
||||||
export const accessProvidersMap: Map<AccessProvider["type"], AccessProvider> = new Map(
|
export const accessProvidersMap: Map<AccessProvider["type"], AccessProvider> = new Map(
|
||||||
/*
|
/*
|
||||||
注意:与定义常量值时不同,此处的顺序决定显示在前端的顺序。
|
注意:此处的顺序决定显示在前端的顺序。
|
||||||
NOTICE: The following order determines the order displayed at the frontend.
|
NOTICE: The following order determines the order displayed at the frontend.
|
||||||
*/
|
*/
|
||||||
[
|
[
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
import { Domain } from "./domain";
|
|
||||||
|
|
||||||
export type Deployment = {
|
|
||||||
id: string;
|
|
||||||
domain: string;
|
|
||||||
log: {
|
|
||||||
apply?: Log[];
|
|
||||||
check?: Log[];
|
|
||||||
deploy?: Log[];
|
|
||||||
};
|
|
||||||
phase: Pahse;
|
|
||||||
phaseSuccess: boolean;
|
|
||||||
wholeSuccess: boolean;
|
|
||||||
deployedAt: string;
|
|
||||||
created: string;
|
|
||||||
updated: string;
|
|
||||||
expand: {
|
|
||||||
domain?: Domain;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Pahse = "apply" | "check" | "deploy";
|
|
||||||
|
|
||||||
export type Log = {
|
|
||||||
time: string;
|
|
||||||
message: string;
|
|
||||||
error: string;
|
|
||||||
info?: string[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DeploymentListReq = {
|
|
||||||
domain?: string;
|
|
||||||
page?: number;
|
|
||||||
perPage?: number;
|
|
||||||
};
|
|
@ -1,35 +1,17 @@
|
|||||||
import { Deployment, Pahse } from "./deployment";
|
import {
|
||||||
|
ACCESS_PROVIDER_TYPE_ALIYUN,
|
||||||
export type Domain = {
|
ACCESS_PROVIDER_TYPE_BAIDUCLOUD,
|
||||||
id?: string;
|
ACCESS_PROVIDER_TYPE_BYTEPLUS,
|
||||||
domain: string;
|
ACCESS_PROVIDER_TYPE_DOGECLOUD,
|
||||||
email?: string;
|
ACCESS_PROVIDER_TYPE_HUAWEICLOUD,
|
||||||
crontab: string;
|
ACCESS_PROVIDER_TYPE_KUBERNETES,
|
||||||
access: string;
|
ACCESS_PROVIDER_TYPE_LOCAL,
|
||||||
targetAccess?: string;
|
ACCESS_PROVIDER_TYPE_QINIU,
|
||||||
targetType?: string;
|
ACCESS_PROVIDER_TYPE_SSH,
|
||||||
expiredAt?: string;
|
ACCESS_PROVIDER_TYPE_TENCENTCLOUD,
|
||||||
phase?: Pahse;
|
ACCESS_PROVIDER_TYPE_VOLCENGINE,
|
||||||
phaseSuccess?: boolean;
|
ACCESS_PROVIDER_TYPE_WEBHOOK,
|
||||||
lastDeployedAt?: string;
|
} from "./access";
|
||||||
variables?: string;
|
|
||||||
nameservers?: string;
|
|
||||||
group?: string;
|
|
||||||
enabled?: boolean;
|
|
||||||
deployed?: boolean;
|
|
||||||
created?: string;
|
|
||||||
updated?: string;
|
|
||||||
deleted?: string;
|
|
||||||
rightnow?: boolean;
|
|
||||||
certificate?: string;
|
|
||||||
privateKey?: string;
|
|
||||||
expand?: {
|
|
||||||
lastDeployment?: Deployment;
|
|
||||||
};
|
|
||||||
|
|
||||||
applyConfig?: ApplyConfig;
|
|
||||||
deployConfig?: DeployConfig[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type KVType = {
|
export type KVType = {
|
||||||
key: string;
|
key: string;
|
||||||
@ -64,29 +46,33 @@ export type DeployTarget = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const deployTargetList: string[][] = [
|
export const deployTargetList: string[][] = [
|
||||||
["aliyun-oss", "common.provider.aliyun.oss", "/imgs/providers/aliyun.svg"],
|
/*
|
||||||
["aliyun-cdn", "common.provider.aliyun.cdn", "/imgs/providers/aliyun.svg"],
|
注意:此处的顺序决定显示在前端的顺序。
|
||||||
["aliyun-dcdn", "common.provider.aliyun.dcdn", "/imgs/providers/aliyun.svg"],
|
NOTICE: The following order determines the order displayed at the frontend.
|
||||||
["aliyun-clb", "common.provider.aliyun.clb", "/imgs/providers/aliyun.svg"],
|
*/
|
||||||
["aliyun-alb", "common.provider.aliyun.alb", "/imgs/providers/aliyun.svg"],
|
[`${ACCESS_PROVIDER_TYPE_LOCAL}`, "common.provider.local", "/imgs/providers/local.svg"],
|
||||||
["aliyun-nlb", "common.provider.aliyun.nlb", "/imgs/providers/aliyun.svg"],
|
[`${ACCESS_PROVIDER_TYPE_SSH}`, "common.provider.ssh", "/imgs/providers/ssh.svg"],
|
||||||
["tencentcloud-cdn", "common.provider.tencentcloud.cdn", "/imgs/providers/tencentcloud.svg"],
|
[`${ACCESS_PROVIDER_TYPE_ALIYUN}-oss`, "common.provider.aliyun.oss", "/imgs/providers/aliyun.svg"],
|
||||||
["tencentcloud-ecdn", "common.provider.tencentcloud.ecdn", "/imgs/providers/tencentcloud.svg"],
|
[`${ACCESS_PROVIDER_TYPE_ALIYUN}-cdn`, "common.provider.aliyun.cdn", "/imgs/providers/aliyun.svg"],
|
||||||
["tencentcloud-clb", "common.provider.tencentcloud.clb", "/imgs/providers/tencentcloud.svg"],
|
[`${ACCESS_PROVIDER_TYPE_ALIYUN}-dcdn`, "common.provider.aliyun.dcdn", "/imgs/providers/aliyun.svg"],
|
||||||
["tencentcloud-cos", "common.provider.tencentcloud.cos", "/imgs/providers/tencentcloud.svg"],
|
[`${ACCESS_PROVIDER_TYPE_ALIYUN}-clb`, "common.provider.aliyun.clb", "/imgs/providers/aliyun.svg"],
|
||||||
["tencentcloud-eo", "common.provider.tencentcloud.eo", "/imgs/providers/tencentcloud.svg"],
|
[`${ACCESS_PROVIDER_TYPE_ALIYUN}-alb`, "common.provider.aliyun.alb", "/imgs/providers/aliyun.svg"],
|
||||||
["huaweicloud-cdn", "common.provider.huaweicloud.cdn", "/imgs/providers/huaweicloud.svg"],
|
[`${ACCESS_PROVIDER_TYPE_ALIYUN}-nlb`, "common.provider.aliyun.nlb", "/imgs/providers/aliyun.svg"],
|
||||||
["huaweicloud-elb", "common.provider.huaweicloud.elb", "/imgs/providers/huaweicloud.svg"],
|
[`${ACCESS_PROVIDER_TYPE_TENCENTCLOUD}-cdn`, "common.provider.tencentcloud.cdn", "/imgs/providers/tencentcloud.svg"],
|
||||||
["baiducloud-cdn", "common.provider.baiducloud.cdn", "/imgs/providers/baiducloud.svg"],
|
[`${ACCESS_PROVIDER_TYPE_TENCENTCLOUD}-ecdn`, "common.provider.tencentcloud.ecdn", "/imgs/providers/tencentcloud.svg"],
|
||||||
["qiniu-cdn", "common.provider.qiniu.cdn", "/imgs/providers/qiniu.svg"],
|
[`${ACCESS_PROVIDER_TYPE_TENCENTCLOUD}-clb`, "common.provider.tencentcloud.clb", "/imgs/providers/tencentcloud.svg"],
|
||||||
["dogecloud-cdn", "common.provider.dogecloud.cdn", "/imgs/providers/dogecloud.svg"],
|
[`${ACCESS_PROVIDER_TYPE_TENCENTCLOUD}-cos`, "common.provider.tencentcloud.cos", "/imgs/providers/tencentcloud.svg"],
|
||||||
["local", "common.provider.local", "/imgs/providers/local.svg"],
|
[`${ACCESS_PROVIDER_TYPE_TENCENTCLOUD}-eo`, "common.provider.tencentcloud.eo", "/imgs/providers/tencentcloud.svg"],
|
||||||
["ssh", "common.provider.ssh", "/imgs/providers/ssh.svg"],
|
[`${ACCESS_PROVIDER_TYPE_HUAWEICLOUD}-cdn`, "common.provider.huaweicloud.cdn", "/imgs/providers/huaweicloud.svg"],
|
||||||
["webhook", "common.provider.webhook", "/imgs/providers/webhook.svg"],
|
[`${ACCESS_PROVIDER_TYPE_HUAWEICLOUD}-elb`, "common.provider.huaweicloud.elb", "/imgs/providers/huaweicloud.svg"],
|
||||||
["k8s-secret", "common.provider.kubernetes.secret", "/imgs/providers/kubernetes.svg"],
|
[`${ACCESS_PROVIDER_TYPE_BAIDUCLOUD}-cdn`, "common.provider.baiducloud.cdn", "/imgs/providers/baiducloud.svg"],
|
||||||
["volcengine-live", "common.provider.volcengine.live", "/imgs/providers/volcengine.svg"],
|
[`${ACCESS_PROVIDER_TYPE_VOLCENGINE}-cdn`, "common.provider.volcengine.cdn", "/imgs/providers/volcengine.svg"],
|
||||||
["volcengine-cdn", "common.provider.volcengine.cdn", "/imgs/providers/volcengine.svg"],
|
[`${ACCESS_PROVIDER_TYPE_VOLCENGINE}-live`, "common.provider.volcengine.live", "/imgs/providers/volcengine.svg"],
|
||||||
["byteplus-cdn", "common.provider.byteplus.cdn", "/imgs/providers/byteplus.svg"],
|
[`${ACCESS_PROVIDER_TYPE_QINIU}-cdn`, "common.provider.qiniu.cdn", "/imgs/providers/qiniu.svg"],
|
||||||
|
[`${ACCESS_PROVIDER_TYPE_DOGECLOUD}-cdn`, "common.provider.dogecloud.cdn", "/imgs/providers/dogecloud.svg"],
|
||||||
|
[`${ACCESS_PROVIDER_TYPE_BYTEPLUS}-cdn`, "common.provider.byteplus.cdn", "/imgs/providers/byteplus.svg"],
|
||||||
|
[`${ACCESS_PROVIDER_TYPE_KUBERNETES}-secret`, "common.provider.kubernetes.secret", "/imgs/providers/kubernetes.svg"],
|
||||||
|
[`${ACCESS_PROVIDER_TYPE_WEBHOOK}`, "common.provider.webhook", "/imgs/providers/webhook.svg"],
|
||||||
];
|
];
|
||||||
|
|
||||||
export const deployTargetsMap: Map<DeployTarget["type"], DeployTarget> = new Map(
|
export const deployTargetsMap: Map<DeployTarget["type"], DeployTarget> = new Map(
|
||||||
|
@ -10,7 +10,7 @@ import { ClientResponseError } from "pocketbase";
|
|||||||
|
|
||||||
import CertificateDetailDrawer from "@/components/certificate/CertificateDetailDrawer";
|
import CertificateDetailDrawer from "@/components/certificate/CertificateDetailDrawer";
|
||||||
import { CertificateModel } from "@/domain/certificate";
|
import { CertificateModel } from "@/domain/certificate";
|
||||||
import { list as listCertificate, type CertificateListReq } from "@/repository/certificate";
|
import { list as listCertificate, type ListCertificateRequest } from "@/repository/certificate";
|
||||||
import { getErrMsg } from "@/utils/error";
|
import { getErrMsg } from "@/utils/error";
|
||||||
|
|
||||||
const CertificateList = () => {
|
const CertificateList = () => {
|
||||||
@ -183,7 +183,7 @@ const CertificateList = () => {
|
|||||||
return listCertificate({
|
return listCertificate({
|
||||||
page: page,
|
page: page,
|
||||||
perPage: pageSize,
|
perPage: pageSize,
|
||||||
state: filters["state"] as CertificateListReq["state"],
|
state: filters["state"] as ListCertificateRequest["state"],
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -6,17 +6,17 @@ import { getPocketBase } from "./pocketbase";
|
|||||||
|
|
||||||
const COLLECTION_NAME = "certificate";
|
const COLLECTION_NAME = "certificate";
|
||||||
|
|
||||||
export type CertificateListReq = {
|
export type ListCertificateRequest = {
|
||||||
page?: number;
|
page?: number;
|
||||||
perPage?: number;
|
perPage?: number;
|
||||||
state?: "expireSoon" | "expired";
|
state?: "expireSoon" | "expired";
|
||||||
};
|
};
|
||||||
|
|
||||||
export const list = async (req: CertificateListReq) => {
|
export const list = async (request: ListCertificateRequest) => {
|
||||||
const pb = getPocketBase();
|
const pb = getPocketBase();
|
||||||
|
|
||||||
const page = req.page || 1;
|
const page = request.page || 1;
|
||||||
const perPage = req.perPage || 10;
|
const perPage = request.perPage || 10;
|
||||||
|
|
||||||
const options: RecordListOptions = {
|
const options: RecordListOptions = {
|
||||||
sort: "-created",
|
sort: "-created",
|
||||||
@ -24,11 +24,11 @@ export const list = async (req: CertificateListReq) => {
|
|||||||
requestKey: null,
|
requestKey: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (req.state === "expireSoon") {
|
if (request.state === "expireSoon") {
|
||||||
options.filter = pb.filter("expireAt<{:expiredAt}", {
|
options.filter = pb.filter("expireAt<{:expiredAt}", {
|
||||||
expiredAt: dayjs().add(15, "d").toDate(),
|
expiredAt: dayjs().add(15, "d").toDate(),
|
||||||
});
|
});
|
||||||
} else if (req.state === "expired") {
|
} else if (request.state === "expired") {
|
||||||
options.filter = pb.filter("expireAt<={:expiredAt}", {
|
options.filter = pb.filter("expireAt<={:expiredAt}", {
|
||||||
expiredAt: new Date(),
|
expiredAt: new Date(),
|
||||||
});
|
});
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
import { type RecordListOptions } from "pocketbase";
|
import { type RecordListOptions } from "pocketbase";
|
||||||
|
|
||||||
import { type WorkflowModel, type WorkflowNode, type WorkflowRunLog } from "@/domain/workflow";
|
import { type WorkflowModel, type WorkflowNode } from "@/domain/workflow";
|
||||||
import { getPocketBase } from "./pocketbase";
|
import { getPocketBase } from "./pocketbase";
|
||||||
|
|
||||||
const COLLECTION_NAME = "workflow";
|
const COLLECTION_NAME = "workflow";
|
||||||
|
|
||||||
export type WorkflowListReq = {
|
export type ListWorkflowRequest = {
|
||||||
page?: number;
|
page?: number;
|
||||||
perPage?: number;
|
perPage?: number;
|
||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const list = async (req: WorkflowListReq) => {
|
export const list = async (request: ListWorkflowRequest) => {
|
||||||
const pb = getPocketBase();
|
const pb = getPocketBase();
|
||||||
|
|
||||||
const page = req.page || 1;
|
const page = request.page || 1;
|
||||||
const perPage = req.perPage || 10;
|
const perPage = request.perPage || 10;
|
||||||
|
|
||||||
const options: RecordListOptions = { sort: "-created" };
|
const options: RecordListOptions = { sort: "-created" };
|
||||||
if (req.enabled != null) {
|
if (request.enabled != null) {
|
||||||
options.filter = pb.filter("enabled={:enabled}", { enabled: req.enabled });
|
options.filter = pb.filter("enabled={:enabled}", { enabled: request.enabled });
|
||||||
}
|
}
|
||||||
|
|
||||||
return await pb.collection(COLLECTION_NAME).getList<WorkflowModel>(page, perPage, options);
|
return await pb.collection(COLLECTION_NAME).getList<WorkflowModel>(page, perPage, options);
|
||||||
@ -42,21 +42,3 @@ export const save = async (record: Record<string, string | boolean | WorkflowNod
|
|||||||
export const remove = async (record: MaybeModelRecordWithId<WorkflowModel>) => {
|
export const remove = async (record: MaybeModelRecordWithId<WorkflowModel>) => {
|
||||||
return await getPocketBase().collection(COLLECTION_NAME).delete(record.id);
|
return await getPocketBase().collection(COLLECTION_NAME).delete(record.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
type WorkflowLogsReq = {
|
|
||||||
id: string;
|
|
||||||
page?: number;
|
|
||||||
perPage?: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const logs = async (req: WorkflowLogsReq) => {
|
|
||||||
const page = req.page || 1;
|
|
||||||
const perPage = req.perPage || 10;
|
|
||||||
|
|
||||||
return await getPocketBase()
|
|
||||||
.collection("workflow_run_log")
|
|
||||||
.getList<WorkflowRunLog>(page, perPage, {
|
|
||||||
sort: "-created",
|
|
||||||
filter: getPocketBase().filter("workflow={:workflowId}", { workflowId: req.id }),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
20
ui/src/repository/workflowRunLog.ts
Normal file
20
ui/src/repository/workflowRunLog.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { type WorkflowRunLog } from "@/domain/workflow";
|
||||||
|
import { getPocketBase } from "./pocketbase";
|
||||||
|
|
||||||
|
export type ListWorkflowLogsRequest = {
|
||||||
|
id: string;
|
||||||
|
page?: number;
|
||||||
|
perPage?: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const list = async (request: ListWorkflowLogsRequest) => {
|
||||||
|
const page = request.page || 1;
|
||||||
|
const perPage = request.perPage || 10;
|
||||||
|
|
||||||
|
return await getPocketBase()
|
||||||
|
.collection("workflow_run_log")
|
||||||
|
.getList<WorkflowRunLog>(page, perPage, {
|
||||||
|
filter: getPocketBase().filter("workflow={:workflowId}", { workflowId: request.id }),
|
||||||
|
sort: "-created",
|
||||||
|
});
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user