fix(接口定义): 修复只有case时,不会弹窗提示同步信息

--bug=1018729 --user=王孝刚
【接口测试】接口定义-创建新版本接口只有CASE,没有备注/依赖关系/MOCK时,不会弹框提示是否勾选同步信息
https://www.tapd.cn/55049933/s/1275021
This commit is contained in:
wxg0103 2022-10-24 18:20:16 +08:00 committed by wxg0103
parent 0b0c1fbcbd
commit fee74cc65d
9 changed files with 103 additions and 53 deletions

View File

@ -100,4 +100,6 @@ public interface ExtApiTestCaseMapper {
List<ApiTestCaseDTO> relevanceApiList(@Param("request") ApiTestCaseRequest request);
List<BaseCase> selectBaseCaseByProjectId(@Param("projectId") String projectId);
int getCaseCountById(String id);
}

View File

@ -1220,4 +1220,14 @@
GROUP BY ${apiCaseGroupColumn}
</if>
</select>
<select id="getCaseCountById" resultType="java.lang.Integer">
select
count(id) AS countNum
FROM api_test_case
<where>
( `status` != 'Trash' OR `status` IS NULL)
AND api_definition_id = #{apiId}
</where>
</select>
</mapper>

View File

@ -266,4 +266,9 @@ public class ApiTestCaseController {
public List<JmxInfoDTO> getScenarioCaseByIds(@RequestBody ApiCaseExportJmxRequest request) {
return apiTestCaseService.exportJmx(request.getCaseIds(), request.getEnvId());
}
@PostMapping("/case-count")
public int getCaseCountById(@RequestBody SaveApiTestCaseRequest request) {
return apiTestCaseService.getCaseCountById(request.getId());
}
}

View File

@ -1233,4 +1233,8 @@ public class ApiTestCaseService {
jmxInfoDTO.setName(apiTestCase.getName());
return jmxInfoDTO;
}
public int getCaseCountById(String id) {
return extApiTestCaseMapper.getCaseCountById(id);
}
}

View File

@ -81,3 +81,7 @@ export function createApiCase(file, files, params) {
export function editApiCase(url, file, files, params) {
return fileUpload(url, file, files, params);
}
export function apiTestCaseCount(param) {
return post('/api/testcase/case-count',param);
}

View File

@ -96,6 +96,7 @@ import {createComponent} from ".././jmeter/components";
import {TYPE_TO_C} from "@/business/automation/scenario/Setting";
import MsDialogFooter from "metersphere-frontend/src/components/MsDialogFooter";
import {useApiStore} from "@/store";
import {apiTestCaseCount} from "@/api/api-test-case";
const store = useApiStore();
const {Body} = require("@/business/definition/model/ApiTestModel");
@ -345,6 +346,10 @@ export default {
//
this.basisData.versionId = row.id;
this.basisData.versionName = row.name;
apiTestCaseCount({id: this.basisData.id}).then(response => {
if (response.data > 0) {
this.basisData.caseTotal = response.data;
}
this.$set(this.basisData, 'newVersionRemark', !!this.basisData.remark);
this.$set(this.basisData, 'newVersionDeps', this.$refs.apiOtherInfo.relationshipCount > 0);
this.$set(this.basisData, 'newVersionCase', this.basisData.caseTotal > 0);
@ -357,6 +362,7 @@ export default {
this.$refs.versionHistory.loading = false;
}
}
});
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {

View File

@ -210,6 +210,7 @@ import {
getMockEnvironment,
updateDefinitionFollows
} from "@/api/definition";
import {apiTestCaseCount} from "@/api/api-test-case";
import {relationGet, updateRuleRelation} from "@/api/xpack";
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import MsResponseText from "../response/ResponseText";
@ -787,6 +788,10 @@ export default {
//
this.httpForm.versionId = row.id;
this.httpForm.versionName = row.name;
apiTestCaseCount({id: this.httpForm.id}).then(response => {
if (response.data > 0) {
this.httpForm.caseTotal = response.data;
}
this.$set(this.httpForm, 'newVersionRemark', !!this.httpForm.remark);
this.$set(this.httpForm, 'newVersionDeps', this.$refs.apiOtherInfo.relationshipCount > 0);
this.$set(this.httpForm, 'newVersionCase', this.httpForm.caseTotal > 0);
@ -807,6 +812,7 @@ export default {
this.$refs.versionHistory.loading = false;
}
});
});
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {

View File

@ -82,7 +82,8 @@
import {
definitionFollow,
delDefinitionByRefId,
getDefinitionById, getDefinitionByIdAndRefId,
getDefinitionById,
getDefinitionByIdAndRefId,
getDefinitionVersions,
updateDefinitionFollows
} from "@/api/definition";
@ -97,6 +98,7 @@ import {createComponent} from ".././jmeter/components";
import {TYPE_TO_C} from "@/business/automation/scenario/Setting";
import MsDialogFooter from "metersphere-frontend/src/components/MsDialogFooter";
import {useApiStore} from "@/store";
import {apiTestCaseCount} from "@/api/api-test-case";
const store = useApiStore();
const {Body} = require("@/business/definition/model/ApiTestModel");
@ -358,6 +360,10 @@ export default {
//
this.basisData.versionId = row.id;
this.basisData.versionName = row.name;
apiTestCaseCount({id: this.basisData.id}).then(response => {
if (response.data > 0) {
this.basisData.caseTotal = response.data;
}
this.$set(this.basisData, 'newVersionRemark', !!this.basisData.remark);
this.$set(this.basisData, 'newVersionDeps', this.$refs.apiOtherInfo.relationshipCount > 0);
this.$set(this.basisData, 'newVersionCase', this.basisData.caseTotal > 0);
@ -370,6 +376,7 @@ export default {
this.$refs.versionHistory.loading = false;
}
}
});
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {

View File

@ -114,6 +114,7 @@ import {createComponent} from ".././jmeter/components";
import {TYPE_TO_C} from "@/business/automation/scenario/Setting";
import MsDialogFooter from "metersphere-frontend/src/components/MsDialogFooter";
import {useApiStore} from "@/store";
import {apiTestCaseCount} from "@/api/api-test-case";
const store = useApiStore();
const {Body} = require("@/business/definition/model/ApiTestModel");
@ -460,6 +461,10 @@ export default {
//
this.basisData.versionId = row.id;
this.basisData.versionName = row.name;
apiTestCaseCount({id: this.basisData.id}).then(response => {
if (response.data > 0) {
this.basisData.caseTotal = response.data;
}
this.$set(this.basisData, 'newVersionRemark', !!this.basisData.remark);
this.$set(this.basisData, 'newVersionDeps', this.$refs.apiOtherInfo.relationshipCount > 0);
this.$set(this.basisData, 'newVersionCase', this.basisData.caseTotal > 0);
@ -477,6 +482,7 @@ export default {
}
}
});
});
},
del(row) {
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {