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

View File

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

View File

@ -1,9 +1,9 @@
<template> <template>
<div class="msDialogHeader"> <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;"> <div style="float: left; margin-right: 8px;">
<slot name="other"></slot> <slot name="other"></slot>
</div> </div>
@ -30,6 +30,7 @@ export default {
return 'small'; return 'small';
} }
}, },
hideButton: Boolean,
enableCancel: Boolean enableCancel: Boolean
}, },
methods: { methods: {
@ -44,11 +45,12 @@ export default {
</script> </script>
<style scoped> <style scoped>
.ms_btn { .ms_btn {
float: right; float: right;
margin-right: 50px; margin-right: 50px;
} }
.msDialogHeader {
margin-bottom: 5px; .msDialogHeader {
} margin-bottom: 5px;
}
</style> </style>

View File

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

View File

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

View File

@ -128,8 +128,10 @@ export default {
if (this.isShare) { if (this.isShare) {
config.url = '/share' + config.url; 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> </script>