refactor(系统设置): 优化环境配置相关设置

--bug=1016095 --user=王孝刚 【系统设置】工作空间 - 环境管理 - 创建环境页面,通用配置处,点击"高级设置"的相关问题
https://www.tapd.cn/55049933/s/1230602
This commit is contained in:
wxg0103 2022-08-23 10:59:27 +08:00 committed by 刘瑞斌
parent d047fb2d57
commit 1ac65286c7
6 changed files with 588 additions and 581 deletions

View File

@ -397,7 +397,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
url = url.replace(this.getPort(), "10990");
}
try {
if (StringUtils.startsWithAny(url, "http://", "https://")) {
if (!StringUtils.startsWithAny(url, "http://", "https://")) {
url = "http://" + url;
}
URL urlObject = new URL(url);

View File

@ -36,7 +36,7 @@
</el-tab-pane>
<el-tab-pane :label="$t('api_test.variable')">
<el-row>
<el-col :span="6" class="col-height">
<el-col :span="6" class="col-height" v-if="environment || scenario || preRequestParams.length > 0">
<div v-if="environment">
<p>{{ $t('api_test.environment.environment') }}</p>
<el-tree :data="environmentParams" :props="treeProps" @node-click="selectVariable"></el-tree>
@ -45,7 +45,7 @@
<p>{{ $t('api_test.scenario.scenario') }}</p>
<el-tree :data="scenarioParams" :props="treeProps" @node-click="selectVariable"></el-tree>
</div>
<div v-if="preRequestParams">
<div v-if="preRequestParams && preRequestParams.length > 0">
<p>{{ $t('api_test.request.parameters_pre_request') }}</p>
<el-tree :data="preRequestParams" :props="treeProps" @node-click="selectVariable"></el-tree>
</div>
@ -53,7 +53,8 @@
<el-col :span="18" class="col-height">
<div>
<h1>{{ $t('api_test.request.jmeter_func') }}</h1>
<el-table border :data="jmeterFuncs" class="adjust-table table-content" height="400">
<el-table border :data="jmeterFuncs" class="adjust-table table-content" height="400"
@row-click="handleRowClick">
<el-table-column prop="type" label="Type" width="150"/>
<el-table-column prop="name" label="Functions" width="250"/>
<el-table-column prop="description" label="Description"/>
@ -63,24 +64,27 @@
</el-row>
</el-tab-pane>
</el-tabs>
<el-form>
<el-form-item>
<el-input :placeholder="valueText" size="small"
v-model="itemValue"/>
</el-form-item>
</el-form>
<div style="padding-top: 10px;">
<el-row type="flex" align="middle">
<el-col :span="12">
<el-button size="small" type="primary" plain @click="saveAdvanced()">
{{ $t('commons.save') }}
</el-button>
<el-button size="small" type="info" plain @click="addFunc()" v-if="currentTab === 0">
{{ $t('api_test.request.parameters_advance_add_func') }}
</el-button>
<el-button size="small" type="success" plain @click="showPreview()" v-if="currentTab === 0">
{{ $t('api_test.request.parameters_preview') }}
</el-button>
<el-row type="flex">
<el-col :span="16">
<div>
<el-form :inline="true" class="demo-form-inline">
<el-form-item>
<el-input :placeholder="valueText" size="small" v-model="itemValue"/>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" plain @click="saveAdvanced()">
{{ $t('commons.save') }}
</el-button>
<el-button size="small" type="info" plain @click="addFunc()" v-if="currentTab === 0">
{{ $t('api_test.request.parameters_advance_add_func') }}
</el-button>
<el-button size="small" type="success" plain @click="showPreview()" v-if="currentTab === 0">
{{ $t('api_test.request.parameters_preview') }}
</el-button>
</el-form-item>
</el-form>
</div>
</el-col>
<el-col>
<div> {{ itemValuePreview }}</div>
@ -255,14 +259,14 @@ export default {
let index = this.mockVariableFuncs.indexOf(itemFunc);
this.mockVariableFuncs = this.mockVariableFuncs.slice(0, index);
this.mockVariableFuncs.push({name: '', params: []});
let valindex = this.itemValue.indexOf('|'+func.name);
this.itemValue = this.itemValue.slice(0,valindex);
}else {
let valindex = this.itemValue.indexOf('|' + func.name);
this.itemValue = this.itemValue.slice(0, valindex);
} else {
this.methodChange(itemFunc, func);
}
},
addFunc() {
if (this.itemValue.indexOf('@') == -1) {
if (this.currentTab === 0 && this.itemValue.indexOf('@') == -1) {
this.itemValue = '@' + this.itemValue;
} else {
this.itemValue = this.itemValue;
@ -289,7 +293,7 @@ export default {
this.mockVariableFuncs.push({name: '', params: []});
},
saveAdvanced() {
if (this.itemValue.indexOf('@') == -1) {
if (this.currentTab === 0 && this.itemValue.indexOf('@') == -1) {
this.currentItem.value = '@' + this.itemValue;
} else {
this.currentItem.value = this.itemValue;
@ -298,7 +302,12 @@ export default {
this.mockVariableFuncs = [];
this.$emit('advancedRefresh', this.currentItem.value);
}
},
handleRowClick(row) {
if (row && row.name) {
this.itemValue = row.name;
}
},
}
}
</script>

View File

@ -54,15 +54,15 @@
</template>
</ms-table-column>
<ms-table-column prop="value" :label="$t('api_test.value')"
min-width="200px" sortable>
<el-table-column prop="value" :label="$t('api_test.value')"
min-width="200px" sortable show-overflow-tooltip>
<template slot-scope="scope">
<el-input v-model="scope.row.value" size="mini" v-if="scope.row.type !=='CSV'"
:placeholder="valueText(scope.row)"
:disabled="scope.row.type === 'COUNTER' || scope.row.type === 'RANDOM'"/>
<csv-file-upload :parameter="scope.row" v-if="scope.row.type ==='CSV'"/>
</template>
</ms-table-column>
</el-table-column>
<ms-table-column prop="description" :label="$t('commons.remark')"
min-width="160" sortable>
<template slot-scope="scope">

View File

@ -32,24 +32,11 @@
</el-tab-pane>
<el-tab-pane :label="$t('api_test.variable')">
<el-row>
<el-col :span="6" class="col-height">
<div v-if="environment">
<p>{{ $t('api_test.environment.environment') }}</p>
<el-tree :data="environmentParams" :props="treeProps" @node-click="selectVariable"></el-tree>
</div>
<div v-if="scenario">
<p>{{ $t('api_test.scenario.scenario') }}</p>
<el-tree :data="scenarioParams" :props="treeProps" @node-click="selectVariable"></el-tree>
</div>
<div v-if="preRequestParams">
<p>{{ $t('api_test.request.parameters_pre_request') }}</p>
<el-tree :data="preRequestParams" :props="treeProps" @node-click="selectVariable"></el-tree>
</div>
</el-col>
<el-col :span="18" class="col-height">
<el-col class="col-height">
<div>
<h1>{{ $t('api_test.request.jmeter_func') }}</h1>
<el-table border :data="jmeterFuncs" class="adjust-table table-content" height="400">
<el-table border :data="jmeterFuncs" class="adjust-table table-content" height="400"
@row-click="handleRowClick">
<el-table-column prop="type" label="Type" width="150"/>
<el-table-column prop="name" label="Functions" width="250"/>
<el-table-column prop="description" label="Description"/>
@ -59,21 +46,27 @@
</el-row>
</el-tab-pane>
</el-tabs>
<el-form>
<el-form-item>
<el-input :placeholder="valueText" size="small"
v-model="itemValue"/>
</el-form-item>
</el-form>
<div style="padding-top: 10px;">
<el-row type="flex" align="middle">
<el-col :span="12">
<el-button size="small" type="info" plain @click="addFunc()" v-if="currentTab === 0">
{{ $t('api_test.request.parameters_advance_add_func') }}
</el-button>
<el-button size="small" type="success" plain @click="showPreview()" v-if="currentTab === 0">
{{ $t('api_test.request.parameters_preview') }}
</el-button>
<el-row type="flex">
<el-col :span="16">
<div>
<el-form :inline="true" class="demo-form-inline">
<el-form-item>
<el-input :placeholder="valueText" size="small" v-model="itemValue"/>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" plain @click="saveAdvanced()">
{{ $t('commons.save') }}
</el-button>
<el-button size="small" type="info" plain @click="addFunc()" v-if="currentTab === 0">
{{ $t('api_test.request.parameters_advance_add_func') }}
</el-button>
<el-button size="small" type="success" plain @click="showPreview()" v-if="currentTab === 0">
{{ $t('api_test.request.parameters_preview') }}
</el-button>
</el-form-item>
</el-form>
</div>
</el-col>
<el-col>
<div> {{ itemValuePreview }}</div>
@ -293,7 +286,12 @@ export default {
this.mockVariableFuncs = [];
this.$emit('advancedRefresh', this.currentItem.value);
}
},
handleRowClick(row) {
if (row && row.name) {
this.itemValue = row.name;
}
},
}
}
</script>

View File

@ -1,7 +1,7 @@
<template>
<ms-edit-dialog
:visible.sync="visible"
width="700px"
width="70%"
:title="$t('schema.adv_setting')"
:with-footer="false"
append-to-body