diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 218697305a..2b2005e50a 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -413,7 +413,9 @@ public class ApiAutomationService { http.setUrl(null); } else { ApiDefinition apiDefinition = apiDefinitionService.get(tr.getId()); - http.setUrl(apiDefinition.getPath()); + if (apiDefinition != null) { + http.setUrl(apiDefinition.getPath()); + } } if (http.isEnable()) { if (StringUtils.isBlank(http.getUrl()) || !tr.isURL(http.getUrl())) { @@ -424,10 +426,14 @@ public class ApiAutomationService { } else if (StringUtils.equals(tr.getType(), "JDBCSampler") || StringUtils.equals(tr.getType(), "TCPSampler")) { if (StringUtils.equals(tr.getRefType(), "CASE")) { ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = apiTestCaseService.get(tr.getId()); - env.getProjectIds().add(apiTestCaseWithBLOBs.getProjectId()); + if (apiTestCaseWithBLOBs != null) { + env.getProjectIds().add(apiTestCaseWithBLOBs.getProjectId()); + } } else { ApiDefinition apiDefinition = apiDefinitionService.get(tr.getId()); - env.getProjectIds().add(apiDefinition.getProjectId()); + if (apiDefinition != null) { + env.getProjectIds().add(apiDefinition.getProjectId()); + } } } else if (StringUtils.equals(tr.getType(), "scenario")) { if (tr.isEnable()) { diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index 22f75c44c5..1932b7ff6d 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -429,7 +429,8 @@ this.setTabTitle(data); }, mockConfig(data) { - this.handleMockTabsConfig(this.$t("commons.mock"), "MOCK", data); + let targetName = this.$t("commons.mock") + "-" + data.apiName; + this.handleMockTabsConfig(targetName, "MOCK", data); }, saveApi(data) { this.setTabTitle(data); diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index b3aecd9d1f..7fe43cd077 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -2,7 +2,6 @@
-
@@ -190,6 +189,10 @@ return this.mockBaseUrl + "/mock/" + this.projectId; } else { let path = this.httpForm.path; + let prefix = ""; + if (path.endsWith("/")) { + prefix = "/"; + } let protocol = this.httpForm.method; if (protocol === 'GET' || protocol === 'DELETE') { if (this.httpForm.request != null && this.httpForm.request.rest != null) { @@ -215,7 +218,8 @@ } } } - return this.mockBaseUrl + "/mock/" + this.projectId + path; + + return this.mockBaseUrl + "/mock/" + this.projectId + path + prefix; } } }, @@ -316,6 +320,7 @@ this.$post('/mockConfig/genMockConfig', mockParam, response => { let mockConfig = response.data; + mockConfig.apiName = this.httpForm.name; this.$emit('mockConfig', mockConfig); }); } diff --git a/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue b/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue index 01d4fcff60..a91d3b66d9 100644 --- a/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue +++ b/frontend/src/business/components/api/definition/components/document/ApiDocumentAnchor.vue @@ -26,15 +26,21 @@ @keyup.enter.native="initApiDocSimpleList()" v-model="apiSearch.name"/> - - + - - - + + + - diff --git a/frontend/src/business/components/api/definition/components/mock/MockConfig.vue b/frontend/src/business/components/api/definition/components/mock/MockConfig.vue index 0a210cc1f8..57705ea800 100644 --- a/frontend/src/business/components/api/definition/components/mock/MockConfig.vue +++ b/frontend/src/business/components/api/definition/components/mock/MockConfig.vue @@ -1,145 +1,148 @@ @@ -195,7 +198,7 @@ export default { {max: 100, message: this.$t('test_track.length_less_than') + '100', trigger: 'blur'} ], response: { - httpCode: [{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},], + httpCode: [{required: true, message: this.$t('api_test.mock.rule.input_code'), trigger: 'blur'},], delayed: [{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},], }, }, diff --git a/frontend/src/common/js/tableUtils.js b/frontend/src/common/js/tableUtils.js index c3db0d07c5..2972485a39 100644 --- a/frontend/src/common/js/tableUtils.js +++ b/frontend/src/common/js/tableUtils.js @@ -46,6 +46,11 @@ export function setUnSelectIds(tableData, condition, selectRows) { return ids.indexOf(val) === -1; }); if (condition.unSelectIds) { + //首先将选择的ID从unSelectIds中排除 + condition.unSelectIds = condition.unSelectIds.filter(function (val) { + return ids.indexOf(val) === -1; + }); + //去掉unselectIds中存在的ID let needPushIds = thisUnSelectIds.filter(function (val) { return condition.unSelectIds.indexOf(val) === -1; }); diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index ae2ea54d19..0ffa6dd7ec 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -615,6 +615,9 @@ export default { req_param: "Request params", rsp_param: "Response Params", delete_mock_expect: "Confirm to delete this expect info ?", + rule: { + input_code: "Please input HTTP Code" + } }, definition: { api_title: "Api test", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index a74a80b0eb..232ca2ab66 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -624,6 +624,9 @@ export default { req_param: "请求参数", rsp_param: "响应内容", delete_mock_expect: "确认删除这条预期吗?", + rule: { + input_code: "请输入 HTTP Code" + } }, definition: { api_title: "接口列表", diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 982412213a..00e2aa4313 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -614,6 +614,9 @@ export default { req_param: "請求參賽", rsp_param: "響應內容", delete_mock_expect: "確認刪除這條預期嗎?", + rule: { + input_code: "請輸入 HTTP Code" + } }, definition: { api_title: "接口列表",