This commit is contained in:
liqiang-fit2cloud 2022-12-19 15:28:50 +08:00
commit 383ffc7c9f
6 changed files with 85 additions and 42 deletions

View File

@ -242,31 +242,31 @@ export default {
pageIconColor: "#1F2329", pageIconColor: "#1F2329",
pageIconInactiveColor: "#1F2329", pageIconInactiveColor: "#1F2329",
orient: 'vertical', orient: 'vertical',
icon:"rect", icon: "rect",
itemGap: 32, itemGap: 32,
left: '317px', left: '50%',
y: 'center', y: 'center',
itemHeight: 8, itemHeight: 8,
itemWidth: 8, //icon itemWidth: 8, //icon
itemStyle: { itemStyle: {
borderWidth: 0.1 borderWidth: 0.1
}, },
inactiveBorderWidth:0.1, inactiveBorderWidth: 0.1,
textStyle: { textStyle: {
rich: { rich: {
name: { name: {
fontSize: 14, fontSize: 14,
align: 'left', align: 'left',
width: 100, width: 50,
fontWeight: 400, fontWeight: 400,
color:'#646A73' color: '#646A73'
}, },
num: { num: {
fontSize: 14, fontSize: 14,
align: 'right', align: 'right',
color:'#646A73', color: '#646A73',
fontWeight: 400, fontWeight: 500,
padding: [0, 0, 0, 134] padding: [0, 0, 0, 155]
} }
} }
}, },

View File

@ -45,11 +45,57 @@
</el-input> </el-input>
</div> </div>
<p>{{ $t('api_test.request.headers') }}</p> <!-- 接口测试配置 -->
<el-row> <form-section :title="$t('commons.api')" :init-active=true>
<el-link class="ms-el-link" @click="batchAdd" style="color: #783887"> {{ $t("commons.batch_add") }}</el-link> <p>{{ $t('api_test.request.headers') }}</p>
</el-row> <el-row>
<ms-api-key-value :items="condition.headers" :isShowEnable="true" :suggestions="headerSuggestions"/> <el-link class="ms-el-link" @click="batchAdd" style="color: #783887"> {{
$t("commons.batch_add")
}}
</el-link>
</el-row>
<ms-api-key-value :items="condition.headers" :isShowEnable="true" :suggestions="headerSuggestions"/>
</form-section>
<!-- UI 配置 -->
<form-section :title="$t('commons.ui_test')" :init-active=false v-if="condition.type !== 'MODULE'">
<el-row :gutter="10" style="padding-top: 10px;">
<el-col :span="6">
<!-- 浏览器驱动 -->
<span style="margin-right: 10px;">{{ $t("ui.browser") }}</span>
<el-select
size="mini"
v-model="httpConfig.browser"
style="width: 100px"
>
<el-option
v-for="b in browsers"
:key="b.value"
:value="b.value"
:label="b.label"
></el-option>
</el-select>
</el-col>
<el-col :span="6">
<!-- 性能模式 -->
<el-checkbox
v-model="httpConfig.headlessEnabled"
>
<span> {{ $t("ui.performance_mode") }}</span>
</el-checkbox>
<ms-instructions-icon size="10" :content="$t('ui.per_tip')"/>
</el-col>
</el-row>
<!-- 当前版本实现免登录是基于 cookie 的但是现在由于安全性问题绝大多数网站都不支持 cookie登录所以先屏蔽了-->
<!-- <el-row :gutter="10">-->
<!-- <el-col :span="24">-->
<!-- <ms-ui-scenario-cookie-table :items="httpConfig.cookie" ref="cookieTable"/>-->
<!-- </el-col>-->
<!-- </el-row>-->
</form-section>
<div style="margin-top: 20px"> <div style="margin-top: 20px">
<el-button v-if="!condition.id" type="primary" style="float: right" size="mini" @click="add"> <el-button v-if="!condition.id" type="primary" style="float: right" size="mini" @click="add">
{{ $t('commons.add') }} {{ $t('commons.add') }}
@ -121,10 +167,12 @@ import {getUUID} from "../../utils";
import {KeyValue} from "../../model/EnvTestModel"; import {KeyValue} from "../../model/EnvTestModel";
import Vue from "vue"; import Vue from "vue";
import BatchAddParameter from "./commons/BatchAddParameter"; import BatchAddParameter from "./commons/BatchAddParameter";
import FormSection from "metersphere-frontend/src/components/form/FormSection";
import MsInstructionsIcon from 'metersphere-frontend/src/components/MsInstructionsIcon';
export default { export default {
name: "MsEnvironmentHttpConfig", name: "MsEnvironmentHttpConfig",
components: {MsApiKeyValue, MsSelectTree, MsTableOperatorButton, BatchAddParameter}, components: {MsApiKeyValue, MsSelectTree, MsTableOperatorButton, BatchAddParameter, FormSection, MsInstructionsIcon},
props: { props: {
httpConfig: new HttpConfig(), httpConfig: new HttpConfig(),
projectId: String, projectId: String,
@ -165,9 +213,21 @@ export default {
socket: "", socket: "",
domain: "", domain: "",
port: 0, port: 0,
headers: [new KeyValue()] headers: [new KeyValue()],
headlessEnabled: true,
browser: 'CHROME'
}, },
beforeCondition: {} beforeCondition: {},
browsers: [
{
label: this.$t("chrome"),
value: "CHROME",
},
{
label: this.$t("firefox"),
value: "FIREFOX",
},
],
}; };
}, },
watch: { watch: {
@ -289,7 +349,7 @@ export default {
list() { list() {
if (this.projectId) { if (this.projectId) {
this.result = getApiModuleByProjectIdAndProtocol(this.projectId, "HTTP").then((response) => { this.result = getApiModuleByProjectIdAndProtocol(this.projectId, "HTTP").then((response) => {
if (response.data && response.data !== null) { if (response.data && response.data !== null) {
this.moduleOptions = response.data; this.moduleOptions = response.data;
} }
}); });

View File

@ -455,28 +455,11 @@ export default {
}); });
this.variables = datas; this.variables = datas;
}, },
filterScope(scope) { filterScope(value, row) {
let datas = []; if (value == "ui") {
let variables = _.cloneDeep(this.variables); return row.scope == "ui";
variables.forEach((item) => { }
if (scope == "api") { return !row.scope || row.scope == "api";
if (
item.scope && item.scope != "api"
) {
item.hidden = true;
} else {
item.hidden = undefined;
}
} else {
if (item.scope == scope) {
item.hidden = undefined;
} else {
item.hidden = true;
}
}
datas.push(item);
});
this.variables = datas;
}, },
openSetting(data) { openSetting(data) {
this.$refs.apiVariableSetting.open(data); this.$refs.apiVariableSetting.open(data);

View File

@ -122,7 +122,7 @@ export default{
padding: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
color:#000000; color: #1F2329;
margin-left: 24px; margin-left: 24px;
line-height: 26px; line-height: 26px;
} }

View File

@ -167,7 +167,7 @@ export default {
padding: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
color:#000000; color: #1F2329;
margin-left: 24px; margin-left: 24px;
line-height: 26px; line-height: 26px;
} }

View File

@ -156,7 +156,7 @@ export default {
padding: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
color:#000000; color: #1F2329;
margin-left: 24px; margin-left: 24px;
line-height: 26px; line-height: 26px;
} }