From 8c3f86c6909ed91f48bb2880e78834e22f6f6a29 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Wed, 13 Nov 2024 22:06:56 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=88=B0=E4=B8=BB=E6=9C=BA=E6=8F=92=20=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E9=80=89=E6=8B=A9=EF=BC=8C=E6=A0=B9=E6=8D=AE=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui/certd-client/package.json | 8 +- .../src/views/certd/pipeline/crud.tsx | 1 + .../pipeline/component/step-form/index.vue | 2 +- .../plugin-host/plugin/copy-to-local/index.ts | 85 +++++++++++++--- .../plugin/upload-to-host/index.ts | 99 +++++++++++++++---- 5 files changed, 161 insertions(+), 34 deletions(-) diff --git a/packages/ui/certd-client/package.json b/packages/ui/certd-client/package.json index 2f8331e1a..3d0f20487 100644 --- a/packages/ui/certd-client/package.json +++ b/packages/ui/certd-client/package.json @@ -26,10 +26,10 @@ "dependencies": { "@ant-design/colors": "^7.0.2", "@ant-design/icons-vue": "^6.1.0", - "@fast-crud/fast-crud": "^1.22.3", - "@fast-crud/fast-extends": "^1.22.3", - "@fast-crud/ui-antdv4": "^1.22.3", - "@fast-crud/ui-interface": "^1.22.3", + "@fast-crud/fast-crud": "^1.23.1", + "@fast-crud/fast-extends": "^1.23.1", + "@fast-crud/ui-antdv4": "^1.23.1", + "@fast-crud/ui-interface": "^1.23.1", "@iconify/vue": "^4.1.1", "@soerenmartius/vue3-clipboard": "^0.1.2", "@vue-js-cron/light": "^4.0.5", diff --git a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx index c71bf5fa1..33952bdec 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx @@ -348,6 +348,7 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp type: "link", search: { show: true, + title: "关键字", component: { name: "a-input" } diff --git a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/step-form/index.vue b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/step-form/index.vue index 324efafab..0cf67338d 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/step-form/index.vue +++ b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/step-form/index.vue @@ -230,7 +230,7 @@ export default { } const { doComputed } = useCompute(); const currentPlugin = doComputed(() => { - return currentPluginDefine.value; + return currentPluginDefine.value || {}; }, getContext); const changeCurrentPlugin = async (step: any) => { const stepType = step.type; diff --git a/packages/ui/certd-server/src/plugins/plugin-host/plugin/copy-to-local/index.ts b/packages/ui/certd-server/src/plugins/plugin-host/plugin/copy-to-local/index.ts index 7a8bb3b1c..573565e7a 100644 --- a/packages/ui/certd-server/src/plugins/plugin-host/plugin/copy-to-local/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-host/plugin/copy-to-local/index.ts @@ -17,12 +17,47 @@ import path from 'path'; }, }) export class CopyCertToLocalPlugin extends AbstractTaskPlugin { + @TaskInput({ + title: '域名证书', + helper: '请选择前置任务输出的域名证书', + component: { + name: 'output-selector', + from: ['CertApply', 'CertApplyLego'], + }, + required: true, + }) + cert!: CertInfo; + + @TaskInput({ + title: '证书类型', + helper: '支持pem、pfx、der、jks格式', + component: { + name: 'a-select', + options: [ + { value: 'pem', label: 'pem,用于Nginx等大部分应用' }, + { value: 'pfx', label: 'pfx,一般用于IIS' }, + { value: 'der', label: 'der,一般用于Apache' }, + { value: 'jks', label: 'jks,一般用于JAVA应用' }, + ], + }, + required: true, + }) + certType!: string; + @TaskInput({ title: '证书保存路径', helper: '全链证书,路径要包含文件名' + '\n推荐使用相对路径,将写入与数据库同级目录,无需映射,例如:tmp/cert.pem', component: { placeholder: 'tmp/full_chain.pem', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'pem'; + }) + } + `, + required: true, rules: [{ type: 'filepath' }], }) crtPath!: string; @@ -32,6 +67,14 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin { component: { placeholder: 'tmp/cert.key', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'pem'; + }) + } + `, + required: true, rules: [{ type: 'filepath' }], }) keyPath!: string; @@ -42,6 +85,13 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin { component: { placeholder: '/root/deploy/nginx/intermediate.pem', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'pem'; + }) + } + `, rules: [{ type: 'filepath' }], }) icPath!: string; @@ -52,6 +102,14 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin { component: { placeholder: 'tmp/cert.pfx', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'pfx'; + }) + } + `, + required: true, rules: [{ type: 'filepath' }], }) pfxPath!: string; @@ -63,6 +121,14 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin { component: { placeholder: 'tmp/cert.der 或 tmp/cert.cer', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'der'; + }) + } + `, + required: true, rules: [{ type: 'filepath' }], }) derPath!: string; @@ -73,21 +139,18 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin { component: { placeholder: 'tmp/cert.jks', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'jks'; + }) + } + `, + required: true, rules: [{ type: 'filepath' }], }) jksPath!: string; - @TaskInput({ - title: '域名证书', - helper: '请选择前置任务输出的域名证书', - component: { - name: 'output-selector', - from: ['CertApply', 'CertApplyLego'], - }, - required: true, - }) - cert!: CertInfo; - @TaskOutput({ title: '证书保存路径', type: 'HostCrtPath', diff --git a/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts b/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts index 0f9e8b0fe..8e9f2e94b 100644 --- a/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-host/plugin/upload-to-host/index.ts @@ -18,12 +18,47 @@ import dayjs from 'dayjs'; }, }) export class UploadCertToHostPlugin extends AbstractTaskPlugin { + @TaskInput({ + title: '域名证书', + helper: '请选择前置任务输出的域名证书', + component: { + name: 'output-selector', + from: ['CertApply', 'CertApplyLego'], + }, + required: true, + }) + cert!: CertInfo; + + @TaskInput({ + title: '证书格式', + helper: '支持pem、pfx、der、jks格式', + component: { + name: 'a-select', + options: [ + { value: 'pem', label: 'pem,Nginx等大部分应用' }, + { value: 'pfx', label: 'pfx,一般用于IIS' }, + { value: 'der', label: 'der,一般用于Apache' }, + { value: 'jks', label: 'jks,一般用于JAVA应用' }, + ], + }, + required: true, + }) + certType!: string; + @TaskInput({ title: '证书保存路径', - helper: '全链证书,需要有写入权限,路径要包含证书文件名,例如:/tmp/cert.pem', + helper: '填写应用原本的证书保存路径,路径要包含证书文件名,例如:/tmp/cert.pem', component: { placeholder: '/root/deploy/nginx/full_chain.pem', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'pem'; + }) + } + `, + required: true, rules: [{ type: 'filepath' }], }) crtPath!: string; @@ -33,6 +68,14 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin { component: { placeholder: '/root/deploy/nginx/cert.key', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'pem'; + }) + } + `, + required: true, rules: [{ type: 'filepath' }], }) keyPath!: string; @@ -43,51 +86,71 @@ export class UploadCertToHostPlugin extends AbstractTaskPlugin { component: { placeholder: '/root/deploy/nginx/intermediate.pem', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'pem'; + }) + } + `, rules: [{ type: 'filepath' }], }) icPath!: string; @TaskInput({ title: 'PFX证书保存路径', - helper: '用于IIS证书部署,需要有写入权限,路径要包含证书文件名,例如:/tmp/cert.pfx', + helper: '填写应用原本的证书保存路径,路径要包含证书文件名,例如:D:\\iis\\cert.pfx', component: { - placeholder: '/root/deploy/nginx/cert.pfx', + placeholder: 'D:\\iis\\cert.pfx', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'pfx'; + }) + } + `, + required: true, rules: [{ type: 'filepath' }], }) pfxPath!: string; @TaskInput({ title: 'DER证书保存路径', - helper: '用于Apache证书部署,需要有写入权限,路径要包含证书文件名,例如:/tmp/cert.der', + helper: '填写应用原本的证书保存路径,路径要包含证书文件名,例如:/tmp/cert.der', component: { - placeholder: '/root/deploy/nginx/cert.der', + placeholder: '/root/deploy/apache/cert.der', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'der'; + }) + } + `, + required: true, rules: [{ type: 'filepath' }], }) derPath!: string; @TaskInput({ title: 'jks证书保存路径', - helper: '需要有写入权限,路径要包含证书文件名,例如:/tmp/cert.jks', + helper: '填写应用原本的证书保存路径,路径要包含证书文件名,例如:/tmp/cert.jks', component: { - placeholder: '/root/deploy/nginx/cert.jks', + placeholder: '/root/deploy/java_app/cert.jks', }, + mergeScript: ` + return { + show: ctx.compute(({form})=>{ + return form.certType === 'jks'; + }) + } + `, + required: true, rules: [{ type: 'filepath' }], }) jksPath!: string; - @TaskInput({ - title: '域名证书', - helper: '请选择前置任务输出的域名证书', - component: { - name: 'output-selector', - from: ['CertApply', 'CertApplyLego'], - }, - required: true, - }) - cert!: CertInfo; - @TaskInput({ title: '主机登录配置', helper: 'access授权',