mirror of https://github.com/certd/certd
fix: 修复插件导入的bug
parent
61f06faaf5
commit
677fec0a0b
|
@ -91,6 +91,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||
},
|
||||
afterSubmit() {
|
||||
notification.success({ message: "操作成功" });
|
||||
crudExpose.doRefresh();
|
||||
},
|
||||
async doSubmit({ form }: any) {
|
||||
return await api.ImportPlugin({
|
||||
|
|
|
@ -438,25 +438,25 @@ export class PluginService extends BaseService<PluginEntity> {
|
|||
...loaded,
|
||||
metadata: yaml.dump(metadata),
|
||||
extra: yaml.dump(extra),
|
||||
content: req.content,
|
||||
content: loaded.content,
|
||||
disabled: false
|
||||
};
|
||||
if (!pluginEntity.pluginType) {
|
||||
throw new Error(`插件类型不能为空`);
|
||||
}
|
||||
|
||||
if (old) {
|
||||
if (!req.override) {
|
||||
throw new Error(`插件${loaded.author}/${loaded.name}已存在`);
|
||||
}
|
||||
//update
|
||||
pluginEntity.id = old.id;
|
||||
await this.update(pluginEntity);
|
||||
} else {
|
||||
if (!old) {
|
||||
//add
|
||||
const {id} = await this.add(pluginEntity);
|
||||
pluginEntity.id = id;
|
||||
} else{
|
||||
if (!req.override) {
|
||||
throw new Error(`插件${loaded.author}/${loaded.name}已存在`);
|
||||
}
|
||||
pluginEntity.id = old.id;
|
||||
}
|
||||
//update
|
||||
await this.update(pluginEntity);
|
||||
return {
|
||||
id: pluginEntity.id
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue