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

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

View File

@ -31,7 +31,7 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/api/automation") @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 { public class ApiAutomationController {
@Resource @Resource

View File

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

View File

@ -5,7 +5,7 @@
<!--操作按钮--> <!--操作按钮-->
<div class="ms-opt-btn"> <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') }} {{ $t('commons.save') }}
</el-button> </el-button>
</div> </div>
@ -117,7 +117,7 @@
<el-col :span="3" class="ms-col-one ms-font"> <el-col :span="3" class="ms-col-one ms-font">
{{$t('api_test.automation.step_total')}}{{scenarioDefinition.length}} {{$t('api_test.automation.step_total')}}{{scenarioDefinition.length}}
</el-col> </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> <el-link class="head" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}</el-link>
{{ getVariableSize() }} {{ getVariableSize() }}
</el-col> </el-col>
@ -126,14 +126,14 @@
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<env-popover :disabled="scenarioDefinition.length < 1" :env-map="projectEnvMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap" :result="envResult" <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>
<el-col :span="4"> <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-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-button :disabled="scenarioDefinition.length < 1" size="mini" icon="el-icon-refresh" v-prevent-re-click @click="getApiScenario"></el-button>
</el-tooltip> </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-col>
</el-row> </el-row>
</div> </div>
@ -163,7 +163,7 @@
</el-col> </el-col>
<!-- 按钮列表 --> <!-- 按钮列表 -->
<el-col :span="3"> <el-col :span="3">
<div @click="fabClick"> <div @click="fabClick" v-tester>
<vue-fab id="fab" mainBtnColor="#783887" size="small" :global-options="globalOptions" <vue-fab id="fab" mainBtnColor="#783887" size="small" :global-options="globalOptions"
:click-auto-close="false" v-outside-click="outsideClick"> :click-auto-close="false" v-outside-click="outsideClick">
<fab-item <fab-item
@ -893,7 +893,7 @@
nodeExpand(data, node) { nodeExpand(data, node) {
node.expanded = true; node.expanded = true;
}, },
nodeCollapse(data,node) { nodeCollapse(data, node) {
node.expanded = false; node.expanded = false;
}, },
setFiles(item, bodyUploadFiles, obj) { setFiles(item, bodyUploadFiles, obj) {
@ -972,6 +972,9 @@
return bodyUploadFiles; return bodyUploadFiles;
}, },
editScenario() { editScenario() {
if (!document.getElementById("inputDelay")) {
return;
}
return new Promise((resolve) => { return new Promise((resolve) => {
document.getElementById("inputDelay").focus(); // input document.getElementById("inputDelay").focus(); // input
this.$refs['currentScenario'].validate((valid) => { this.$refs['currentScenario'].validate((valid) => {
@ -1007,7 +1010,7 @@
}, },
getApiScenario() { getApiScenario() {
this.loading = true; 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); this.currentScenario.tags = JSON.parse(this.currentScenario.tags);
} }
if (!this.currentScenario.variables) { if (!this.currentScenario.variables) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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