fix(接口自动化,接口定义): 修复只读用户不能查看详情问题。

This commit is contained in:
fit2-zhao 2021-05-08 10:14:51 +08:00 committed by fit2-zhao
parent 4afbd0fb42
commit 4b34d914b0
9 changed files with 30 additions and 24 deletions

View File

@ -31,7 +31,7 @@ import java.util.List;
@RestController
@RequestMapping(value = "/api/automation")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class ApiAutomationController {
@Resource

View File

@ -34,8 +34,8 @@
min-width="120px"
show-overflow-tooltip :key="index">
<template slot-scope="scope">
<span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.num }} </span>
<el-tooltip v-else content="编辑">
<!--<span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.num }} </span>-->
<el-tooltip content="编辑">
<a style="cursor:pointer" @click="edit(scope.row)"> {{ scope.row.num }} </a>
</el-tooltip>
</template>
@ -45,8 +45,8 @@
min-width="120px"
show-overflow-tooltip :key="index">
<template slot-scope="scope">
<span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.customNum }} </span>
<el-tooltip v-else content="编辑">
<!--<span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.customNum }} </span>-->
<el-tooltip content="编辑">
<a style="cursor:pointer" @click="edit(scope.row)"> {{ scope.row.customNum }} </a>
</el-tooltip>
</template>

View File

@ -5,7 +5,7 @@
<!--操作按钮-->
<div class="ms-opt-btn">
<el-button id="inputDelay" type="primary" size="small" v-prevent-re-click @click="editScenario" title="ctrl + s">
<el-button id="inputDelay" type="primary" size="small" v-prevent-re-click @click="editScenario" title="ctrl + s" v-tester>
{{ $t('commons.save') }}
</el-button>
</div>
@ -117,7 +117,7 @@
<el-col :span="3" class="ms-col-one ms-font">
{{$t('api_test.automation.step_total')}}{{scenarioDefinition.length}}
</el-col>
<el-col :span="3" class="ms-col-one ms-font">
<el-col :span="3" class="ms-col-one ms-font" v-tester>
<el-link class="head" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}</el-link>
{{ getVariableSize() }}
</el-col>
@ -126,14 +126,14 @@
</el-col>
<el-col :span="5">
<env-popover :disabled="scenarioDefinition.length < 1" :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap" :result="envResult"
:isReadOnly="scenarioDefinition.length < 1" @showPopover="showPopover" :project-list="projectList" ref="envPopover"/>
:isReadOnly="scenarioDefinition.length < 1" @showPopover="showPopover" :project-list="projectList" ref="envPopover" v-tester/>
</el-col>
<el-col :span="4">
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click @click="runDebug">{{$t('api_test.request.debug')}}</el-button>
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click @click="runDebug" v-tester>{{$t('api_test.request.debug')}}</el-button>
<el-tooltip class="item" effect="dark" :content="$t('commons.refresh')" placement="right-start">
<el-button :disabled="scenarioDefinition.length < 1" size="mini" icon="el-icon-refresh" v-prevent-re-click @click="getApiScenario"></el-button>
</el-tooltip>
<font-awesome-icon class="alt-ico" :icon="['fa', 'expand-alt']" size="lg" @click="fullScreen"/>
<font-awesome-icon class="alt-ico" :icon="['fa', 'expand-alt']" size="lg" @click="fullScreen" v-tester/>
</el-col>
</el-row>
</div>
@ -163,7 +163,7 @@
</el-col>
<!-- 按钮列表 -->
<el-col :span="3">
<div @click="fabClick">
<div @click="fabClick" v-tester>
<vue-fab id="fab" mainBtnColor="#783887" size="small" :global-options="globalOptions"
:click-auto-close="false" v-outside-click="outsideClick">
<fab-item
@ -893,7 +893,7 @@
nodeExpand(data, node) {
node.expanded = true;
},
nodeCollapse(data,node) {
nodeCollapse(data, node) {
node.expanded = false;
},
setFiles(item, bodyUploadFiles, obj) {
@ -972,6 +972,9 @@
return bodyUploadFiles;
},
editScenario() {
if (!document.getElementById("inputDelay")) {
return;
}
return new Promise((resolve) => {
document.getElementById("inputDelay").focus(); // input
this.$refs['currentScenario'].validate((valid) => {
@ -1007,7 +1010,7 @@
},
getApiScenario() {
this.loading = true;
if (this.currentScenario.tags != undefined && this.currentScenario.tags && !(this.currentScenario.tags instanceof Array)) {
if (this.currentScenario.tags != undefined && this.currentScenario.tags && !(this.currentScenario.tags instanceof Array)) {
this.currentScenario.tags = JSON.parse(this.currentScenario.tags);
}
if (!this.currentScenario.variables) {

View File

@ -6,8 +6,8 @@
<el-col>
<!--操作按钮-->
<div style="float: right;margin-right: 20px;margin-top: 20px">
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s">{{ $t('commons.save') }}</el-button>
<el-button type="primary" size="small" @click="runTest">{{ $t('commons.test') }}</el-button>
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-tester>{{ $t('commons.save') }}</el-button>
<el-button type="primary" size="small" @click="runTest" v-tester>{{ $t('commons.test') }}</el-button>
</div>
</el-col>
</el-row>

View File

@ -5,8 +5,8 @@
<el-form :model="httpForm" :rules="rule" ref="httpForm" label-width="80px" label-position="right">
<!-- 操作按钮 -->
<div style="float: right;margin-right: 20px">
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s">{{ $t('commons.save') }}</el-button>
<el-button type="primary" size="small" @click="runTest">{{ $t('commons.test') }}</el-button>
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-tester>{{ $t('commons.save') }}</el-button>
<el-button type="primary" size="small" @click="runTest" v-tester>{{ $t('commons.test') }}</el-button>
</div>
<br/>
<p class="tip">{{ $t('test_track.plan_view.base_info') }} </p>

View File

@ -5,8 +5,8 @@
<el-col>
<!--操作按钮-->
<div style="float: right;margin-right: 20px;margin-top: 20px">
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s">{{ $t('commons.save') }}</el-button>
<el-button type="primary" size="small" @click="runTest">{{ $t('commons.test') }}</el-button>
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-tester>{{ $t('commons.save') }}</el-button>
<el-button type="primary" size="small" @click="runTest" v-tester>{{ $t('commons.test') }}</el-button>
</div>
</el-col>
</el-row>

View File

@ -5,8 +5,8 @@
<el-col>
<!--操作按钮-->
<div style="float: right;margin-right: 20px;margin-top: 20px">
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s">{{ $t('commons.save') }}</el-button>
<el-button type="primary" size="small" @click="runTest">{{ $t('commons.test') }}</el-button>
<el-button type="primary" size="small" @click="saveApi" title="ctrl + s" v-tester>{{ $t('commons.save') }}</el-button>
<el-button type="primary" size="small" @click="runTest" v-tester>{{ $t('commons.test') }}</el-button>
</div>
</el-col>
</el-row>

View File

@ -27,8 +27,11 @@
:key="index">
<template slot-scope="scope">
<!-- 判断为只读用户的话不可点击ID进行编辑操作 -->
<span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.num }} </span>
<el-tooltip v-else content="编辑">
<!--<span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.num }} </span>-->
<!--<el-tooltip v-else content="编辑">-->
<!--<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>-->
<!--</el-tooltip>-->
<el-tooltip content="编辑">
<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>
</el-tooltip>
</template>

View File

@ -1,7 +1,7 @@
<template>
<el-input class="ms-search-bar" :placeholder="$t('test_track.module.search')" v-model="condition.filterText" size="small">
<template v-if="showOperator" v-slot:append>
<el-dropdown>
<el-dropdown v-tester>
<el-button type="primary">
<span class="tip-font">{{ $t('commons.more_operator') }}</span>
<i class="el-icon-arrow-down el-icon--right"/>