perf(插件): 限制官方插件更新卸载

This commit is contained in:
fit2cloud-chenyw 2022-12-22 11:14:59 +08:00
parent 6c6449c7d4
commit 6d73890902
2 changed files with 13 additions and 5 deletions

View File

@ -227,7 +227,7 @@ public class PluginService {
LogUtil.error(msg); LogUtil.error(msg);
DEException.throwException(msg); DEException.throwException(msg);
} }
deleteJarFile(myPlugin); myPlugin = deleteJarFile(myPlugin);
CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME); CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME);
CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME); CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME);
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME); CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
@ -258,18 +258,26 @@ public class PluginService {
return true; return true;
} }
private void deleteJarFile(MyPlugin plugin) { private MyPlugin deleteJarFile(MyPlugin plugin) {
String version = plugin.getVersion(); String version = plugin.getVersion();
String moduleName = plugin.getModuleName(); String moduleName = plugin.getModuleName();
String fileName = moduleName + "-" + version + ".jar"; String fileName = moduleName + "-" + version + ".jar";
String path = pluginDir + plugin.getStore() + "/" + fileName; String path = pluginDir + plugin.getStore() + "/" + fileName;
File jarFile = new File(path); File jarFile = new File(path);
if (!StringUtils.equals("default", plugin.getStore()) && !jarFile.exists()) {
version = "1.0-SNAPSHOT";
fileName = moduleName + "-" + version + ".jar";
path = pluginDir + plugin.getStore() + "/" + fileName;
jarFile = new File(path);
plugin.setVersion(version);
}
FileUtil.del(jarFile); FileUtil.del(jarFile);
if (plugin.getCategory().equalsIgnoreCase("datasource")) { if (plugin.getCategory().equalsIgnoreCase("datasource")) {
File driverFile = new File(pluginDir + plugin.getStore() + "/" + plugin.getDsType() + "Driver"); File driverFile = new File(pluginDir + plugin.getStore() + "/" + plugin.getDsType() + "Driver");
FileUtil.del(driverFile); FileUtil.del(driverFile);
} }
return plugin;
} }
/** /**

View File

@ -228,7 +228,7 @@ export default {
] ]
} }
pluginLists(0, 0, param).then((response) => { pluginLists(0, 0, param).then((response) => {
this.data = response.data.listObject this.data = response.data.listObject.filter(item => item.pluginId > 1)
this.data.forEach((ele) => { this.data.forEach((ele) => {
if (ele.cost) { if (ele.cost) {
ele.cost = ele.cost.toLocaleString() ele.cost = ele.cost.toLocaleString()
@ -283,10 +283,10 @@ export default {
this.handlerConfirm(options) this.handlerConfirm(options)
}, },
btnDisabled(row) { btnDisabled(row) {
return row.pluginId < 4 return row.store === 'default'
}, },
updateDisabled(row) { updateDisabled(row) {
return row.pluginId === 1 return row.store === 'default'
} }
} }
} }