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() {
|
afterSubmit() {
|
||||||
notification.success({ message: "操作成功" });
|
notification.success({ message: "操作成功" });
|
||||||
|
crudExpose.doRefresh();
|
||||||
},
|
},
|
||||||
async doSubmit({ form }: any) {
|
async doSubmit({ form }: any) {
|
||||||
return await api.ImportPlugin({
|
return await api.ImportPlugin({
|
||||||
|
|
|
@ -438,25 +438,25 @@ export class PluginService extends BaseService<PluginEntity> {
|
||||||
...loaded,
|
...loaded,
|
||||||
metadata: yaml.dump(metadata),
|
metadata: yaml.dump(metadata),
|
||||||
extra: yaml.dump(extra),
|
extra: yaml.dump(extra),
|
||||||
content: req.content,
|
content: loaded.content,
|
||||||
disabled: false
|
disabled: false
|
||||||
};
|
};
|
||||||
if (!pluginEntity.pluginType) {
|
if (!pluginEntity.pluginType) {
|
||||||
throw new Error(`插件类型不能为空`);
|
throw new Error(`插件类型不能为空`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old) {
|
if (!old) {
|
||||||
if (!req.override) {
|
|
||||||
throw new Error(`插件${loaded.author}/${loaded.name}已存在`);
|
|
||||||
}
|
|
||||||
//update
|
|
||||||
pluginEntity.id = old.id;
|
|
||||||
await this.update(pluginEntity);
|
|
||||||
} else {
|
|
||||||
//add
|
//add
|
||||||
const {id} = await this.add(pluginEntity);
|
const {id} = await this.add(pluginEntity);
|
||||||
pluginEntity.id = id;
|
pluginEntity.id = id;
|
||||||
|
} else{
|
||||||
|
if (!req.override) {
|
||||||
|
throw new Error(`插件${loaded.author}/${loaded.name}已存在`);
|
||||||
|
}
|
||||||
|
pluginEntity.id = old.id;
|
||||||
}
|
}
|
||||||
|
//update
|
||||||
|
await this.update(pluginEntity);
|
||||||
return {
|
return {
|
||||||
id: pluginEntity.id
|
id: pluginEntity.id
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue