feat(接口测试): 资源按照项目查询
This commit is contained in:
parent
54f5e8aad5
commit
f399ba2885
|
@ -17,6 +17,7 @@ import io.metersphere.commons.constants.ReportTriggerMode;
|
|||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.dto.DashboardTestDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -48,11 +49,13 @@ public class APIReportService {
|
|||
|
||||
public List<APIReportResult> list(QueryAPIReportRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
return extApiTestReportMapper.list(request);
|
||||
}
|
||||
|
||||
public List<APIReportResult> recentTest(QueryAPIReportRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
return extApiTestReportMapper.list(request);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.api.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.client.utils.StringUtils;
|
||||
import io.github.ningyu.jmeter.plugin.dubbo.sample.ProviderService;
|
||||
import io.metersphere.api.dto.*;
|
||||
import io.metersphere.api.dto.parse.ApiImport;
|
||||
|
@ -67,11 +68,13 @@ public class APITestService {
|
|||
|
||||
public List<APITestResult> list(QueryAPITestRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
return extApiTestMapper.list(request);
|
||||
}
|
||||
|
||||
public List<APITestResult> recentTest(QueryAPITestRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
return extApiTestMapper.list(request);
|
||||
}
|
||||
|
||||
|
@ -402,7 +405,11 @@ public class APITestService {
|
|||
.collect(Collectors.toList());
|
||||
if (!resourceIds.isEmpty()) {
|
||||
ApiTestExample example = new ApiTestExample();
|
||||
example.createCriteria().andIdIn(resourceIds);
|
||||
ApiTestExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andIdIn(resourceIds);
|
||||
if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) {
|
||||
criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId());
|
||||
}
|
||||
List<ApiTest> apiTests = apiTestMapper.selectByExample(example);
|
||||
Map<String, String> apiTestMap = apiTests.stream().collect(Collectors.toMap(ApiTest::getId, ApiTest::getName));
|
||||
scheduleService.build(apiTestMap, schedules);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit bb494fc68a2367359c9048fa7250c7618de4afb6
|
||||
Subproject commit 905ca8af61ce966d26109e9c5c8c0aee3ca1324e
|
|
@ -110,11 +110,11 @@ export default {
|
|||
apiTestProjectPath: '',
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$route'(to) {
|
||||
this.init();
|
||||
},
|
||||
},
|
||||
// watch: {
|
||||
// '$route'(to) {
|
||||
// this.init();
|
||||
// },
|
||||
// },
|
||||
methods: {
|
||||
registerEvents() {
|
||||
ApiEvent.$on(LIST_CHANGE, () => {
|
||||
|
@ -133,18 +133,17 @@ export default {
|
|||
this.isRouterAlive = true;
|
||||
});
|
||||
},
|
||||
init() {
|
||||
let path = this.$route.path;
|
||||
if (path.indexOf("/api/test/list") >= 0 && !!this.$route.params.projectId) {
|
||||
this.apiTestProjectPath = path;
|
||||
//不激活项目菜单栏
|
||||
this.isProjectActivation = false;
|
||||
this.reload();
|
||||
} else {
|
||||
this.isProjectActivation = true;
|
||||
}
|
||||
|
||||
},
|
||||
// init() {
|
||||
// let path = this.$route.path;
|
||||
// if (path.indexOf("/api/test/list") >= 0 && !!this.$route.params.projectId) {
|
||||
// this.apiTestProjectPath = path;
|
||||
// //不激活项目菜单栏
|
||||
// this.isProjectActivation = false;
|
||||
// this.reload();
|
||||
// } else {
|
||||
// this.isProjectActivation = true;
|
||||
// }
|
||||
// },
|
||||
},
|
||||
mounted() {
|
||||
this.registerEvents();
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
<div v-else style="height: 120px;overflow: auto">
|
||||
<el-menu-item :key="i.id" v-for="i in items" @click="change(i.id)">
|
||||
<template slot="title">
|
||||
<div class="title">{{ i.name }}</div>
|
||||
<div class="title">
|
||||
{{ i.name }}
|
||||
<i class="el-icon-check" v-if="i.id === projectId"></i>
|
||||
</div>
|
||||
</template>
|
||||
</el-menu-item>
|
||||
</div>
|
||||
|
@ -40,6 +43,7 @@ export default {
|
|||
items: [],
|
||||
search_text: '',
|
||||
userId: getCurrentUser().id,
|
||||
projectId: localStorage.getItem(PROJECT_ID)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -97,4 +101,9 @@ export default {
|
|||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.el-icon-check {
|
||||
color: #773888;
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a
|
||||
Subproject commit 29a8fc09602fde5708af06582ac972d98eb69836
|
Loading…
Reference in New Issue