mirror of https://github.com/certd/certd
refactor(plugin): 优化插件配置界面和功能
-调整插件配置界面布局和样式 - 增加插件类型和图标字段 - 修改字段显示逻辑,根据不同插件类型显示相应字段 - 优化插件服务端处理逻辑,支持不同类型的插件配置pull/370/head
parent
3d8a5196a0
commit
88134ac130
|
@ -42,16 +42,16 @@ import { merge } from "lodash-es";
|
|||
import { notification } from "ant-design-vue";
|
||||
|
||||
defineOptions({
|
||||
name: "SysPluginConfig"
|
||||
name: "SysPluginConfig",
|
||||
});
|
||||
const formState = reactive<Partial<CommPluginConfig>>({
|
||||
CertApply: {
|
||||
sysSetting: {
|
||||
input: {
|
||||
googleCommonEabAccessId: null
|
||||
}
|
||||
}
|
||||
}
|
||||
googleCommonEabAccessId: null,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
async function loadForm() {
|
||||
|
@ -67,7 +67,7 @@ const onFinish = async (form: any) => {
|
|||
saveLoading.value = true;
|
||||
await SaveCommPluginConfigs(form);
|
||||
notification.success({
|
||||
message: "保存成功"
|
||||
message: "保存成功",
|
||||
});
|
||||
} finally {
|
||||
saveLoading.value = false;
|
||||
|
|
|
@ -110,6 +110,54 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
// show: false
|
||||
// }
|
||||
// },
|
||||
pluginType: {
|
||||
title: "插件类型",
|
||||
type: "dict-select",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
form: {
|
||||
order: 0,
|
||||
rules: [{ required: true }],
|
||||
},
|
||||
editForm: {
|
||||
component: {
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: "授权", value: "access" },
|
||||
{ label: "DNS", value: "dnsProvider" },
|
||||
{ label: "部署插件", value: "deploy" },
|
||||
],
|
||||
}),
|
||||
column: {
|
||||
width: 100,
|
||||
align: "center",
|
||||
component: {
|
||||
color: "auto",
|
||||
},
|
||||
},
|
||||
},
|
||||
icon: {
|
||||
title: "图标",
|
||||
type: "icon",
|
||||
form: {
|
||||
rules: [{ required: true }],
|
||||
},
|
||||
column: {
|
||||
width: 70,
|
||||
align: "center",
|
||||
component: {
|
||||
name: "fs-icon",
|
||||
vModel: "icon",
|
||||
style: {
|
||||
fontSize: "22px",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
name: {
|
||||
title: "插件名称",
|
||||
type: "text",
|
||||
|
@ -118,7 +166,6 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
},
|
||||
form: {
|
||||
show: true,
|
||||
order: 0,
|
||||
helper: "必须为英文,驼峰命名,类型作为前缀\n例如AliyunDeployToCDN\n插件一旦被使用,不要修改名称",
|
||||
rules: [{ required: true }],
|
||||
},
|
||||
|
@ -141,7 +188,6 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
},
|
||||
form: {
|
||||
show: true,
|
||||
order: 0,
|
||||
helper: "上传到插件商店时,将作为插件名称前缀,例如:greper/pluginName",
|
||||
rules: [{ required: true }],
|
||||
},
|
||||
|
@ -150,30 +196,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
show: false,
|
||||
},
|
||||
},
|
||||
icon: {
|
||||
title: "图标",
|
||||
type: "icon",
|
||||
form: {
|
||||
rules: [{ required: true }],
|
||||
},
|
||||
column: {
|
||||
width: 70,
|
||||
align: "center",
|
||||
component: {
|
||||
name: "fs-icon",
|
||||
vModel: "icon",
|
||||
style: {
|
||||
fontSize: "22px",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
title: {
|
||||
title: "标题",
|
||||
type: "text",
|
||||
form: {
|
||||
order: 0,
|
||||
helper: "插件中文名称",
|
||||
rules: [{ required: true }],
|
||||
},
|
||||
|
@ -196,6 +222,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
show: false,
|
||||
},
|
||||
},
|
||||
|
||||
type: {
|
||||
title: "来源",
|
||||
type: "dict-select",
|
||||
|
@ -223,35 +250,6 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
},
|
||||
},
|
||||
},
|
||||
pluginType: {
|
||||
title: "插件类型",
|
||||
type: "dict-select",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
form: {
|
||||
rules: [{ required: true }],
|
||||
},
|
||||
editForm: {
|
||||
component: {
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: "授权", value: "access" },
|
||||
{ label: "DNS", value: "dnsProvider" },
|
||||
{ label: "部署插件", value: "deploy" },
|
||||
],
|
||||
}),
|
||||
column: {
|
||||
width: 100,
|
||||
align: "center",
|
||||
component: {
|
||||
color: "auto",
|
||||
},
|
||||
},
|
||||
},
|
||||
version: {
|
||||
title: "版本",
|
||||
type: "text",
|
||||
|
@ -260,25 +258,6 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
align: "center",
|
||||
},
|
||||
},
|
||||
group: {
|
||||
title: "分组",
|
||||
type: "dict-select",
|
||||
dict: dict({
|
||||
url: "/pi/plugin/groupsList",
|
||||
label: "title",
|
||||
value: "key",
|
||||
}),
|
||||
form: {
|
||||
rules: [{ required: true }],
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
align: "left",
|
||||
component: {
|
||||
color: "auto",
|
||||
},
|
||||
},
|
||||
},
|
||||
"extra.dependLibs": {
|
||||
title: "第三方依赖",
|
||||
type: "text",
|
||||
|
@ -316,8 +295,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ value: false, label: "不可修改" },
|
||||
{ value: true, label: "可修改" },
|
||||
{ value: false, label: "不可修改" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
|
@ -404,6 +383,28 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
},
|
||||
},
|
||||
},
|
||||
group: {
|
||||
title: "插件分组",
|
||||
type: "dict-select",
|
||||
dict: dict({
|
||||
url: "/pi/plugin/groupsList",
|
||||
label: "title",
|
||||
value: "key",
|
||||
}),
|
||||
form: {
|
||||
rules: [{ required: true }],
|
||||
show: compute(({ form }) => {
|
||||
return form.pluginType === "deploy";
|
||||
}),
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
align: "left",
|
||||
component: {
|
||||
color: "auto",
|
||||
},
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: "创建时间",
|
||||
type: "datetime",
|
||||
|
|
|
@ -24,11 +24,11 @@ input:
|
|||
`
|
||||
|
||||
const script = `
|
||||
# 必须使用 await import 来引入模块
|
||||
// 必须使用 await import 来引入模块
|
||||
const { BaseAccess } = await import("@certd/pipeline")
|
||||
# 需要返回一个继承BaseAccess的类
|
||||
// 需要返回一个继承BaseAccess的类
|
||||
return class DemoAccess extends BaseAccess {
|
||||
# 授权的字段,跟左边input一一对应
|
||||
// 授权的字段,跟左边input一一对应
|
||||
username;
|
||||
password;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ return class DemoTask extends AbstractTaskPlugin {
|
|||
key2;
|
||||
// 编写执行方法
|
||||
async execute(){
|
||||
# 根据accessId获取授权配置
|
||||
// 根据accessId获取授权配置
|
||||
const access = await this.getAccess(this.accessId)
|
||||
|
||||
//必须使用this.logger打印日志
|
||||
|
|
|
@ -166,10 +166,12 @@ export class PluginService extends BaseService<PluginEntity> {
|
|||
let plugin:any = {}
|
||||
if (param.pluginType === "access") {
|
||||
plugin = getDefaultAccessPlugin()
|
||||
delete param.group
|
||||
}else if (param.pluginType === "deploy") {
|
||||
plugin = getDefaultDeployPlugin()
|
||||
}else if (param.pluginType === "dnsProvider") {
|
||||
plugin = getDefaultDnsPlugin()
|
||||
delete param.group
|
||||
}else{
|
||||
throw new Error(`插件类型${param.pluginType}不支持`);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue