fix_系统设置_插件管理_搜索失效--bug=1006713 --user=王孝刚 【插件管理】搜索不生效 https://www.tapd.cn/55049933/s/1048283

This commit is contained in:
wxg0103 2021-09-18 13:53:31 +08:00 committed by fit2-zhao
parent fddaebdef6
commit 4d71617279
3 changed files with 42 additions and 29 deletions

View File

@ -27,8 +27,8 @@ public class PluginController {
}
@GetMapping("/list")
public List<PluginDTO> list() {
return pluginService.list();
public List<PluginDTO> list(String name) {
return pluginService.list(name);
}
@GetMapping("/get/{id}")

View File

@ -150,30 +150,41 @@ public class PluginService {
}
}
public List<PluginDTO> list() {
PluginExample example = new PluginExample();
List<Plugin> plugins = pluginMapper.selectByExample(example);
Map<String, Boolean> pluginMap = new HashMap<>();
List<PluginDTO> lists = new LinkedList<>();
// 校验插件是否是企业版
plugins.forEach(item -> {
PluginDTO dto = new PluginDTO();
BeanUtils.copyBean(dto, item);
if (!pluginMap.containsKey(item.getPluginId())) {
try {
Class<?> clazz = Class.forName(item.getExecEntry());
Object instance = clazz.newInstance();
dto.setLicense(this.isXpack(Class.forName(item.getExecEntry()), instance));
} catch (Exception e) {
LogUtil.error(e.getMessage());
}
} else {
dto.setLicense(pluginMap.get(item.getPluginId()));
public List<PluginDTO> list(String name) {
try {
PluginExample example = new PluginExample();
if (StringUtils.isNotBlank(name)) {
name = "%" + name + "%";
example.createCriteria().andNameLike(name);
}
lists.add(dto);
pluginMap.put(item.getPluginId(), dto.getLicense());
});
return lists;
List<Plugin> plugins = pluginMapper.selectByExample(example);
Map<String, Boolean> pluginMap = new HashMap<>();
List<PluginDTO> lists = new LinkedList<>();
if (CollectionUtils.isNotEmpty(plugins)) {
// 校验插件是否是企业版
plugins.forEach(item -> {
PluginDTO dto = new PluginDTO();
BeanUtils.copyBean(dto, item);
if (!pluginMap.containsKey(item.getPluginId())) {
try {
Class<?> clazz = Class.forName(item.getExecEntry());
Object instance = clazz.newInstance();
dto.setLicense(this.isXpack(Class.forName(item.getExecEntry()), instance));
} catch (Exception e) {
LogUtil.error(e.getMessage());
}
} else {
dto.setLicense(pluginMap.get(item.getPluginId()));
}
lists.add(dto);
pluginMap.put(item.getPluginId(), dto.getLicense());
});
return lists;
}
} catch (Exception e) {
LogUtil.error(e);
}
return null;
}
public Plugin get(String scriptId) {

View File

@ -6,11 +6,12 @@
<ms-table-header
:showCreate="false"
:create-permission="['SYSTEM_USER:READ+CREATE']"
:condition.sync="condition" @search="search"
:condition.sync="condition"
:import-tip="$t('test_track.case.import.click_upload')"
:tip="$t('commons.search_by_name_or_id')"
:create-tip="$t('user.create')"
:title="$t('plugin.title')"
@search="initPlugins"
@import="importJar"
:show-import="true"/>
</template>
@ -87,14 +88,15 @@ export default {
this.initPlugins();
},
methods: {
search() {
},
importJar() {
this.dialogVisible = true;
},
initPlugins() {
let url = "/plugin/list";
let name = this.condition.name;
if (name) {
url = "/plugin/list?name=" +name;
}
this.tableData = [];
this.$get(url, response => {
if (response.data) {