fix: 修复跨项目引用场景时不同用户权限引起的缺陷
场景中存在引用无权限的项目,展开运行环境直接报错。现在改为没有权限的用户环境展开时只能进行选择,不能进行配置
This commit is contained in:
parent
3f8bc94378
commit
b14abedb88
|
@ -17,6 +17,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.type === 'projectEnv'" :label="$t('test_track.case.updated_attr_value')">
|
<el-form-item v-if="form.type === 'projectEnv'" :label="$t('test_track.case.updated_attr_value')">
|
||||||
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
||||||
|
:show-config-button-with-out-permission="showConfigButtonWithOutPermission"
|
||||||
:project-list="projectList" ref="envPopover"/>
|
:project-list="projectList" ref="envPopover"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-else :label="$t('test_track.case.updated_attr_value')" prop="value">
|
<el-form-item v-else :label="$t('test_track.case.updated_attr_value')" prop="value">
|
||||||
|
@ -61,6 +62,7 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
|
showConfigButtonWithOutPermission:false,
|
||||||
form: {},
|
form: {},
|
||||||
size: 0,
|
size: 0,
|
||||||
rules: {
|
rules: {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
@show="showPopover"
|
@show="showPopover"
|
||||||
trigger="click">
|
trigger="click">
|
||||||
<env-select :project-ids="projectIds" :env-map="envMap" @close="visible = false"
|
<env-select :project-ids="projectIds" :env-map="envMap" @close="visible = false"
|
||||||
|
:show-config-button-with-out-permission="showConfigButtonWithOutPermission"
|
||||||
ref="envSelect" @setProjectEnvMap="setProjectEnvMap" :project-list="projectList"/>
|
ref="envSelect" @setProjectEnvMap="setProjectEnvMap" :project-list="projectList"/>
|
||||||
<el-button type="primary" slot="reference" size="mini" style="margin-top: 2px;">
|
<el-button type="primary" slot="reference" size="mini" style="margin-top: 2px;">
|
||||||
{{ $t('api_test.definition.request.run_env') }}
|
{{ $t('api_test.definition.request.run_env') }}
|
||||||
|
@ -25,6 +26,12 @@ export default {
|
||||||
envMap: Map,
|
envMap: Map,
|
||||||
projectIds: Set,
|
projectIds: Set,
|
||||||
projectList: Array,
|
projectList: Array,
|
||||||
|
showConfigButtonWithOutPermission:{
|
||||||
|
type: Boolean,
|
||||||
|
default() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default() {
|
default() {
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
<el-option v-for="(environment, index) in pe.envs" :key="index"
|
<el-option v-for="(environment, index) in pe.envs" :key="index"
|
||||||
:label="environment.name"
|
:label="environment.name"
|
||||||
:value="environment.id"/>
|
:value="environment.id"/>
|
||||||
<el-button class="ms-scenario-button" size="mini" type="primary" @click="openEnvironmentConfig(pe.id)">
|
<el-button class="ms-scenario-button" v-if="isShowConfirmButton(pe.id)" size="mini" type="primary" @click="openEnvironmentConfig(pe.id)">
|
||||||
{{ $t('api_test.environment.environment_config') }}
|
{{ $t('api_test.environment.environment_config') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<template v-slot:empty>
|
<template v-slot:empty>
|
||||||
<div class="empty-environment">
|
<div v-if="isShowConfirmButton(pe.id)" class="empty-environment">
|
||||||
<el-button class="ms-scenario-button" size="mini" type="primary" @click="openEnvironmentConfig(pe.id)">
|
<el-button class="ms-scenario-button" size="mini" type="primary" @click="openEnvironmentConfig(pe.id)">
|
||||||
{{ $t('api_test.environment.environment_config') }}
|
{{ $t('api_test.environment.environment_config') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -38,6 +38,12 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
envMap: Map,
|
envMap: Map,
|
||||||
projectIds: Set,
|
projectIds: Set,
|
||||||
|
showConfigButtonWithOutPermission:{
|
||||||
|
type: Boolean,
|
||||||
|
default() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
projectList: Array
|
projectList: Array
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -46,12 +52,33 @@ export default {
|
||||||
result: {},
|
result: {},
|
||||||
projects: [],
|
projects: [],
|
||||||
environments: [],
|
environments: [],
|
||||||
|
permissionProjectIds:[],
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
isFullUrl: true,
|
isFullUrl: true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
isShowConfirmButton(projectId){
|
||||||
|
if(this.showConfigButtonWithOutPermission === true){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
if(this.permissionProjectIds){
|
||||||
|
if(this.permissionProjectIds.indexOf(projectId)<0){
|
||||||
|
return false;
|
||||||
|
}else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
init() {
|
init() {
|
||||||
|
//获取当前用户有权限的ID
|
||||||
|
if(this.permissionProjectIds.length === 0){
|
||||||
|
this.getUserPermissionProjectIds();
|
||||||
|
}
|
||||||
|
|
||||||
this.projectIds.forEach(id => {
|
this.projectIds.forEach(id => {
|
||||||
const project = this.projectList.find(p => p.id === id);
|
const project = this.projectList.find(p => p.id === id);
|
||||||
if (project) {
|
if (project) {
|
||||||
|
@ -138,7 +165,12 @@ export default {
|
||||||
},
|
},
|
||||||
environmentConfigClose() {
|
environmentConfigClose() {
|
||||||
// todo 关闭处理
|
// todo 关闭处理
|
||||||
}
|
},
|
||||||
|
getUserPermissionProjectIds(){
|
||||||
|
this.$get('/project/getOwnerProjectIds/', res => {
|
||||||
|
this.permissionProjectIds = res.data;
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
<el-input :placeholder="$t('api_test.definition.request.select_case')" @blur="search"
|
<el-input :placeholder="$t('api_test.definition.request.select_case')" @blur="search"
|
||||||
@keyup.enter.native="search" class="search-input" size="small" v-model="condition.name"/>
|
@keyup.enter.native="search" class="search-input" size="small" v-model="condition.name"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
<env-popover :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
|
||||||
|
:show-config-button-with-out-permission="showConfigButtonWithOutPermission"
|
||||||
:project-list="projectList" ref="envPopover" class="env-popover"/>
|
:project-list="projectList" ref="envPopover" class="env-popover"/>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
@ -92,6 +92,7 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
|
showConfigButtonWithOutPermission:false,
|
||||||
condition: {},
|
condition: {},
|
||||||
currentScenario: {},
|
currentScenario: {},
|
||||||
schedule: {},
|
schedule: {},
|
||||||
|
|
Loading…
Reference in New Issue