mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-05 05:54:53 +00:00
feat: enhance certificate model
This commit is contained in:
@@ -38,11 +38,27 @@ const CertificateDetail = ({ data, ...props }: CertificateDetailProps) => {
|
||||
|
||||
<Form layout="vertical">
|
||||
<Form.Item label={t("certificate.props.subject_alt_names")}>
|
||||
<Input value={data.subjectAltNames} placeholder="" />
|
||||
<Input value={data.subjectAltNames} variant="filled" placeholder="" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label={t("certificate.props.issuer")}>
|
||||
<Input value={data.issuer} variant="filled" placeholder="" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label={t("certificate.props.validity")}>
|
||||
<Input value={`${dayjs(data.effectAt).format("YYYY-MM-DD HH:mm:ss")} ~ ${dayjs(data.expireAt).format("YYYY-MM-DD HH:mm:ss")}`} placeholder="" />
|
||||
<Input
|
||||
value={`${dayjs(data.effectAt).format("YYYY-MM-DD HH:mm:ss")} ~ ${dayjs(data.expireAt).format("YYYY-MM-DD HH:mm:ss")}`}
|
||||
variant="filled"
|
||||
placeholder=""
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label={t("certificate.props.serial_number")}>
|
||||
<Input value={data.serialNumber} variant="filled" placeholder="" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label={t("certificate.props.key_algorithm")}>
|
||||
<Input value={data.keyAlgorithm} variant="filled" placeholder="" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item>
|
||||
@@ -59,7 +75,7 @@ const CertificateDetail = ({ data, ...props }: CertificateDetailProps) => {
|
||||
</CopyToClipboard>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<Input.TextArea value={data.certificate} rows={10} autoSize={{ maxRows: 10 }} readOnly />
|
||||
<Input.TextArea value={data.certificate} variant="filled" rows={5} autoSize={{ maxRows: 5 }} readOnly />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item>
|
||||
@@ -76,7 +92,7 @@ const CertificateDetail = ({ data, ...props }: CertificateDetailProps) => {
|
||||
</CopyToClipboard>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<Input.TextArea value={data.privateKey} rows={10} autoSize={{ maxRows: 10 }} readOnly />
|
||||
<Input.TextArea value={data.privateKey} variant="filled" rows={5} autoSize={{ maxRows: 5 }} readOnly />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
||||
|
@@ -137,7 +137,7 @@ const UploadNodeConfigForm = forwardRef<UploadNodeConfigFormInstance, UploadNode
|
||||
return (
|
||||
<Form className={className} style={style} {...formProps} disabled={disabled} layout="vertical" scrollToFirstError onValuesChange={handleFormChange}>
|
||||
<Form.Item name="domains" label={t("workflow_node.upload.form.domains.label")} rules={[formRule]}>
|
||||
<Input placeholder={t("workflow_node.upload.form.domains.placeholder")} readOnly />
|
||||
<Input variant="filled" placeholder={t("workflow_node.upload.form.domains.placeholder")} readOnly />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="certificate" label={t("workflow_node.upload.form.certificate.label")} rules={[formRule]}>
|
||||
|
@@ -3,8 +3,11 @@ import { type WorkflowModel } from "./workflow";
|
||||
export interface CertificateModel extends BaseModel {
|
||||
source: string;
|
||||
subjectAltNames: string;
|
||||
serialNumber: string;
|
||||
certificate: string;
|
||||
privateKey: string;
|
||||
issuer: string;
|
||||
keyAlgorithm: string;
|
||||
effectAt: ISO8601String;
|
||||
expireAt: ISO8601String;
|
||||
workflowId: string;
|
||||
|
@@ -15,11 +15,15 @@
|
||||
"certificate.props.validity.expiration": "Expire on {{date}}",
|
||||
"certificate.props.validity.filter.expire_soon": "Expire soon",
|
||||
"certificate.props.validity.filter.expired": "Expired",
|
||||
"certificate.props.brand": "Brand",
|
||||
"certificate.props.source": "Source",
|
||||
"certificate.props.source.workflow": "Workflow",
|
||||
"certificate.props.source.upload": "Upload",
|
||||
"certificate.props.certificate": "Certificate chain",
|
||||
"certificate.props.private_key": "Private key",
|
||||
"certificate.props.serial_number": "Serial number",
|
||||
"certificate.props.key_algorithm": "Key algorithm",
|
||||
"certificate.props.issuer": "Issuer",
|
||||
"certificate.props.created_at": "Created at",
|
||||
"certificate.props.updated_at": "Updated at"
|
||||
}
|
||||
|
@@ -15,11 +15,15 @@
|
||||
"certificate.props.validity.expiration": "{{date}} 到期",
|
||||
"certificate.props.validity.filter.expire_soon": "即将到期",
|
||||
"certificate.props.validity.filter.expired": "已到期",
|
||||
"certificate.props.brand": "证书品牌",
|
||||
"certificate.props.source": "来源",
|
||||
"certificate.props.source.workflow": "工作流",
|
||||
"certificate.props.source.upload": "用户上传",
|
||||
"certificate.props.certificate": "证书内容",
|
||||
"certificate.props.private_key": "私钥内容",
|
||||
"certificate.props.serial_number": "证书序列号",
|
||||
"certificate.props.key_algorithm": "证书算法",
|
||||
"certificate.props.issuer": "颁发者",
|
||||
"certificate.props.created_at": "创建时间",
|
||||
"certificate.props.updated_at": "更新时间"
|
||||
}
|
||||
|
@@ -107,6 +107,16 @@ const CertificateList = () => {
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: "issuer",
|
||||
title: t("certificate.props.brand"),
|
||||
render: (_, record) => (
|
||||
<Space className="max-w-full" direction="vertical" size={4}>
|
||||
<Typography.Text>{record.issuer}</Typography.Text>
|
||||
<Typography.Text>{record.keyAlgorithm}</Typography.Text>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: "source",
|
||||
title: t("certificate.props.source"),
|
||||
@@ -250,7 +260,7 @@ const CertificateList = () => {
|
||||
dataSource={tableData}
|
||||
loading={loading}
|
||||
locale={{
|
||||
emptyText: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={loadedError ? getErrMsg(loadedError) : t("certificate.nodata")} />,
|
||||
emptyText: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={getErrMsg(loadedError ?? t("certificate.nodata"))} />,
|
||||
}}
|
||||
pagination={{
|
||||
current: page,
|
||||
|
@@ -60,13 +60,13 @@ const WorkflowDetail = () => {
|
||||
const [allowRun, setAllowRun] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setIsRunning(lastRunStatus == WORKFLOW_RUN_STATUSES.RUNNING);
|
||||
setIsRunning(lastRunStatus == WORKFLOW_RUN_STATUSES.PENDING || lastRunStatus == WORKFLOW_RUN_STATUSES.RUNNING);
|
||||
}, [lastRunStatus]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!!workflowId && isRunning) {
|
||||
subscribeWorkflow(workflowId, (e) => {
|
||||
if (e.record.lastRunStatus !== WORKFLOW_RUN_STATUSES.RUNNING) {
|
||||
if (e.record.lastRunStatus !== WORKFLOW_RUN_STATUSES.PENDING && e.record.lastRunStatus !== WORKFLOW_RUN_STATUSES.RUNNING) {
|
||||
setIsRunning(false);
|
||||
unsubscribeWorkflow(workflowId);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ const WorkflowDetail = () => {
|
||||
|
||||
// subscribe before running workflow
|
||||
unsubscribeFn = await subscribeWorkflow(workflowId!, (e) => {
|
||||
if (e.record.lastRunStatus !== WORKFLOW_RUN_STATUSES.RUNNING) {
|
||||
if (e.record.lastRunStatus !== WORKFLOW_RUN_STATUSES.PENDING && e.record.lastRunStatus !== WORKFLOW_RUN_STATUSES.RUNNING) {
|
||||
setIsRunning(false);
|
||||
unsubscribeFn?.();
|
||||
}
|
||||
|
@@ -350,7 +350,7 @@ const WorkflowList = () => {
|
||||
dataSource={tableData}
|
||||
loading={loading}
|
||||
locale={{
|
||||
emptyText: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={loadedError ? getErrMsg(loadedError) : t("workflow.nodata")} />,
|
||||
emptyText: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={getErrMsg(loadedError ?? t("workflow.nodata"))} />,
|
||||
}}
|
||||
pagination={{
|
||||
current: page,
|
||||
|
@@ -7,13 +7,13 @@ export const getErrMsg = (error: unknown): string => {
|
||||
return error.message;
|
||||
} else if (typeof error === "object" && error != null) {
|
||||
if ("message" in error) {
|
||||
return String(error.message);
|
||||
return getErrMsg(error.message);
|
||||
} else if ("msg" in error) {
|
||||
return String(error.msg);
|
||||
return getErrMsg(error.msg);
|
||||
}
|
||||
} else if (typeof error === "string") {
|
||||
return error;
|
||||
return error || "Unknown error";
|
||||
}
|
||||
|
||||
return String(error ?? "Unknown error");
|
||||
return "Unknown error";
|
||||
};
|
||||
|
Reference in New Issue
Block a user