mirror of https://github.com/certd/certd
chore:
parent
febe87508c
commit
393ea27fa4
|
@ -29,7 +29,6 @@ function initPlugins(plugins: any) {
|
|||
plugin.input[key] = field;
|
||||
}
|
||||
}
|
||||
console.log("plugins", plugins);
|
||||
}
|
||||
|
||||
export async function GetList(query: any) {
|
||||
|
@ -56,6 +55,18 @@ export async function GetGroups(query: any) {
|
|||
return groups;
|
||||
}
|
||||
|
||||
export async function GetPluginDefine(type: string) {
|
||||
const define = await request({
|
||||
url: apiPrefix + "/getDefineByType",
|
||||
method: "post",
|
||||
data: {
|
||||
type
|
||||
}
|
||||
});
|
||||
initPlugins([define]);
|
||||
return define;
|
||||
}
|
||||
|
||||
export async function GetPluginConfig(req: { id?: number; name: string; type: string }): Promise<PluginConfigBean> {
|
||||
return await request({
|
||||
url: apiPrefix + "/config",
|
||||
|
|
|
@ -239,13 +239,13 @@ export default {
|
|||
const stepType = step.type;
|
||||
step.type = stepType;
|
||||
step._isAdd = false;
|
||||
|
||||
let pluginDefine = pluginGroups.get(stepType);
|
||||
const pluginDefine = await pluginApi.GetPluginDefine(stepType);
|
||||
// let pluginDefine = pluginGroups.get(stepType);
|
||||
if (pluginDefine == null) {
|
||||
console.log("插件未找到", stepType);
|
||||
return;
|
||||
}
|
||||
pluginDefine = _.cloneDeep(pluginDefine);
|
||||
// pluginDefine = _.cloneDeep(pluginDefine);
|
||||
const columns = pluginDefine.input;
|
||||
for (let key in columns) {
|
||||
const column = columns[key];
|
||||
|
|
|
@ -29,6 +29,12 @@ export class PluginController extends BaseController {
|
|||
return this.ok(group);
|
||||
}
|
||||
|
||||
@Post('/getDefineByType', { summary: Constants.per.authOnly })
|
||||
async getDefineByType(@Body('type') type: string) {
|
||||
const define = await this.service.getDefineByType(type);
|
||||
return this.ok(define);
|
||||
}
|
||||
|
||||
@Post('/config', { summary: Constants.per.authOnly })
|
||||
async config(@Body(ALL) body: { id?: number; name?: string; type: string }) {
|
||||
const config = await this.pluginConfigService.getPluginConfig(body);
|
||||
|
|
|
@ -21,4 +21,8 @@ export class BuiltInPluginService {
|
|||
getGroups() {
|
||||
return cloneDeep(pluginGroups);
|
||||
}
|
||||
|
||||
getByType(type: string) {
|
||||
return pluginRegistry.getDefine(type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,4 +127,8 @@ export class PluginService extends BaseService<PluginEntity> {
|
|||
}
|
||||
throw new Error('参数错误: id 和 name 必须有一个');
|
||||
}
|
||||
|
||||
async getDefineByType(type: string) {
|
||||
return this.builtInPluginService.getByType(type);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue