fix(项目设置): 优化环境设置的样式

--bug=1011999 --user=宋天阳 【环境配置】一个项目有多个环境,同时修改多个环境变量,只能报错最后修改的一个
https://www.tapd.cn/55049933/s/1135776
This commit is contained in:
song-tianyang 2022-04-15 15:52:48 +08:00 committed by TIanyang
parent 977412c141
commit 69efcbbedd
6 changed files with 69 additions and 44 deletions

View File

@ -2,17 +2,13 @@
<el-dialog :close-on-click-modal="false" :title="$t('api_test.environment.environment_config')"
:visible.sync="visible" class="environment-dialog" width="80%" top="50px"
@close="close" append-to-body destroy-on-close ref="environmentConfig">
<template #title>
<ms-dialog-header :title="$t('api_test.environment.environment_config')"
@cancel="visible = false"
@confirm="save"/>
</template>
<el-container v-loading="result.loading">
<ms-aside-item :enable-aside-hidden="false" :title="$t('api_test.environment.environment_list')"
:data="environments" :item-operators="environmentOperators" :add-fuc="addEnvironment"
:env-add-permission="ENV_CREATE"
:delete-fuc="deleteEnvironment" @itemSelected="environmentSelected" ref="environmentItems"/>
<environment-edit :if-create="ifCreate" :project-id="projectId" :environment="currentEnvironment" ref="environmentEdit" :is-read-only="isReadOnly"
@confirm="save"
@close="close"/>
</el-container>
</el-dialog>

View File

@ -1,11 +1,26 @@
<template>
<el-main v-loading="result.loading" class="environment-edit" style="margin-left: 0px">
<el-form :model="environment" :rules="rules" ref="environment" label-width="80px">
<el-form-item prop="name" :label="$t('api_test.environment.name')">
<el-input v-model="environment.name" :disabled="isReadOnly" :placeholder="this.$t('commons.input_name')"
clearable/>
</el-form-item>
<el-row>
<el-col :span="20">
<el-form-item prop="name" :label="$t('api_test.environment.name')">
<el-input v-model="environment.name" :disabled="isReadOnly" :placeholder="this.$t('commons.input_name')"
clearable/>
</el-form-item>
</el-col>
<el-col :span="4">
<div style="float: right;width: fit-content;">
<div style="float: left; margin-right: 8px;">
<slot name="other"></slot>
</div>
<div class="ms_btn">
<el-button type="primary" @click="confirm" @keydown.enter.native.prevent>
{{ $t('commons.confirm') }}
</el-button>
</div>
</div>
</el-col>
</el-row>
<el-tabs v-model="activeName">
@ -82,18 +97,19 @@
:label="$t('error_report_library.use_error_report')"
prop="status">
<el-switch v-model="environment.config.useErrorCode" style="margin-right: 10px" :disabled="isReadOnly"/>
{{$t('error_report_library.use_desc')}}
{{ $t('error_report_library.use_desc') }}
</el-form-item>
</el-col>
</el-row>
<global-assertions :is-read-only="isReadOnly" :assertions="environment.config.assertions" :is-show-json-path-suggest="false"/>
<global-assertions :is-read-only="isReadOnly" :assertions="environment.config.assertions"
:is-show-json-path-suggest="false"/>
</el-tab-pane>
</el-tabs>
<!-- <div class="environment-footer">-->
<!-- <ms-dialog-footer-->
<!-- @cancel="cancel"-->
<!-- @confirm="save()"/>-->
<!-- </div>-->
<!-- <div class="environment-footer">-->
<!-- <ms-dialog-footer-->
<!-- @cancel="cancel"-->
<!-- @confirm="save()"/>-->
<!-- </div>-->
</el-form>
<ms-change-history ref="changeHistory"/>
</el-main>
@ -112,7 +128,7 @@ import MsEnvironmentCommonConfig from "./EnvironmentCommonConfig";
import MsEnvironmentSSLConfig from "./EnvironmentSSLConfig";
import MsApiAuthConfig from "@/business/components/api/definition/components/auth/ApiAuthConfig";
import MsTcpConfig from "@/business/components/api/test/components/request/tcp/TcpConfig";
import {getUUID,hasLicense} from "@/common/js/utils";
import {getUUID, hasLicense} from "@/common/js/utils";
import Jsr233ProcessorContent from "@/business/components/api/automation/scenario/common/Jsr233ProcessorContent";
import {createComponent} from "@/business/components/api/definition/components/jmeter/components";
import EnvironmentGlobalScript from "@/business/components/api/test/components/environment/EnvironmentGlobalScript";
@ -192,12 +208,12 @@ export default {
}
if (!this.environment.config.assertions) {
this.environment.config.assertions = {
duration:{duration:0},
regex:[],
jsonPath:[],
xpath2:[],
jsr223:[],
document:{type:"json",data:{json:[],xml:[]}},
duration: {duration: 0},
regex: [],
jsonPath: [],
xpath2: [],
jsr223: [],
document: {type: "json", data: {json: [], xml: []}},
};
}
},
@ -241,12 +257,12 @@ export default {
}
if (!this.environment.config.assertions) {
this.environment.config.assertions = {
duration:{duration:0},
regex:[],
jsonPath:[],
xpath2:[],
jsr223:[],
document:{type:"json",data:{json:[],xml:[]}},
duration: {duration: 0},
regex: [],
jsonPath: [],
xpath2: [],
jsr223: [],
document: {type: "json", data: {json: [], xml: []}},
};
}
@ -258,8 +274,8 @@ export default {
}
},
computed: {
hasLicense(){
let license= hasLicense();
hasLicense() {
let license = hasLicense();
return license;
},
},
@ -380,6 +396,9 @@ export default {
cancel() {
this.$emit('close');
},
confirm() {
this.$emit("confirm");
},
clearValidate() {
this.$refs["environment"].clearValidate();
},

View File

@ -1,9 +1,9 @@
<template>
<div class="msDialogHeader">
<span style="float: left;font-size: 18px;color: #303133;">{{title}}</span>
<span style="float: left;font-size: 18px;color: #303133;">{{ title }}</span>
<div style="float: right;width: fit-content;">
<div v-if="!hideButton" style="float: right;width: fit-content;">
<div style="float: left; margin-right: 8px;">
<slot name="other"></slot>
</div>
@ -30,6 +30,7 @@ export default {
return 'small';
}
},
hideButton: Boolean,
enableCancel: Boolean
},
methods: {
@ -44,11 +45,12 @@ export default {
</script>
<style scoped>
.ms_btn {
float: right;
margin-right: 50px;
}
.msDialogHeader {
margin-bottom: 5px;
}
.ms_btn {
float: right;
margin-right: 50px;
}
.msDialogHeader {
margin-bottom: 5px;
}
</style>

View File

@ -59,7 +59,7 @@
<!-- 创建编辑复制环境时的对话框 -->
<el-dialog :visible.sync="dialogVisible" :close-on-click-modal="false" width="66%" top="50px">
<template #title>
<ms-dialog-header :title="dialogTitle"
<ms-dialog-header :title="dialogTitle" :hide-button="true"
@cancel="dialogVisible = false"
@confirm="save"/>
</template>

View File

@ -52,12 +52,18 @@
<span class="ms-report-time-desc" v-if="startTime !== '0'">
{{ $t('report.test_start_time') }}{{ startTime | timestampFormatDate }}
</span>
<span class="ms-report-time-desc" v-else-if="planReportTemplate && planReportTemplate.startTime">
{{ $t('report.test_start_time') }}{{ planReportTemplate.startTime | timestampFormatDate }}
</span>
<span class="ms-report-time-desc" v-else>
{{ $t('report.test_start_time') }}-
</span>
<span class="ms-report-time-desc" v-if="report.status === 'Completed' && endTime !== '0'">
{{ $t('report.test_end_time') }}{{ endTime | timestampFormatDate }}
</span>
<span class="ms-report-time-desc" v-else-if="planReportTemplate && planReportTemplate.endTime">
{{ $t('report.test_end_time') }}{{ planReportTemplate.endTime | timestampFormatDate }}
</span>
<span class="ms-report-time-desc" v-else>
{{ $t('report.test_end_time') }}-
</span>

View File

@ -128,8 +128,10 @@ export default {
if (this.isShare) {
config.url = '/share' + config.url;
}
this.result = this.$download(config, this.report.name + '.html');
}
this.result = this.$download(config, this.report.name + '.html',()=>{
this.$success(this.$t("organization.integration.successful_operation"));
});
},
}
}
</script>