fear: (系统设置) 项目-jar包管理,支持查找 (#1350)
This commit is contained in:
parent
133035bd7a
commit
893485d592
|
@ -2,6 +2,7 @@ package io.metersphere.controller;
|
|||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
|
||||
import io.metersphere.base.domain.JarConfig;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
|
@ -35,6 +36,11 @@ public class JarConfigController {
|
|||
return JarConfigService.list();
|
||||
}
|
||||
|
||||
@PostMapping("list")
|
||||
public List<JarConfig> list(@RequestBody JarConfig jarConfig) {
|
||||
return JarConfigService.searchList(jarConfig);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
public JarConfig get(@PathVariable String id) {
|
||||
return JarConfigService.get(id);
|
||||
|
|
|
@ -16,8 +16,8 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
@ -42,6 +42,23 @@ public class JarConfigService {
|
|||
return jarConfigMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public List<JarConfig> searchList(JarConfig jarConfig) {
|
||||
JarConfigExample nameExample = new JarConfigExample();
|
||||
JarConfigExample jarExample = new JarConfigExample();
|
||||
if (StringUtils.isNotBlank(jarConfig.getName())) {
|
||||
nameExample.createCriteria().andNameLike("%" + jarConfig.getName() + "%");
|
||||
jarExample.createCriteria().andFileNameLike("%" + jarConfig.getName() + "%");
|
||||
} // 根据jar包的文件名和自定义名称查找
|
||||
nameExample.setOrderByClause("update_time desc");
|
||||
jarExample.setOrderByClause("update_time desc");
|
||||
List<JarConfig> jarConfigList = jarConfigMapper.selectByExample(jarExample);
|
||||
// 合并两个查找结果并去重,按时间降序
|
||||
jarConfigList.addAll(jarConfigMapper.selectByExample(nameExample));
|
||||
jarConfigList = jarConfigList.stream().distinct().collect(Collectors.toList());
|
||||
Collections.sort(jarConfigList, Comparator.comparing(JarConfig::getUpdateTime).reversed());
|
||||
return jarConfigList;
|
||||
}
|
||||
|
||||
public JarConfig get(String id) {
|
||||
return jarConfigMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<el-dialog width="50%" :close-on-click-modal="false" :title="$t('api_test.jar_config.title')" :visible.sync="visible" class="jar-import" @close="close">
|
||||
<div v-loading="result.loading">
|
||||
<ms-jar-config-from :config="currentConfig" :callback="saveConfig" ref="jarConfigFrom" :read-only="isReadOnly"/>
|
||||
<ms-jar-search-bar @refresh="getJarConfigs" :table-data="configs" ref="jarSearchBar"/>
|
||||
<ms-jar-config-list @refresh="getJarConfigs" v-if="configs.length > 0" @rowSelect="rowSelect" :table-data="configs" ref="jarConfigList"/>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
@ -12,9 +13,10 @@
|
|||
import {listenGoBack, removeGoBackListener} from "../../../../../../common/js/utils";
|
||||
import MsJarConfigList from "./JarConfigList";
|
||||
import MsJarConfigFrom from "./JarConfigFrom";
|
||||
import MsJarSearchBar from "./JarSearchBar";
|
||||
export default {
|
||||
name: "MsJarConfig",
|
||||
components: {MsJarConfigFrom, MsJarConfigList, MsDialogFooter},
|
||||
components: {MsJarConfigFrom, MsJarSearchBar, MsJarConfigList, MsDialogFooter},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
|
@ -52,11 +54,11 @@
|
|||
this.getJarConfigs();
|
||||
});
|
||||
},
|
||||
getJarConfigs() {
|
||||
this.result = this.$get("/jar/list/all", response => {
|
||||
this.configs = response.data;
|
||||
this.currentConfig = {};
|
||||
})
|
||||
getJarConfigs(condition) {
|
||||
this.result = this.$post("/jar/list", {name: condition}, response => {
|
||||
this.configs = response.data;
|
||||
this.currentConfig = {};
|
||||
});
|
||||
},
|
||||
rowSelect(config) {
|
||||
this.currentConfig = config;
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<template>
|
||||
<el-input class="jar-header-search"
|
||||
v-model="searchCondition"
|
||||
type="text"
|
||||
size="small"
|
||||
prefix-icon="el-icon-search"
|
||||
@keyup.enter.native="search"
|
||||
:placeholder="$t('project.search_by_name_jar')" clearable/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "MsJarSearchBar",
|
||||
props: {
|
||||
condition: {
|
||||
type: Object,
|
||||
default() {
|
||||
return undefined
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
searchCondition: this.condition
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
inputCondition(value) {
|
||||
this.searchCondition = value;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.$emit('refresh', this.searchCondition);
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.jar-header-search {
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
min-width: 100px;
|
||||
max-width: 250px;
|
||||
}
|
||||
</style>
|
|
@ -314,6 +314,7 @@ export default {
|
|||
delete_confirm: 'Deleting this project will delete all test resources under this project. Are you sure you want to delete?',
|
||||
delete_tip: 'Deleting this project will delete all test resources under this project. Are you sure you want to delete?',
|
||||
search_by_name: 'Search by name',
|
||||
search_by_name_jar: 'Search by name/jar',
|
||||
input_name: 'Please enter a workspace name',
|
||||
owning_workspace: 'Owning Workspace',
|
||||
please_choose_workspace: 'Please select Workspace',
|
||||
|
|
|
@ -312,6 +312,7 @@ export default {
|
|||
delete_confirm: '确定要删除这个项目吗?',
|
||||
delete_tip: '删除该项目,会删除该项目下所有测试资源,确定要删除吗?',
|
||||
search_by_name: '根据名称搜索',
|
||||
search_by_name_jar: '根据 名称 / jar包 搜索',
|
||||
input_name: '请输入项目名称',
|
||||
owning_workspace: '所属工作空间',
|
||||
please_choose_workspace: '请选择工作空间',
|
||||
|
|
|
@ -312,6 +312,7 @@ export default {
|
|||
delete_confirm: '確定要刪除這個項目嗎?',
|
||||
delete_tip: '刪除該項目,會刪除該項目下所有測試資源,確定要刪除嗎?',
|
||||
search_by_name: '根據名稱搜索',
|
||||
search_by_name_jar: '根據名稱/jar包搜索',
|
||||
input_name: '請輸入項目名稱',
|
||||
owning_workspace: '所屬工作空間',
|
||||
please_choose_workspace: '請選擇工作空間',
|
||||
|
|
Loading…
Reference in New Issue