fix(接口自动化): 修复复制用例缺陷;优化操作日志样式。

This commit is contained in:
fit2-zhao 2021-05-28 10:38:27 +08:00 committed by fit2-zhao
parent 52a4e94edd
commit 4cb1c9da6a
3 changed files with 74 additions and 66 deletions

View File

@ -1,11 +1,13 @@
package io.metersphere.controller; package io.metersphere.controller;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.UserSource; import io.metersphere.commons.constants.UserSource;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.RsaKey; import io.metersphere.commons.utils.RsaKey;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.LoginRequest; import io.metersphere.controller.request.LoginRequest;
import io.metersphere.i18n.Translator; import io.metersphere.i18n.Translator;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.BaseDisplayService; import io.metersphere.service.BaseDisplayService;
import io.metersphere.service.UserService; import io.metersphere.service.UserService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -41,6 +43,7 @@ public class LoginController {
} }
@PostMapping(value = "/signin") @PostMapping(value = "/signin")
@MsAuditLog(module = "auth_title", type = OperLogConstants.LOGIN, title = "登录")
public ResultHolder login(@RequestBody LoginRequest request) { public ResultHolder login(@RequestBody LoginRequest request) {
SessionUser sessionUser = SessionUtils.getUser(); SessionUser sessionUser = SessionUtils.getUser();
if (sessionUser != null) { if (sessionUser != null) {
@ -58,6 +61,7 @@ public class LoginController {
} }
@GetMapping(value = "/signout") @GetMapping(value = "/signout")
@MsAuditLog(module = "auth_title", type = OperLogConstants.LOGIN, title = "登出")
public ResultHolder logout() throws Exception { public ResultHolder logout() throws Exception {
userService.logout(); userService.logout();
SecurityUtils.getSubject().logout(); SecurityUtils.getSubject().logout();

View File

@ -221,7 +221,7 @@
}, },
watch: {}, watch: {},
methods: { methods: {
openHis(row){ openHis(row) {
this.$refs.changeHistory.open(row.id); this.$refs.changeHistory.open(row.id);
}, },
handleRunBatch() { handleRunBatch() {
@ -258,10 +258,13 @@
this.$emit('singleRun', data); this.$emit('singleRun', data);
}, },
copyCase(data) { copyCase(data) {
let uuid = getUUID(); if (data && data.request) {
data.request.id = uuid; let uuid = getUUID();
let obj = {name: "copy_" + data.name, priority: data.priority, active: true, tags: data.tags, request: data.request, uuid: uuid}; let request = JSON.parse(JSON.stringify(data.request));
this.$emit('copyCase', obj); request.id = uuid;
let obj = {name: "copy_" + data.name, priority: data.priority, active: true, tags: data.tags, request: request, uuid: uuid};
this.$emit('copyCase', obj);
}
}, },
selectTestCase(item, $event) { selectTestCase(item, $event) {
if (!item.id || !this.loaded) { if (!item.id || !this.loaded) {

View File

@ -23,7 +23,6 @@
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item :label="$t('operating_log.user')" prop="user"> <el-form-item :label="$t('operating_log.user')" prop="user">
<!--<el-input size="small" v-model="condition.operUser"/>-->
<el-autocomplete <el-autocomplete
class="input-with-autocomplete" class="input-with-autocomplete"
v-model="condition.operUser" v-model="condition.operUser"
@ -33,8 +32,7 @@
size="small" size="small"
highlight-first-item highlight-first-item
value-key="email" value-key="email"
@select="handleSelect" @select="handleSelect">
>
<template v-slot:default="scope"> <template v-slot:default="scope">
<span class="ws-member-name">{{scope.item.name}}</span> <span class="ws-member-name">{{scope.item.name}}</span>
<span class="ws-member-email">{{scope.item.email}}</span> <span class="ws-member-email">{{scope.item.email}}</span>
@ -61,11 +59,13 @@
<el-col :span="4"> <el-col :span="4">
<el-form-item :label="$t('operating_log.object')" prop="module"> <el-form-item :label="$t('operating_log.object')" prop="module">
<!--<el-input size="small" v-model="condition.operModule"/>--> <el-cascader v-model="condition.operModules"
<el-cascader :options="sysList" filterable :placeholder="$t('operating_log.object')" show-all-levels show-all-levels filterable
v-model="condition.operModules" :props="props" :options="sysList"
class="ms-case" ref="cascade"></el-cascader> :placeholder="$t('operating_log.object')"
:props="props"
class="ms-case"
@change="initTableData" ref="cascade"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -74,7 +74,9 @@
<el-button type="primary" size="small" style="float: right" @click="search"> <el-button type="primary" size="small" style="float: right" @click="search">
{{ $t('commons.adv_search.search') }} {{ $t('commons.adv_search.search') }}
</el-button> </el-button>
<el-button size="small" @click="reset">{{$t('commons.adv_search.reset')}}</el-button> <el-button size="small" @click="reset">
{{$t('commons.adv_search.reset')}}
</el-button>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -104,8 +106,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize" <ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize" :total="total"/>
:total="total"/>
</el-card> </el-card>
<ms-log-detail ref="logDetail" :title="$t('report.test_log_details')"/> <ms-log-detail ref="logDetail" :title="$t('report.test_log_details')"/>
@ -129,55 +130,6 @@
props: { props: {
multiple: false, multiple: false,
}, },
sysList: [
{
label: "测试跟踪", value: "track", children: [
{label: "测试用例", value: "测试用例", leaf: true},
{label: "用例评审", value: "用例评审", leaf: true},
{label: "测试计划", value: "测试计划", leaf: true},
{label: "缺陷管理", value: "缺陷管理", leaf: true},
{label: "报告", value: "报告", leaf: true}]
},
{
label: "接口测试", value: "api", children: [
{label: "接口定义", value: "接口定义", leaf: true},
{label: "接口自动化", value: "接口自动化", leaf: true},
{label: "测试报告", value: "测试报告", leaf: true}]
},
{
label: "性能测试", value: "性能测试", children: [
{label: "性能测试", value: "性能测试", leaf: true},
{label: "性能测试报告", value: "性能测试报告", leaf: true}]
},
{
label: "系统设置", value: "系统设置", children: [
{label: "系统-用户", value: "系统-用户", leaf: true},
{label: "系统-组织", value: "系统-组织", leaf: true},
{label: "工作空间", value: "工作空间", leaf: true},
{label: "系统-测试资源池", value: "系统-测试资源池", leaf: true},
{label: "系统-系统参数设置", value: "系统-系统参数设置", leaf: true},
{label: "系统-配额管理", value: "系统-配额管理", leaf: true},
{label: "系统-授权管理", value: "系统-授权管理", leaf: true},
{label: "组织-成员", value: "组织-成员", leaf: true},
{label: "组织-服务集成", value: "组织-服务集成", leaf: true},
{label: "组织-消息设置", value: "组织-消息设置", leaf: true},
{label: "工作空间-成员", value: "工作空间-成员", leaf: true},
{label: "项目-项目管理", value: "项目-项目管理", leaf: true},
{label: "工作空间-模版设置", value: "工作空间-模版设置", leaf: true},
{label: "工作空间-项目管理", value: "工作空间-项目管理", leaf: true},
{label: "项目-项目管理", value: "项目-项目管理", leaf: true},
{label: "项目-成员", value: "项目-成员", leaf: true},
{label: "工作空间-成员", value: "工作空间-成员", leaf: true},
{label: "項目-JAR包管理", value: "項目-JAR包管理", leaf: true},
{label: "项目-环境设置", value: "项目-环境设置", leaf: true},
{label: "项目-文件管理", value: "项目-文件管理", leaf: true},
{label: "个人信息-个人设置", value: "个人信息-个人设置", leaf: true},
{label: "个人信息-API Keys", value: "个人信息-API Keys", leaf: true}
]
},
],
result: {}, result: {},
form: {}, form: {},
currentPage: 0, currentPage: 0,
@ -235,7 +187,56 @@
['BATCH_ADD', this.$t('commons.batch_add')], ['BATCH_ADD', this.$t('commons.batch_add')],
['BATCH_RESTORE', "批量恢复"], ['BATCH_RESTORE', "批量恢复"],
['BATCH_GC', "批量回收"], ['BATCH_GC', "批量回收"],
]) ]),
sysList: [
{
label: "测试跟踪", value: "测试跟踪", children: [
{label: "测试用例", value: "测试用例", leaf: true},
{label: "用例评审", value: "用例评审", leaf: true},
{label: "测试计划", value: "测试计划", leaf: true},
{label: "缺陷管理", value: "缺陷管理", leaf: true},
{label: "报告", value: "报告", leaf: true}]
},
{
label: "接口测试", value: "api", children: [
{label: "接口定义", value: "接口定义", leaf: true},
{label: "接口自动化", value: "接口自动化", leaf: true},
{label: "测试报告", value: "测试报告", leaf: true}]
},
{
label: "性能测试", value: "性能测试", children: [
{label: "性能测试", value: "性能测试", leaf: true},
{label: "性能测试报告", value: "性能测试报告", leaf: true}]
},
{
label: "系统设置", value: "系统设置", children: [
{label: "系统-用户", value: "系统-用户", leaf: true},
{label: "系统-组织", value: "系统-组织", leaf: true},
{label: "工作空间", value: "工作空间", leaf: true},
{label: "系统-测试资源池", value: "系统-测试资源池", leaf: true},
{label: "系统-系统参数设置", value: "系统-系统参数设置", leaf: true},
{label: "系统-配额管理", value: "系统-配额管理", leaf: true},
{label: "系统-授权管理", value: "系统-授权管理", leaf: true},
{label: "组织-成员", value: "组织-成员", leaf: true},
{label: "组织-服务集成", value: "组织-服务集成", leaf: true},
{label: "组织-消息设置", value: "组织-消息设置", leaf: true},
{label: "工作空间-成员", value: "工作空间-成员", leaf: true},
{label: "项目-项目管理", value: "项目-项目管理", leaf: true},
{label: "工作空间-模版设置", value: "工作空间-模版设置", leaf: true},
{label: "工作空间-项目管理", value: "工作空间-项目管理", leaf: true},
{label: "项目-项目管理", value: "项目-项目管理", leaf: true},
{label: "项目-成员", value: "项目-成员", leaf: true},
{label: "工作空间-成员", value: "工作空间-成员", leaf: true},
{label: "項目-JAR包管理", value: "項目-JAR包管理", leaf: true},
{label: "项目-环境设置", value: "项目-环境设置", leaf: true},
{label: "项目-文件管理", value: "项目-文件管理", leaf: true},
{label: "个人信息-个人设置", value: "个人信息-个人设置", leaf: true},
{label: "个人信息-API Keys", value: "个人信息-API Keys", leaf: true}
]
},
],
} }
}, },
mounted() { mounted() {