fix(项目设置): 修复开启TCP Mock时,默认端口号为0未随机一个可用端口号的问题
--bug=1014028 --user=宋天阳 【接口测试】开启TCP Mock时,默认端口号为0未随机一个可用端口号 {#_orginal_url#}
This commit is contained in:
parent
b0859ef84c
commit
884abde6e5
|
@ -569,7 +569,7 @@ public class ProjectService {
|
|||
.andTypeValueEqualTo(String.valueOf(project.getMockTcpPort()))
|
||||
.andProjectIdNotEqualTo(projectId);
|
||||
if (projectApplicationMapper.countByExample(example) > 0) {
|
||||
MSException.throwException("TCP Port is not unique!");
|
||||
MSException.throwException(Translator.get("tcp_mock_not_unique"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -958,7 +958,7 @@ public class ProjectService {
|
|||
}
|
||||
}
|
||||
if (returnPort == 0) {
|
||||
MSException.throwException("无可用TCP端口");
|
||||
MSException.throwException(Translator.get("no_tcp_mock_port"));
|
||||
}
|
||||
return String.valueOf(returnPort);
|
||||
}
|
||||
|
|
|
@ -313,25 +313,24 @@ count=Count
|
|||
cannot_find_project=Cannot find project
|
||||
project_repeatable_is_false=Url repeatable not open
|
||||
#环境组
|
||||
null_environment_group_name = Environment group name is null
|
||||
environment_group_name = Environment group name
|
||||
environment_group_exist = already exists
|
||||
null_environment_group_name=Environment group name is null
|
||||
environment_group_name=Environment group name
|
||||
environment_group_exist=already exists
|
||||
environment_group_has_duplicate_project=Environment group has duplicate project
|
||||
#误报库
|
||||
error_report_library=Error report
|
||||
issue_jira_info_error=Check the service integration information or Jira project ID
|
||||
error_code_is_unique=Error code is not unique
|
||||
|
||||
no_version_exists=version not exists
|
||||
jira_auth_error=Account name or password (Token) is wrong
|
||||
jira_auth_url_error=The test connection failed, please check whether the Jira address is correct
|
||||
#ui 指令校驗
|
||||
param_error=Param Error
|
||||
is_null= can't be null
|
||||
url_is_null= URL can't be null
|
||||
frame_index_is_null= frame index can't be null
|
||||
element_is_null= element can't be null
|
||||
locator_is_null= locator can't be null
|
||||
is_null=can't be null
|
||||
url_is_null=URL can't be null
|
||||
frame_index_is_null=frame index can't be null
|
||||
element_is_null=element can't be null
|
||||
locator_is_null=locator can't be null
|
||||
coord=coord
|
||||
input_content=input
|
||||
subitem_type=subitem type
|
||||
|
@ -375,3 +374,5 @@ close=close
|
|||
cmdExtraction=extracion
|
||||
cmdExtractWindow=window extraction
|
||||
cmdExtractElement=element extraction
|
||||
tcp_mock_not_unique=This tcp port is be used
|
||||
no_tcp_mock_port=No idle tcp port, please contact administrators.
|
|
@ -312,9 +312,9 @@ count=统计
|
|||
cannot_find_project=未找到测试项目
|
||||
project_repeatable_is_false=项目未配置URL可重复
|
||||
#环境组
|
||||
null_environment_group_name = 环境组名称不存在
|
||||
environment_group_name = 环境组名称
|
||||
environment_group_exist = 已存在
|
||||
null_environment_group_name=环境组名称不存在
|
||||
environment_group_name=环境组名称
|
||||
environment_group_exist=已存在
|
||||
environment_group_has_duplicate_project=每个项目只能选择一个环境!
|
||||
#误报库
|
||||
error_report_library=误报库
|
||||
|
@ -325,11 +325,11 @@ jira_auth_error=账号名或密码(Token)错误
|
|||
jira_auth_url_error=测试连接失败,请检查Jira地址是否正确
|
||||
#ui 指令校验
|
||||
param_error=参数校验失败!请检查
|
||||
is_null= 不能为空
|
||||
url_is_null= URL 参数不能为空
|
||||
frame_index_is_null= 网页索引号不能为空
|
||||
element_is_null= 元素对象已经被删除
|
||||
locator_is_null= 元素定位参数不能有空
|
||||
is_null=不能为空
|
||||
url_is_null=URL 参数不能为空
|
||||
frame_index_is_null=网页索引号不能为空
|
||||
element_is_null=元素对象已经被删除
|
||||
locator_is_null=元素定位参数不能有空
|
||||
coord=坐标
|
||||
input_content=输入内容
|
||||
subitem_type=子选项类型
|
||||
|
@ -373,3 +373,5 @@ close=关闭网页
|
|||
cmdExtraction=数据提取
|
||||
cmdExtractWindow=提取窗口信息
|
||||
cmdExtractElement=提取元素信息
|
||||
tcp_mock_not_unique=该TCP端口号已被使用
|
||||
no_tcp_mock_port=无可用的TCP端口号,请联系管理员
|
|
@ -311,25 +311,24 @@ count=統計
|
|||
cannot_find_project=未找到測試項目
|
||||
project_repeatable_is_false=項目未配置URL可重複
|
||||
#环境组
|
||||
null_environment_group_name = 環境組名稱不存在
|
||||
environment_group_name = 環境組名稱
|
||||
environment_group_exist = 已存在
|
||||
null_environment_group_name=環境組名稱不存在
|
||||
environment_group_name=環境組名稱
|
||||
environment_group_exist=已存在
|
||||
environment_group_has_duplicate_project=每個項目只能選擇一個環境!
|
||||
#误报库
|
||||
error_report_library=誤報庫
|
||||
issue_jira_info_error=請檢查服務集成信息或Jira項目ID
|
||||
error_code_is_unique=錯誤代碼不可重複
|
||||
|
||||
no_version_exists=不存在版本!請先創建項目的版本
|
||||
jira_auth_error=賬號名或密碼(Token)錯誤
|
||||
jira_auth_url_error=測試連接失敗,請檢查Jira地址是否正確
|
||||
#ui 指令校驗
|
||||
param_error=參數校驗失敗!請檢查
|
||||
is_null= 不能為空
|
||||
url_is_null= URL 參數不能為空
|
||||
frame_index_is_null= 網頁索引號不能為空
|
||||
element_is_null= 元素對象已經被刪除
|
||||
locator_is_null= 元素定位參數不能有空
|
||||
is_null=不能為空
|
||||
url_is_null=URL 參數不能為空
|
||||
frame_index_is_null=網頁索引號不能為空
|
||||
element_is_null=元素對象已經被刪除
|
||||
locator_is_null=元素定位參數不能有空
|
||||
coord=坐標
|
||||
input_content=輸入內容
|
||||
subitem_type=子選項類型
|
||||
|
@ -373,3 +372,5 @@ close=關閉網頁
|
|||
cmdExtraction=數據提取
|
||||
cmdExtractWindow=提取窗口信息
|
||||
cmdExtractElement=提取元素信息
|
||||
tcp_mock_not_unique=該TCP端口號已被使用
|
||||
no_tcp_mock_port=無可用的TCP端口號,請聯繫管理員
|
|
@ -66,7 +66,7 @@
|
|||
</template>
|
||||
<template #append>
|
||||
<el-switch v-model="config.mockTcpOpen"
|
||||
@change="switchChange('MOCK_TCP_OPEN', $event, ['MOCK_TCP_PORT', config.mockTcpPort])"></el-switch>
|
||||
@change="tcpMockSwitchChange($event, ['MOCK_TCP_PORT', config.mockTcpPort])"></el-switch>
|
||||
</template>
|
||||
</app-manage-item>
|
||||
<timing-item ref="apiTimingItem" :choose.sync="config.cleanApiReport"
|
||||
|
@ -74,8 +74,10 @@
|
|||
@chooseChange="switchChange('CLEAN_API_REPORT', config.cleanApiReport, ['CLEAN_API_REPORT_EXPR', config.cleanApiReportExpr])"
|
||||
:title="$t('project.timing_clean_api_report')"/>
|
||||
<timing-item ref="trackTimingItem" :choose.sync="config.shareReport"
|
||||
:expr.sync="config.apiShareReportTime" :share-link="true" :unit-options="applyUnitOptions"
|
||||
@chooseChange="switchChange('API_SHARE_REPORT_TIME', config.apiShareReportTime)" :title="$t('report.report_sharing_link')"/>
|
||||
:expr.sync="config.apiShareReportTime" :share-link="true"
|
||||
:unit-options="applyUnitOptions"
|
||||
@chooseChange="switchChange('API_SHARE_REPORT_TIME', config.apiShareReportTime)"
|
||||
:title="$t('report.report_sharing_link')"/>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="8" :offset="4">
|
||||
|
@ -102,7 +104,7 @@
|
|||
</el-tab-pane>
|
||||
|
||||
<!-- UI 测试 -->
|
||||
<el-tab-pane v-if="isXpack" :label="$t('commons.ui_test')" name="ui_test" >
|
||||
<el-tab-pane v-if="isXpack" :label="$t('commons.ui_test')" name="ui_test">
|
||||
<el-row style="margin-top: 10px">
|
||||
<span style="font-weight:bold">{{ $t('commons.view_settings') }}</span>
|
||||
</el-row>
|
||||
|
@ -153,12 +155,7 @@
|
|||
import MsContainer from "@/business/components/common/components/MsContainer";
|
||||
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
|
||||
|
||||
import {
|
||||
getCurrentProjectID,
|
||||
getCurrentUserId,
|
||||
getCurrentWorkspaceId,
|
||||
hasLicense,
|
||||
} from "@/common/js/utils";
|
||||
import {getCurrentProjectID, hasLicense,} from "@/common/js/utils";
|
||||
import AppManageItem from "@/business/components/project/menu/appmanage/AppManageItem";
|
||||
import TimingItem from "@/business/components/project/menu/appmanage/TimingItem";
|
||||
|
||||
|
@ -225,6 +222,19 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
tcpMockSwitchChange(value, other) {
|
||||
if (value && this.config.mockTcpPort === 0) {
|
||||
this.result = this.$get('/project/genTcpMockPort/' + this.projectId, res => {
|
||||
let port = res.data;
|
||||
this.config.mockTcpPort = port;
|
||||
this.$nextTick(() => {
|
||||
this.switchChange("MOCK_TCP_OPEN", value, ['MOCK_TCP_PORT', this.config.mockTcpPort]);
|
||||
})
|
||||
});
|
||||
} else {
|
||||
this.switchChange("MOCK_TCP_OPEN", value, other);
|
||||
}
|
||||
},
|
||||
switchChange(type, value, other) {
|
||||
let configs = [];
|
||||
if (other && value) {
|
||||
|
@ -247,7 +257,7 @@ export default {
|
|||
if (res.data) {
|
||||
this.config = res.data;
|
||||
this.config.shareReport = true;
|
||||
if(!this.config.uiQuickMenu){
|
||||
if (!this.config.uiQuickMenu) {
|
||||
this.config.uiQuickMenu = "server";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue