Merge branch 'v1.6' of https://github.com/metersphere/metersphere into v1.6
This commit is contained in:
commit
7f52b22864
|
@ -59,4 +59,10 @@ public class ApiModuleController {
|
|||
public void dragNode(@RequestBody DragModuleRequest node) {
|
||||
apiModuleService.dragNode(node);
|
||||
}
|
||||
|
||||
@PostMapping("/pos")
|
||||
public void treeSort(@RequestBody List<String> ids) {
|
||||
apiModuleService.sort(ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.controller;
|
||||
|
||||
import io.metersphere.api.dto.ApiMonitorRequest;
|
||||
import io.metersphere.api.dto.ApiMonitorSearch;
|
||||
import io.metersphere.api.dto.ApiResponseCodeMonitor;
|
||||
import io.metersphere.api.dto.ApiResponseTimeMonitor;
|
||||
|
@ -32,24 +33,24 @@ public class ApiMonitorController {
|
|||
/**
|
||||
* 查询响应时间
|
||||
*/
|
||||
@GetMapping("/getResponseTime")
|
||||
public List<ApiResponseTimeMonitor> responseTimeData(@RequestHeader("apiUrl") String url, String startTime, String endTime) {
|
||||
return apiMonitorService.getApiResponseTimeData(url, startTime, endTime);
|
||||
@PostMapping("/getResponseTime")
|
||||
public List<ApiResponseTimeMonitor> responseTimeData(@RequestBody ApiMonitorRequest request) {
|
||||
return apiMonitorService.getApiResponseTimeData(request.getUrl(), request.getStartTime(), request.getEndTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询状态码
|
||||
*/
|
||||
@GetMapping("/getResponseCode")
|
||||
public List<ApiResponseCodeMonitor> responseCodeData(@RequestHeader("apiUrl") String url, String startTime, String endTime) {
|
||||
return apiMonitorService.getApiResponseCodeData(url, startTime, endTime);
|
||||
@PostMapping("/getResponseCode")
|
||||
public List<ApiResponseCodeMonitor> responseCodeData(@RequestBody ApiMonitorRequest request) {
|
||||
return apiMonitorService.getApiResponseCodeData(request.getUrl(), request.getStartTime(), request.getEndTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询reportId
|
||||
*/
|
||||
@GetMapping("/getReportId")
|
||||
public String searchReportId(@RequestHeader("apiUrl") String url, @RequestParam("startTime") String startTime) {
|
||||
return apiMonitorService.getReportId(url, startTime);
|
||||
@PostMapping("/getReportId")
|
||||
public String searchReportId(@RequestBody ApiMonitorRequest request) {
|
||||
return apiMonitorService.getReportId(request.getUrl(), request.getStartTime());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,4 +59,10 @@ public class ApiScenarioModuleController {
|
|||
public void dragNode(@RequestBody DragApiScenarioModuleRequest node) {
|
||||
apiScenarioModuleService.dragNode(node);
|
||||
}
|
||||
|
||||
@PostMapping("/pos")
|
||||
public void treeSort(@RequestBody List<String> ids) {
|
||||
apiScenarioModuleService.sort(ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package io.metersphere.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiMonitorRequest {
|
||||
|
||||
private String url;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.api.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.api.dto.definition.ApiDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.ApiDefinitionResult;
|
||||
import io.metersphere.api.dto.definition.ApiModuleDTO;
|
||||
|
@ -12,11 +13,9 @@ import io.metersphere.base.mapper.ext.ExtApiDefinitionMapper;
|
|||
import io.metersphere.base.mapper.ext.ExtApiModuleMapper;
|
||||
import io.metersphere.commons.constants.TestCaseConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.service.NodeTreeService;
|
||||
import io.metersphere.service.ProjectService;
|
||||
import io.metersphere.track.dto.TestCaseNodeDTO;
|
||||
import io.metersphere.track.service.TestPlanApiCaseService;
|
||||
import io.metersphere.track.service.TestPlanProjectService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -148,7 +147,19 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
|||
|
||||
private void checkApiModuleExist(ApiModule node) {
|
||||
if (node.getName() != null) {
|
||||
if (selectSameModule(node).size() > 0) {
|
||||
ApiModuleExample example = new ApiModuleExample();
|
||||
ApiModuleExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andNameEqualTo(node.getName())
|
||||
.andProjectIdEqualTo(node.getProjectId());
|
||||
if (StringUtils.isNotBlank(node.getParentId())) {
|
||||
criteria.andParentIdEqualTo(node.getParentId());
|
||||
} else {
|
||||
criteria.andParentIdIsNull();
|
||||
}
|
||||
if (StringUtils.isNotBlank(node.getId())) {
|
||||
criteria.andIdNotEqualTo(node.getId());
|
||||
}
|
||||
if (apiModuleMapper.selectByExample(example).size() > 0) {
|
||||
MSException.throwException(Translator.get("test_case_module_already_exists") + ": " + node.getName());
|
||||
}
|
||||
}
|
||||
|
@ -216,6 +227,18 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
|||
sqlSession.flushStatements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiModuleDTO getNode(String id) {
|
||||
ApiModule module = apiModuleMapper.selectByPrimaryKey(id);
|
||||
ApiModuleDTO dto = JSON.parseObject(JSON.toJSONString(module), ApiModuleDTO.class);
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePos(String id, Double pos) {
|
||||
extApiModuleMapper.updatePos(id, pos);
|
||||
}
|
||||
|
||||
public void dragNode(DragModuleRequest request) {
|
||||
|
||||
checkApiModuleExist(request);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.api.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioDTO;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioModuleDTO;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||
|
@ -17,7 +18,6 @@ import io.metersphere.service.NodeTreeService;
|
|||
import io.metersphere.service.ProjectService;
|
||||
import io.metersphere.track.service.TestPlanProjectService;
|
||||
import io.metersphere.track.service.TestPlanScenarioCaseService;
|
||||
import io.metersphere.track.service.TestPlanTestCaseService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
|
@ -186,6 +186,18 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
|
|||
sqlSession.flushStatements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiScenarioModuleDTO getNode(String id) {
|
||||
ApiScenarioModule module = apiScenarioModuleMapper.selectByPrimaryKey(id);
|
||||
ApiScenarioModuleDTO dto = JSON.parseObject(JSON.toJSONString(module), ApiScenarioModuleDTO.class);
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePos(String id, Double pos) {
|
||||
extApiScenarioModuleMapper.updatePos(id, pos);
|
||||
}
|
||||
|
||||
public void dragNode(DragApiScenarioModuleRequest request) {
|
||||
|
||||
checkApiScenarioModuleExist(request);
|
||||
|
|
|
@ -8,5 +8,8 @@ import java.util.List;
|
|||
|
||||
public interface ExtApiModuleMapper {
|
||||
int insertBatch(@Param("records") List<ApiModule> records);
|
||||
|
||||
List<ApiModuleDTO> getNodeTreeByProjectId(@Param("projectId") String projectId, @Param("protocol") String protocol);
|
||||
|
||||
void updatePos(String id, Double pos);
|
||||
}
|
|
@ -19,6 +19,10 @@
|
|||
from api_module
|
||||
where api_module.project_id = #{projectId}
|
||||
and api_module.protocol = #{protocol}
|
||||
order by create_time asc
|
||||
order by api_module.pos asc
|
||||
</select>
|
||||
|
||||
<update id="updatePos">
|
||||
update api_module set pos = #{pos} where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
|
@ -7,4 +7,6 @@ import java.util.List;
|
|||
|
||||
public interface ExtApiScenarioModuleMapper {
|
||||
List<ApiScenarioModuleDTO> getNodeTreeByProjectId(@Param("projectId") String projectId);
|
||||
|
||||
void updatePos(String id, Double pos);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
<include refid="io.metersphere.base.mapper.ApiScenarioModuleMapper.Base_Column_List"/>
|
||||
from api_scenario_module
|
||||
where api_scenario_module.project_id = #{projectId}
|
||||
order by create_time asc
|
||||
order by api_scenario_module.pos asc
|
||||
</select>
|
||||
|
||||
<update id="updatePos">
|
||||
update api_scenario_module set pos = #{pos} where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
|
@ -1 +1 @@
|
|||
Subproject commit 79343a2763b014355f91fc21b2356a95ae437973
|
||||
Subproject commit f27d1609d77f7d6c988d37d709466e844d350e17
|
|
@ -0,0 +1,3 @@
|
|||
set @rownum=0;
|
||||
update api_module set pos=(select @rownum := @rownum +1) where pos is null;
|
||||
update api_scenario_module set pos=(select @rownum := @rownum +1) where pos is null;
|
|
@ -48,6 +48,7 @@ related_case_del_fail_prefix=Connected to
|
|||
related_case_del_fail_suffix=TestCase, please disassociate first
|
||||
jmx_content_valid=JMX content is invalid
|
||||
container_delete_fail=The container failed to stop, please try again
|
||||
load_test_report_file_not_exist=There is no JTL file in the current report, please wait or execute it again to get it
|
||||
#workspace
|
||||
workspace_name_is_null=Workspace name cannot be null
|
||||
workspace_name_already_exists=The workspace name already exists
|
||||
|
|
|
@ -48,6 +48,7 @@ related_case_del_fail_prefix=已关联到
|
|||
related_case_del_fail_suffix=测试用例,请先解除关联
|
||||
jmx_content_valid=JMX 内容无效,请检查
|
||||
container_delete_fail=容器由于网络原因停止失败,请重试
|
||||
load_test_report_file_not_exist=当前报告没有JTL文件,请等待或重新执行以便获取
|
||||
#workspace
|
||||
workspace_name_is_null=工作空间名不能为空
|
||||
workspace_name_already_exists=工作空间名已存在
|
||||
|
|
|
@ -48,6 +48,7 @@ related_case_del_fail_prefix=已關聯到
|
|||
related_case_del_fail_suffix=測試用例,請先解除關聯
|
||||
jmx_content_valid=JMX 內容無效,請檢查
|
||||
container_delete_fail=容器由於網絡原因停止失敗,請重試
|
||||
load_test_report_file_not_exist=當前報告沒有JTL文件,請等待或重新執行以便獲取
|
||||
#workspace
|
||||
workspace_name_is_null=工作空間名不能為空
|
||||
workspace_name_already_exists=工作空間名已存在
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
type="selection"/>
|
||||
<el-table-column width="40" :resizable="false" align="center">
|
||||
<template v-slot:default="scope">
|
||||
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
|
||||
<show-more-btn v-tester :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.name')" width="200" show-overflow-tooltip prop="name">
|
||||
|
|
|
@ -154,8 +154,9 @@
|
|||
},
|
||||
drag(param, list) {
|
||||
this.$post("/api/automation/module/drag", param, () => {
|
||||
// this.$post("/api/module/pos", list); //todo 排序
|
||||
this.$post("/api/automation/module/pos", list, () => {
|
||||
this.list();
|
||||
});
|
||||
}, (error) => {
|
||||
this.list();
|
||||
});
|
||||
|
|
|
@ -160,8 +160,9 @@
|
|||
},
|
||||
drag(param, list) {
|
||||
this.$post("/api/module/drag", param, () => {
|
||||
// this.$post("/api/module/pos", list); //todo 排序
|
||||
this.$post("/api/module/pos", list, () => {
|
||||
this.list();
|
||||
});
|
||||
}, (error) => {
|
||||
this.list();
|
||||
});
|
||||
|
|
|
@ -80,9 +80,8 @@ export default {
|
|||
this.getResponseCode(this.apiUrl, today1, today2);
|
||||
},
|
||||
getResponseTime(apiUrl, startTime, endTime) {
|
||||
return this.$$get('/api/monitor/getResponseTime',
|
||||
{'startTime': startTime, 'endTime': endTime},
|
||||
{'apiUrl': apiUrl}, response => {
|
||||
return this.$post('/api/monitor/getResponseTime',
|
||||
{'startTime': startTime, 'endTime': endTime, 'apiUrl': apiUrl}, response => {
|
||||
Object.values(response.data).forEach(value => {
|
||||
this.rspTimexAxis.push(value.startTime);
|
||||
this.rspTimeData.push(value.responseTime);
|
||||
|
@ -90,9 +89,8 @@ export default {
|
|||
});
|
||||
},
|
||||
getResponseCode(apiUrl, startTime, endTime) {
|
||||
return this.$$get('/api/monitor/getResponseCode',
|
||||
{'startTime': startTime, 'endTime': endTime},
|
||||
{'apiUrl': this.apiUrl}, response => {
|
||||
return this.$post('/api/monitor/getResponseCode',
|
||||
{'startTime': startTime, 'endTime': endTime, 'apiUrl': this.apiUrl}, response => {
|
||||
Object.values(response.data).forEach(value => {
|
||||
this.rspCodexAxis.push(value.startTime);
|
||||
this.rspCodeData.push(value.responseCode);
|
||||
|
|
|
@ -28,9 +28,7 @@ export default {
|
|||
methods: {
|
||||
click(params) {
|
||||
let startTime = params.name;
|
||||
this.result = this.$$get('/api/monitor/getReportId', {'startTime': startTime}, {
|
||||
'apiUrl': this.apiUrl
|
||||
}, response => {
|
||||
this.result = this.$post('/api/monitor/getReportId', {'startTime': startTime, 'apiUrl': this.apiUrl}, response => {
|
||||
this.reportId = response.data;
|
||||
let reportId = this.reportId
|
||||
let url = '#/api/report/view/' + reportId;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
type="selection"/>
|
||||
<el-table-column width="40" :resizable="false" align="center">
|
||||
<template v-slot:default="scope">
|
||||
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
|
||||
<show-more-btn v-tester :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.name')" width="200" show-overflow-tooltip prop="name">
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
<el-tab-pane :label="$t('api_test.request.extract.label')" name="label" class="pane">
|
||||
<pre>{{response.vars}}</pre>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('api_test.definition.request.console')" name="console" class="pane">
|
||||
<pre>{{response.console}}</pre>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions">
|
||||
<template v-slot:label>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
type="selection"/>
|
||||
<el-table-column width="40" :resizable="false" align="center">
|
||||
<template v-slot:default="scope">
|
||||
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
|
||||
<show-more-btn v-tester :is-show="scope.row.showMore" :buttons="buttons" :size="selectRows.size"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8cda5c873cd9985c97adb34efacf507167fa4182
|
||||
Subproject commit 7d43154a7c19732407a8e9ace8a7d1ea13c91f36
|
|
@ -74,20 +74,6 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
Vue.prototype.$$get = function (url, data, header, success) {
|
||||
let result = {loading: true};
|
||||
if (!success) {
|
||||
return axios.get(url, {params: data, headers: header});
|
||||
} else {
|
||||
axios.get(url, {params: data, headers: header}).then(response => {
|
||||
then(success, response, result);
|
||||
}).catch(error => {
|
||||
exception(error, result, url);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
Vue.prototype.$get = function (url, success) {
|
||||
let result = {loading: true};
|
||||
if (!success) {
|
||||
|
|
Loading…
Reference in New Issue