This commit is contained in:
liqiang-fit2cloud 2022-12-23 18:05:33 +08:00
commit 1a31d5ef78
24 changed files with 100 additions and 28 deletions

View File

@ -8,7 +8,6 @@ import io.metersphere.service.definition.ApiDefinitionService;
import io.metersphere.base.domain.SwaggerUrlProject;
import io.metersphere.commons.constants.ScheduleGroup;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.JSON;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;

View File

@ -3,6 +3,7 @@
<div v-for="pe in data" :key="pe.id" style="margin-left: 20px">
<el-select
v-model="pe['selectEnv']"
filterable
:placeholder="$t('workspace.env_group.please_select_env')"
style="margin-top: 8px; width: 200px"
size="small">

View File

@ -40,6 +40,7 @@
:placeholder="$t('api_test.environment.select_environment')"
style="margin-top: 8px; width: 100%"
size="small"
filterable
@change="chooseEnv">
<el-option
v-for="(environment, index) in pe.envs"

View File

@ -7,6 +7,7 @@
class="environment-select"
:placeholder="$t('api_test.definition.request.run_env')"
clearable
filterable
@clear="clear">
<el-option
v-for="(environment, key) in environments"

View File

@ -566,43 +566,69 @@ export default {
if (this.httpForm.path !== this.beforeHttpForm.path && !this.noShowSyncRuleRelation) {
this.batchSyncApiVisible = true;
}
if (this.request.headers && this.beforeRequest.headers) {
let submitRequestHeaders = JSON.stringify(this.request.headers);
if (this.httpForm.request.headers && this.beforeRequest.headers) {
for (let i = 0; i < this.httpForm.request.headers.length; i++) {
if (this.httpForm.request.headers[i].isEdit !== undefined) {
this.beforeRequest.headers[i].isEdit = this.httpForm.request.headers[i].isEdit
}
}
let submitRequestHeaders = JSON.stringify(this.httpForm.request.headers);
let beforeRequestHeaders = JSON.stringify(this.beforeRequest.headers);
if (submitRequestHeaders !== beforeRequestHeaders && !this.noShowSyncRuleRelation) {
this.batchSyncApiVisible = true;
}
}
if (this.request.arguments && this.beforeRequest.arguments) {
let submitRequestQuery = JSON.stringify(this.request.arguments);
if (this.httpForm.request.arguments && this.beforeRequest.arguments) {
for (let i = 0; i < this.httpForm.request.arguments.length; i++) {
if (this.httpForm.request.arguments[i].isEdit !== undefined) {
this.beforeRequest.arguments[i].isEdit = this.httpForm.request.arguments[i].isEdit
}
}
let submitRequestQuery = JSON.stringify(this.httpForm.request.arguments);
let beforeRequestQuery = JSON.stringify(this.beforeRequest.arguments);
if (submitRequestQuery !== beforeRequestQuery && !this.noShowSyncRuleRelation) {
this.batchSyncApiVisible = true;
}
}
if (this.request.rest && this.beforeRequest.rest) {
let submitRequestRest = JSON.stringify(this.request.rest);
if (this.httpForm.request.rest && this.beforeRequest.rest) {
for (let i = 0; i < this.httpForm.request.rest.length; i++) {
if (this.httpForm.request.rest[i].isEdit !== undefined) {
this.beforeRequest.rest[i].isEdit = this.httpForm.request.rest[i].isEdit
}
}
let submitRequestRest = JSON.stringify(this.httpForm.request.rest);
let beforeRequestRest = JSON.stringify(this.beforeRequest.rest);
if (submitRequestRest !== beforeRequestRest && !this.noShowSyncRuleRelation) {
this.batchSyncApiVisible = true;
}
}
if (this.request.body && this.beforeRequest.body) {
let submitRequestBody = JSON.stringify(this.request.body);
if (this.httpForm.request.body && this.beforeRequest.body) {
let submitRequestBody = JSON.stringify(this.httpForm.request.body);
let beforeRequestBody = JSON.stringify(this.beforeRequest.body);
for (let i = 0; i < this.httpForm.request.body.kvs.length; i++) {
if (this.httpForm.request.body.kvs[i].isEdit !== undefined) {
this.beforeRequest.body.kvs[i].isEdit = this.httpForm.request.body.kvs[i].isEdit
}
if (this.httpForm.request.body.kvs[i].files !== null && this.httpForm.request.body.kvs[i].files.length === 0) {
this.beforeRequest.body.kvs[i].files = this.httpForm.request.body.kvs[i].files
}
if (this.httpForm.request.body.kvs[i].uuid) {
this.beforeRequest.body.kvs[i].uuid = this.httpForm.request.body.kvs[i].uuid
}
}
if (submitRequestBody !== beforeRequestBody && !this.noShowSyncRuleRelation) {
this.batchSyncApiVisible = true;
}
}
if (this.request.authManager && this.beforeRequest.authManager) {
let submitRequestAuthManager = JSON.stringify(this.request.authManager);
if (this.httpForm.request.authManager && this.beforeRequest.authManager) {
let submitRequestAuthManager = JSON.stringify(this.httpForm.request.authManager);
let beforeRequestAuthManager = JSON.stringify(this.beforeRequest.authManager);
if (submitRequestAuthManager !== beforeRequestAuthManager && !this.noShowSyncRuleRelation) {
this.batchSyncApiVisible = true;
}
}
if (this.request.hashTree && this.beforeRequest.hashTree) {
let submitRequestHashTree = JSON.stringify(this.request.hashTree);
if (this.httpForm.request.hashTree && this.beforeRequest.hashTree) {
let submitRequestHashTree = JSON.stringify(this.httpForm.request.hashTree);
let beforeRequestHashTree = JSON.stringify(this.beforeRequest.hashTree);
if (submitRequestHashTree !== beforeRequestHashTree && !this.noShowSyncRuleRelation) {
this.batchSyncApiVisible = true;
@ -782,6 +808,11 @@ export default {
} else {
this.versionData = response.data;
}
this.beforeHttpForm = this.versionData[0];
this.beforeRequest = JSON.parse(this.versionData[0].request);
this.beforeResponse = JSON.parse(this.versionData[0].response);
let latestVersionData = response.data.filter((v) => v.versionId === this.latestVersionId);
if (latestVersionData.length > 0) {
this.hasLatest = false
@ -1078,14 +1109,7 @@ export default {
this.getCitedScenarioCount();
this.getCaseCount();
}
},
mounted() {
if (hasLicense()) {
this.beforeHttpForm = deepClone(this.basisData);
this.beforeRequest = deepClone(this.request);
this.beforeResponse = deepClone(this.response);
}
},
}
};
</script>

View File

@ -5,6 +5,7 @@
size="small"
class="ms-htt-width"
:placeholder="$t('api_test.definition.request.run_env')"
filterable
@change="environmentChange"
clearable>
<el-option

View File

@ -1,6 +1,6 @@
<template>
<span>
<el-select :disabled="isReadOnly" v-model="environmentId" size="small" class="environment-select"
<el-select :disabled="isReadOnly" v-model="environmentId" size="small" class="environment-select" filterable
:placeholder="$t('api_test.definition.request.run_env')" clearable @clear="clear">
<el-option v-for="(environment, key) in environments" :key="key"
:label="environment.name"

View File

@ -1,6 +1,6 @@
<template>
<span>
<el-select :disabled="isReadOnly" v-model="environmentId" size="small" class="environment-select"
<el-select :disabled="isReadOnly" v-model="environmentId" size="small" class="environment-select" filterable
:placeholder="$t('api_test.definition.request.run_env')" clearable @clear="clear">
<el-option v-for="(environment, key) in environments" :key="key"
:label="environment.name"

View File

@ -509,6 +509,8 @@ const message = {
invalid: 'invalid',
count_warning: 'The number of system users has exceeded the license limit. Please contact the staff as soon as possible.',
expired: 'expired',
serial_num: 'serial number',
remark: 'remark',
},
workstation: {
sync: 'Synchronize',

View File

@ -513,6 +513,8 @@ const message = {
invalid: '无效',
count_warning: '系统用户数已超过license限制数量请尽快联系工作人员。',
expired: '已过期',
serial_num: '序列号',
remark: '备注',
},
workstation: {
sync: '同步',

View File

@ -512,6 +512,8 @@ const message = {
invalid: '無效',
count_warning: '系統用戶數已超過license限制數量請盡快聯繫工作人員。',
expired: '已過期',
serial_num: '序列號',
remark: '備註',
},
workstation: {
sync: '同步',

View File

@ -30,4 +30,12 @@ public class LicenseInfoDTO implements Serializable {
* 授权数量
*/
private int count;
/**
* 序列号
*/
private String serialNo;
/**
* 备注
*/
private String remark;
}

View File

@ -37,6 +37,14 @@
<th>{{ $t('license.count') }}</th>
<td>{{ license.count }}</td>
</tr>
<tr v-if="license.serialNo">
<th>{{ $t('license.serial_num') }}</th>
<td>{{ license.serialNo }}</td>
</tr>
<tr v-if="license.remark">
<th>{{ $t('license.remark') }}</th>
<td>{{ license.remark }}</td>
</tr>
<tr>
<th>{{ $t('license.status') }}</th>
<td>
@ -108,6 +116,8 @@ export default {
this.license.licenseVersion = value.license.licenseVersion;
this.license.licenseCount = value.license.licenseCount;
this.license.status = value.status;
this.license.serialNo = value.license.serialNo;
this.license.remark = value.license.remark;
saveLicense(value.status);
if (hasLicense()) {
getModuleList()

View File

@ -8,4 +8,6 @@ public interface ExtTestPlanReportContentMapper {
boolean isDynamicallyGenerateReport(@Param("reportId") String reportId);
TestPlanReportContentWithBLOBs selectForPassRate(@Param("reportId") String reportId);
boolean hasRunningReport(@Param("planId") String planId);
}

View File

@ -23,4 +23,9 @@
from test_plan_report_content
where test_plan_report_id = #{reportId}
</select>
<select id="hasRunningReport" resultType="java.lang.Boolean">
select count(1) > 0 from test_plan_report
where test_plan_id = #{planId} and status = 'RUNNING'
order by create_time desc limit 1;
</select>
</mapper>

View File

@ -136,6 +136,10 @@ public class TestPlanReportService {
return list;
}
public boolean hasRunningReport(String planId) {
return extTestPlanReportContentMapper.hasRunningReport(planId);
}
public void setTestPlanReportPassRate(List<TestPlanReportDTO> list) {
for (TestPlanReportDTO testPlanReportDTO : list) {
// 如果数据库查询成功率字段为空或 0 则重新计算一次

View File

@ -318,6 +318,10 @@ public class TestPlanService {
public int deleteTestPlan(String planId) {
if (testPlanReportService.hasRunningReport(planId)) {
MSException.throwException(Translator.get("test_plan_delete_exec_error"));
}
// 发送删除通知
try {
kafkaTemplate.send(KafkaTopicConstants.TEST_PLAN_DELETED_TOPIC, objectMapper.writeValueAsString(List.of(planId)));

View File

@ -226,3 +226,4 @@ jira_auth_url_error=The test connection failed, please check whether the Jira ad
platform_plugin_not_exit=Platform docking function has been plug-in, please download the corresponding version of the plug-in:
plan_warning=The test plan does not have an associated executable use case
test_plan_delete_exec_error=The test plan is being executed

View File

@ -198,3 +198,4 @@ jira_auth_url_error=测试连接失败请检查Jira地址是否正确
platform_plugin_not_exit=平台对接功能已插件化,请下载对应版本的插件:
plan_warning=测试计划没有关联可执行的用例
test_plan_delete_exec_error=测试计划正在执行中

View File

@ -199,3 +199,4 @@ jira_auth_url_error=測試連接失敗請檢查Jira地址是否正確
platform_plugin_not_exit=平臺對接功能已插件化,請下載對應版本的插件:
plan_warning=測試計劃沒有關聯可執行的用例
test_plan_delete_exec_error=測試計劃正在執行中

View File

@ -133,6 +133,7 @@ export default {
itemStyle: {
borderWidth: 0.1
},
inactiveBorderWidth: 0.1,
pageIcons: {
vertical: [
'path://M387.84 164.906667a22.122667 22.122667 0 0 0-0.362667-30.72 20.522667 20.522667 0 0 0-29.674666 0.362666L0 512.853333l357.802667 378.282667c8.042667 8.533333 21.290667 8.746667 29.674666 0.341333 8.32-8.32 8.533333-22.016 0.384-30.72L60.330667 512.853333 387.861333 164.906667z',

View File

@ -1,7 +1,7 @@
<template>
<div v-loading="result.loading">
<div v-for="pe in data" :key="pe.id" style="margin-left: 20px;">
<el-select v-model="pe['selectEnv']" :placeholder="$t('api_test.environment.select_environment')"
<el-select v-model="pe['selectEnv']" filterable :placeholder="$t('api_test.environment.select_environment')"
style="margin-top: 8px;width: 200px;" size="small">
<el-option v-for="(environment, index) in pe.envs" :key="index"
:label="environment.name"

View File

@ -18,7 +18,8 @@
</el-radio-group>
<el-tag v-show="!pe.showEnvSelect" v-for="(itemName,index) in selectedEnvName.get(pe.id)" :key="index" size="mini"
style="margin-left: 0; margin-right: 2px;margin-top: 8px">{{ itemName }}</el-tag>
<el-select v-show="pe.showEnvSelect" v-model="pe['selectEnv']" :placeholder="$t('api_test.environment.select_environment')"
<el-select v-show="pe.showEnvSelect" v-model="pe['selectEnv']" filterable
:placeholder="$t('api_test.environment.select_environment')"
style="margin-top: 8px;width: 100%;" size="small" @change="chooseEnv">
<el-option v-for="(environment, index) in pe.envs" :key="index"
:label="environment.name"

View File

@ -1,7 +1,8 @@
<template>
<div v-loading="result.loading">
<div v-for="pe in data" :key="pe.id" style="margin-left: 20px;">
<el-select v-model="pe['selectEnv']" :placeholder="$t('workspace.env_group.please_select_env')" style="margin-top: 8px;width: 200px;" size="small">
<el-select v-model="pe['selectEnv']" filterable :placeholder="$t('workspace.env_group.please_select_env')"
style="margin-top: 8px;width: 200px;" size="small">
<el-option v-for="(environment, index) in pe.envs" :key="index"
:label="environment.name"
:value="environment.id"/>