perf: 优化上传到主机插 路径选择,根据证书格式显示

pull/243/head
xiaojunnuo 2024-11-13 22:06:56 +08:00
parent b66542cb40
commit 8c3f86c690
5 changed files with 161 additions and 34 deletions

View File

@ -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",

View File

@ -348,6 +348,7 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
type: "link",
search: {
show: true,
title: "关键字",
component: {
name: "a-input"
}

View File

@ -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;

View File

@ -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',

View File

@ -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: 'pemNginx等大部分应用' },
{ 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授权',