feat (操作日志): 初步完成日志跳转结构
This commit is contained in:
parent
a3e5b567c2
commit
44e3417cd0
|
@ -193,7 +193,7 @@ public class ApiAutomationController {
|
|||
}
|
||||
|
||||
@PostMapping(value = "/run/debug")
|
||||
@MsAuditLog(module = "api_automation", type = OperLogConstants.DEBUG, title = "#request.scenarioName", project = "#request.projectId")
|
||||
@MsAuditLog(module = "api_automation", type = OperLogConstants.DEBUG, title = "#request.scenarioName", sourceId = "#request.scenarioId", project = "#request.projectId")
|
||||
public void runDebug(@RequestPart("request") RunDefinitionRequest request,
|
||||
@RequestPart(value = "bodyFiles", required = false) List<MultipartFile> bodyFiles, @RequestPart(value = "scenarioFiles", required = false) List<MultipartFile> scenarioFiles) {
|
||||
request.setExecuteType(ExecuteType.Debug.name());
|
||||
|
|
|
@ -83,27 +83,27 @@ public class ApiTestCaseController {
|
|||
}
|
||||
|
||||
@PostMapping(value = "/create", consumes = {"multipart/form-data"})
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request)", msClass = ApiTestCaseService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CASE_CREATE, mailTemplate = "api/CaseCreate", subject = "接口用例通知")
|
||||
public ApiTestCase create(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
|
||||
return apiTestCaseService.create(request, bodyFiles);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request)", title = "#request.name", content = "#msClass.getLogDetails(#request)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request)", title = "#request.name", content = "#msClass.getLogDetails(#request)", msClass = ApiTestCaseService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CASE_UPDATE, mailTemplate = "api/CaseUpdate", subject = "接口用例通知")
|
||||
public ApiTestCase update(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
|
||||
return apiTestCaseService.update(request, bodyFiles);
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{id}")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = ApiTestCaseService.class)
|
||||
public void delete(@PathVariable String id) {
|
||||
apiTestCaseService.delete(id);
|
||||
}
|
||||
|
||||
@GetMapping("/deleteToGc/{id}")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = ApiTestCaseService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CASE_DELETE, target = "#targetClass.get(#id)", targetClass = ApiTestCaseService.class,
|
||||
mailTemplate = "api/CaseDelete", subject = "接口用例通知")
|
||||
public void deleteToGc(@PathVariable String id) {
|
||||
|
@ -111,7 +111,7 @@ public class ApiTestCaseController {
|
|||
}
|
||||
|
||||
@PostMapping("/removeToGc")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.GC, beforeEvent = "#msClass.getLogDetails(#ids)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.GC, beforeEvent = "#msClass.getLogDetails(#ids)", msClass = ApiTestCaseService.class)
|
||||
public void removeToGc(@RequestBody List<String> ids) {
|
||||
apiTestCaseService.removeToGc(ids);
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class ApiTestCaseController {
|
|||
}
|
||||
|
||||
@PostMapping("/batch/editByParam")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.BATCH_UPDATE, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = ApiTestCaseService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CASE_UPDATE, target = "#targetClass.getApiCaseByIds(#request.ids)", targetClass = ApiTestCaseService.class,
|
||||
mailTemplate = "api/CaseUpdate", subject = "接口用例通知")
|
||||
public void editApiBathByParam(@RequestBody ApiTestBatchRequest request) {
|
||||
|
@ -140,26 +140,26 @@ public class ApiTestCaseController {
|
|||
}
|
||||
|
||||
@PostMapping("/reduction")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.RESTORE, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.RESTORE, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = ApiTestCaseService.class)
|
||||
public List<String> reduction(@RequestBody ApiTestBatchRequest request) {
|
||||
List<String> cannotReductionTestCaseApiName = apiTestCaseService.reduction(request);
|
||||
return cannotReductionTestCaseApiName;
|
||||
}
|
||||
|
||||
@PostMapping("/deleteBatch")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#ids)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#ids)", msClass = ApiTestCaseService.class)
|
||||
public void deleteBatch(@RequestBody List<String> ids) {
|
||||
apiTestCaseService.deleteBatch(ids);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteBatchByParam")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = ApiTestCaseService.class)
|
||||
public void deleteBatchByParam(@RequestBody ApiTestBatchRequest request) {
|
||||
apiTestCaseService.deleteBatchByParam(request);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteToGcByParam")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.BATCH_DEL, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = ApiTestCaseService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CASE_DELETE, target = "#targetClass.getApiCaseByIds(#request.ids)", targetClass = ApiTestCaseService.class,
|
||||
mailTemplate = "api/CaseDelete", subject = "接口用例通知")
|
||||
public void deleteToGcByParam(@RequestBody ApiTestBatchRequest request) {
|
||||
|
@ -182,13 +182,13 @@ public class ApiTestCaseController {
|
|||
}
|
||||
|
||||
@PostMapping(value = "/batch/run")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.caseId)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.caseId)", msClass = ApiTestCaseService.class)
|
||||
public void batchRun(@RequestBody ApiCaseBatchRequest request) {
|
||||
apiTestCaseService.batchRun(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/jenkins/run")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.caseId)", msClass = ApiTestCaseService.class)
|
||||
@MsAuditLog(module = "api_definition_case", type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.caseId)", msClass = ApiTestCaseService.class)
|
||||
public String jenkinsRun(@RequestBody RunCaseRequest request) {
|
||||
return apiTestCaseService.run(request);
|
||||
}
|
||||
|
|
|
@ -234,6 +234,7 @@ ssl_password_error=The authentication password is wrong, please re-enter the pas
|
|||
ssl_file_error=Failed to load the certification file, please check the certification file
|
||||
#log
|
||||
api_definition=Api definition
|
||||
api_definition_case=Api definition case
|
||||
api_automation=Api automation
|
||||
api_automation_report=Test Report
|
||||
track_test_case=Test case
|
||||
|
|
|
@ -233,6 +233,7 @@ ssl_password_error=认证密码错误,请重新输入密码
|
|||
ssl_file_error=认证文件加载失败,请检查认证文件
|
||||
#log
|
||||
api_definition=接口定义
|
||||
api_definition_case=接口定义用例
|
||||
api_automation=接口自动化
|
||||
api_automation_report=测试报告
|
||||
track_test_case=测试用例
|
||||
|
|
|
@ -234,6 +234,7 @@ ssl_password_error=認證密碼錯誤,請重新輸入密碼
|
|||
ssl_file_error=認證文件加載失敗,請檢查認證文件
|
||||
#log
|
||||
api_definition=接口定義
|
||||
api_definition_case=接口定義用例
|
||||
api_automation=接口自動化
|
||||
api_automation_report=測試報告
|
||||
track_test_case=測試用例
|
||||
|
|
|
@ -198,11 +198,16 @@ export default {
|
|||
if (this.moduleOptions && JSON.stringify(this.moduleOptions) === '{}') {
|
||||
this.$refs.nodeTree.list();
|
||||
}
|
||||
let row = data.listObject[0];
|
||||
if (row.tags && row.tags.length > 0) {
|
||||
row.tags = JSON.parse(row.tags);
|
||||
if (data.listObject && data.listObject.length > 0) {
|
||||
let row = data.listObject[0];
|
||||
if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) {
|
||||
if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object'
|
||||
&& Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') {
|
||||
row.tags = JSON.parse(row.tags);
|
||||
}
|
||||
}
|
||||
this.editScenario(row);
|
||||
}
|
||||
this.editScenario(row);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ export default {
|
|||
exportFlag: false,
|
||||
messageWebSocket: {},
|
||||
websocket: {},
|
||||
stepFilter: this.stepFilter,
|
||||
stepFilter: new STEP,
|
||||
}
|
||||
},
|
||||
activated() {
|
||||
|
|
|
@ -251,6 +251,7 @@ import MsTable from "@/business/components/common/components/table/MsTable";
|
|||
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
|
||||
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
|
||||
import {editApiScenarioCaseOrder} from "@/business/components/api/automation/api-automation";
|
||||
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
|
||||
|
||||
export default {
|
||||
name: "MsApiScenarioList",
|
||||
|
@ -860,6 +861,7 @@ export default {
|
|||
this.result = this.$get("/api/automation/getApiScenario/" + scenarioId, response => {
|
||||
if (response.data) {
|
||||
this.currentScenario = response.data;
|
||||
this.currentScenario.clazzName = TYPE_TO_C.get("scenario");
|
||||
if (response.data.scenarioDefinition != null) {
|
||||
let obj = JSON.parse(response.data.scenarioDefinition);
|
||||
this.currentScenario.scenarioDefinition = obj;
|
||||
|
@ -879,6 +881,9 @@ export default {
|
|||
if (!stepArray[i].resourceId) {
|
||||
stepArray[i].resourceId = getUUID();
|
||||
}
|
||||
if (!stepArray[i].clazzName) {
|
||||
stepArray[i].clazzName = TYPE_TO_C.get(stepArray[i].type);
|
||||
}
|
||||
if (stepArray[i].hashTree && stepArray[i].hashTree.length > 0) {
|
||||
this.sort(stepArray[i].hashTree);
|
||||
}
|
||||
|
|
|
@ -1178,6 +1178,9 @@ export default {
|
|||
allowDrop(draggingNode, dropNode, dropType) {
|
||||
// 增加插件权限控制
|
||||
if (dropType != "inner") {
|
||||
if (draggingNode.data.disabled && draggingNode.parent && draggingNode.parent.data && draggingNode.parent.data.disabled) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else if (dropType === "inner" && dropNode.data.referenced !== 'REF' && dropNode.data.referenced !== 'Deleted'
|
||||
&& (this.stepFilter.get(dropNode.data.type) && this.stepFilter.get(dropNode.data.type).indexOf(draggingNode.data.type) != -1)
|
||||
|
@ -1316,6 +1319,16 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
formatData(hashTree) {
|
||||
for (let i in hashTree) {
|
||||
if (!hashTree[i].clazzName) {
|
||||
hashTree[i].clazzName = TYPE_TO_C.get(hashTree[i].type);
|
||||
}
|
||||
if (hashTree[i].hashTree && hashTree[i].hashTree.length > 0) {
|
||||
this.formatData(hashTree[i].hashTree);
|
||||
}
|
||||
}
|
||||
},
|
||||
setParameter() {
|
||||
this.currentScenario.stepTotal = this.scenarioDefinition.length;
|
||||
if (!this.currentScenario.projectId) {
|
||||
|
@ -1336,6 +1349,10 @@ export default {
|
|||
onSampleError: this.onSampleError,
|
||||
projectId: this.currentScenario.projectId ? this.currentScenario.projectId : this.projectId,
|
||||
};
|
||||
// 历史数据处理
|
||||
if (scenario.hashTree) {
|
||||
this.formatData(scenario.hashTree);
|
||||
}
|
||||
this.currentScenario.scenarioDefinition = scenario;
|
||||
if (this.currentScenario.tags instanceof Array) {
|
||||
this.currentScenario.tags = JSON.stringify(this.currentScenario.tags);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<el-card class="table-card">
|
||||
<template v-slot:header>
|
||||
<div style="font-size: 16px;margin-bottom: 20px;margin-left: 10px">
|
||||
{{$t('operating_log.title')}}
|
||||
{{ $t('operating_log.title') }}
|
||||
</div>
|
||||
<div>
|
||||
<el-form :model="condition" label-position="right" label-width="75px" size="small" ref="basicForm" style="margin-right: 20px">
|
||||
|
@ -34,8 +34,8 @@
|
|||
value-key="email"
|
||||
@select="handleSelect">
|
||||
<template v-slot:default="scope">
|
||||
<span class="ws-member-name">{{scope.item.name}}</span>
|
||||
<span class="ws-member-email">{{scope.item.email}}</span>
|
||||
<span class="ws-member-name">{{ scope.item.name }}</span>
|
||||
<span class="ws-member-email">{{ scope.item.email }}</span>
|
||||
</template>
|
||||
</el-autocomplete>
|
||||
</el-form-item>
|
||||
|
@ -75,7 +75,7 @@
|
|||
{{ $t('commons.adv_search.search') }}
|
||||
</el-button>
|
||||
<el-button size="small" @click="reset">
|
||||
{{$t('commons.adv_search.reset')}}
|
||||
{{ $t('commons.adv_search.reset') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -99,10 +99,17 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="operModule" :label="$t('operating_log.object')" show-overflow-tooltip width="120px"/>
|
||||
<el-table-column prop="operTitle" :label="$t('operating_log.name')" show-overflow-tooltip width="150px"/>
|
||||
<el-table-column prop="operTitle" :label="$t('operating_log.name')" show-overflow-tooltip width="150px">
|
||||
<template v-slot:default="scope">
|
||||
<el-link v-if="isLink(scope.row)" style="color: #409EFF" @click="clickResource(scope.row)">
|
||||
{{ scope.row.operTitle }}
|
||||
</el-link>
|
||||
<span v-else>{{ scope.row.operTitle }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('report.test_log_details')">
|
||||
<template v-slot:default="scope">
|
||||
<el-link style="color: #409EFF" @click="openDetail(scope.row)">{{$t('operating_log.info')}}</el-link>
|
||||
<el-link style="color: #409EFF" @click="openDetail(scope.row)">{{ $t('operating_log.info') }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -114,133 +121,60 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||
import MsTableOperator from "../../common/components/MsTableOperator";
|
||||
import {getCurrentProjectID, getCurrentUser, getCurrentWorkspaceId, hasRoles} from "@/common/js/utils";
|
||||
import {PROJECT_ID, ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER, WORKSPACE_ID} from "@/common/js/constants";
|
||||
import MsLogDetail from "./LogDetail";
|
||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||
import MsTableOperator from "../../common/components/MsTableOperator";
|
||||
import {getCurrentProjectID, getCurrentWorkspaceId, getUUID, hasRoles} from "@/common/js/utils";
|
||||
import {LOG_TYPE, LOG_TYPE_MAP, sysList, getUrl} from "./config";
|
||||
import MsLogDetail from "./LogDetail";
|
||||
|
||||
export default {
|
||||
name: "OperatingLog",
|
||||
components: {
|
||||
MsTablePagination, MsTableOperator, MsLogDetail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
props: {
|
||||
multiple: false,
|
||||
},
|
||||
result: {},
|
||||
form: {},
|
||||
currentPage: 0,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
items: [],
|
||||
condition: {},
|
||||
tableData: [],
|
||||
userList: [],
|
||||
screenHeight: 'calc(100vh - 215px)',
|
||||
LOG_TYPE: [
|
||||
{id: 'CREATE', label: this.$t('api_test.definition.request.create_info')},
|
||||
{id: 'DELETE', label: this.$t('commons.delete')},
|
||||
{id: 'UPDATE', label: this.$t('commons.update')},
|
||||
{id: 'IMPORT', label: this.$t('api_test.api_import.label')},
|
||||
{id: 'EXPORT', label: this.$t('commons.export')},
|
||||
{id: 'ASSOCIATE_CASE', label: this.$t('test_track.review_view.relevance_case')},
|
||||
{id: 'ASSOCIATE_ISSUE', label: this.$t('test_track.case.relate_issue')},
|
||||
{id: 'UN_ASSOCIATE_CASE', label: this.$t('test_track.case.unlink')},
|
||||
{id: 'REVIEW', label: this.$t('test_track.review_view.start_review')},
|
||||
{id: 'COPY', label: this.$t('commons.copy')},
|
||||
{id: 'EXECUTE', label: this.$t('api_test.automation.execute')},
|
||||
{id: 'CREATE_PRE_TEST', label: this.$t('api_test.create_performance_test')},
|
||||
{id: 'SHARE', label: this.$t('operating_log.share')},
|
||||
{id: 'LOGIN', label: this.$t('commons.login')},
|
||||
{id: 'RESTORE', label: this.$t('commons.reduction')},
|
||||
{id: 'DEBUG', label: this.$t('api_test.request.debug')},
|
||||
{id: 'GC', label: this.$t('api_test.automation.trash')},
|
||||
{id: 'BATCH_DEL', label: this.$t('api_test.definition.request.batch_delete')},
|
||||
{id: 'BATCH_UPDATE', label: this.$t('api_test.definition.request.batch_edit')},
|
||||
{id: 'BATCH_ADD', label: this.$t('commons.batch_add')},
|
||||
{id: 'BATCH_RESTORE', label: "批量恢复"},
|
||||
{id: 'BATCH_GC', label: "批量回收"}
|
||||
],
|
||||
LOG_TYPE_MAP: new Map([
|
||||
['CREATE', this.$t('api_test.definition.request.create_info')],
|
||||
['DELETE', this.$t('commons.delete')],
|
||||
['UPDATE', this.$t('commons.update')],
|
||||
['IMPORT', this.$t('api_test.api_import.label')],
|
||||
['EXPORT', this.$t('commons.export')],
|
||||
['ASSOCIATE_CASE', this.$t('test_track.review_view.relevance_case')],
|
||||
['ASSOCIATE_ISSUE', this.$t('test_track.case.relate_issue')],
|
||||
['UN_ASSOCIATE_CASE', this.$t('test_track.case.unlink')],
|
||||
['REVIEW', this.$t('test_track.review_view.start_review')],
|
||||
['COPY', this.$t('commons.copy')],
|
||||
['EXECUTE', this.$t('api_test.automation.execute')],
|
||||
['CREATE_PRE_TEST', this.$t('api_test.create_performance_test')],
|
||||
['SHARE', this.$t('operating_log.share')],
|
||||
['LOGIN', this.$t('commons.login')],
|
||||
['RESTORE', this.$t('commons.reduction')],
|
||||
['DEBUG', this.$t('api_test.request.debug')],
|
||||
['GC', this.$t('api_test.automation.trash')],
|
||||
['BATCH_DEL', this.$t('api_test.definition.request.batch_delete')],
|
||||
['BATCH_UPDATE', this.$t('api_test.definition.request.batch_edit')],
|
||||
['BATCH_ADD', this.$t('commons.batch_add')],
|
||||
['BATCH_RESTORE', "批量恢复"],
|
||||
['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() {
|
||||
switch (this.$route.name) {
|
||||
export default {
|
||||
name: "OperatingLog",
|
||||
components: {
|
||||
MsTablePagination, MsTableOperator, MsLogDetail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
props: {
|
||||
multiple: false,
|
||||
},
|
||||
result: {},
|
||||
form: {},
|
||||
currentPage: 0,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
items: [],
|
||||
condition: {},
|
||||
tableData: [],
|
||||
userList: [],
|
||||
screenHeight: 'calc(100vh - 215px)',
|
||||
LOG_TYPE: new LOG_TYPE(this),
|
||||
LOG_TYPE_MAP: new LOG_TYPE_MAP(this),
|
||||
sysList: sysList,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
switch (this.$route.name) {
|
||||
case "system":
|
||||
this.initProject("/project/listAll");
|
||||
this.getMember();
|
||||
break;
|
||||
case "organization":
|
||||
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
|
||||
this.getMember();
|
||||
break;
|
||||
case "workspace":
|
||||
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
|
||||
this.getMember();
|
||||
break;
|
||||
case "project":
|
||||
this.getProject();
|
||||
this.getMember();
|
||||
break;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$route'(to, from) {
|
||||
switch (to.name) {
|
||||
case "system":
|
||||
this.initProject("/project/listAll");
|
||||
this.getMember();
|
||||
|
@ -258,106 +192,122 @@
|
|||
this.getMember();
|
||||
break;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$route'(to, from) {
|
||||
switch (to.name) {
|
||||
case "system":
|
||||
this.initProject("/project/listAll");
|
||||
this.getMember();
|
||||
break;
|
||||
case "organization":
|
||||
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
|
||||
this.getMember();
|
||||
break;
|
||||
case "workspace":
|
||||
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
|
||||
this.getMember();
|
||||
break;
|
||||
case "project":
|
||||
this.getProject();
|
||||
this.getMember();
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSelect(item) {
|
||||
this.$set(this.condition, "operUser", item.id);
|
||||
},
|
||||
getMember() {
|
||||
this.result = this.$get('/user/list/', response => {
|
||||
this.userList = response.data;
|
||||
});
|
||||
},
|
||||
createFilter(queryString) {
|
||||
return (user) => {
|
||||
return (user.email.indexOf(queryString.toLowerCase()) === 0 || user.id.indexOf(queryString.toLowerCase()) === 0);
|
||||
};
|
||||
},
|
||||
querySearch(queryString, cb) {
|
||||
let userList = this.userList;
|
||||
let results = queryString ? userList.filter(this.createFilter(queryString)) : userList;
|
||||
// 调用 callback 返回建议列表的数据
|
||||
cb(results);
|
||||
},
|
||||
initTableData() {
|
||||
if (this.condition.operModules && this.condition.operModules.length > 0) {
|
||||
this.condition.operModule = this.condition.operModules[1];
|
||||
}
|
||||
let url = "/operating/log/list/" + this.currentPage + "/" + this.pageSize;
|
||||
this.result.loading = true;
|
||||
this.$post(url, this.condition, response => {
|
||||
this.tableData = response.data.listObject;
|
||||
this.total = response.data.itemCount;
|
||||
this.result.loading = false;
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
reset() {
|
||||
let projectIds = this.condition.projectIds;
|
||||
this.condition = {projectIds: projectIds};
|
||||
this.initTableData();
|
||||
},
|
||||
initProject(url) {
|
||||
this.condition = {};
|
||||
this.result = this.$get(url, response => {
|
||||
let projects = response.data;
|
||||
let projectIds = [];
|
||||
if (projects) {
|
||||
this.items = [];
|
||||
projects.forEach(item => {
|
||||
let data = {id: item.id, label: item.name};
|
||||
this.items.push(data);
|
||||
projectIds.push(item.id);
|
||||
})
|
||||
}
|
||||
this.condition.projectIds = projectIds;
|
||||
this.initTableData();
|
||||
})
|
||||
},
|
||||
getProject() {
|
||||
this.condition.projectIds = [];
|
||||
this.result = this.$get("/project/get/" + getCurrentProjectID(), response => {
|
||||
let project = response.data;
|
||||
this.items = [{id: project.id, label: project.name}];
|
||||
this.condition.projectIds = [project.id];
|
||||
this.condition.projectId = project.id;
|
||||
this.initTableData();
|
||||
});
|
||||
},
|
||||
getType(type) {
|
||||
return this.LOG_TYPE_MAP.get(type);
|
||||
},
|
||||
search() {
|
||||
this.initTableData();
|
||||
},
|
||||
openDetail(row) {
|
||||
this.$refs.logDetail.open(row.id);
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isLink(row) {
|
||||
if (!row.sourceId) {
|
||||
return false;
|
||||
}
|
||||
let uri = getUrl(row);
|
||||
if ((row.operType === 'UPDATE' || row.operType === 'ADD' || row.operType === 'EXECUTE' || row.operType === 'DEBUG') && uri !== "/#") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
clickResource(resource) {
|
||||
if (!resource.sourceId) {
|
||||
return;
|
||||
}
|
||||
let resourceId = resource.sourceId;
|
||||
if (resourceId && resourceId.startsWith("\"" || resourceId.startsWith("["))) {
|
||||
resourceId = JSON.parse(resource.sourceId);
|
||||
}
|
||||
if (resourceId instanceof Array) {
|
||||
resourceId = resourceId[0];
|
||||
}
|
||||
let uri = getUrl(resource);
|
||||
this.$get('/user/update/currentByResourceId/' + resourceId, () => {
|
||||
this.toPage(uri);
|
||||
});
|
||||
},
|
||||
toPage(uri) {
|
||||
let id = "new_a";
|
||||
let a = document.createElement("a");
|
||||
a.setAttribute("href", uri);
|
||||
a.setAttribute("target", "_blank");
|
||||
a.setAttribute("id", id);
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
|
||||
let element = document.getElementById(id);
|
||||
element.parentNode.removeChild(element);
|
||||
},
|
||||
handleSelect(item) {
|
||||
this.$set(this.condition, "operUser", item.id);
|
||||
},
|
||||
getMember() {
|
||||
this.result = this.$get('/user/list/', response => {
|
||||
this.userList = response.data;
|
||||
});
|
||||
},
|
||||
createFilter(queryString) {
|
||||
return (user) => {
|
||||
return (user.email.indexOf(queryString.toLowerCase()) === 0 || user.id.indexOf(queryString.toLowerCase()) === 0);
|
||||
};
|
||||
},
|
||||
querySearch(queryString, cb) {
|
||||
let userList = this.userList;
|
||||
let results = queryString ? userList.filter(this.createFilter(queryString)) : userList;
|
||||
// 调用 callback 返回建议列表的数据
|
||||
cb(results);
|
||||
},
|
||||
initTableData() {
|
||||
if (this.condition.operModules && this.condition.operModules.length > 0) {
|
||||
this.condition.operModule = this.condition.operModules[1];
|
||||
}
|
||||
let url = "/operating/log/list/" + this.currentPage + "/" + this.pageSize;
|
||||
this.result.loading = true;
|
||||
this.$post(url, this.condition, response => {
|
||||
this.tableData = response.data.listObject;
|
||||
this.total = response.data.itemCount;
|
||||
this.result.loading = false;
|
||||
})
|
||||
|
||||
},
|
||||
reset() {
|
||||
let projectIds = this.condition.projectIds;
|
||||
this.condition = {projectIds: projectIds};
|
||||
this.initTableData();
|
||||
},
|
||||
initProject(url) {
|
||||
this.condition = {};
|
||||
this.result = this.$get(url, response => {
|
||||
let projects = response.data;
|
||||
let projectIds = [];
|
||||
if (projects) {
|
||||
this.items = [];
|
||||
projects.forEach(item => {
|
||||
let data = {id: item.id, label: item.name};
|
||||
this.items.push(data);
|
||||
projectIds.push(item.id);
|
||||
})
|
||||
}
|
||||
this.condition.projectIds = projectIds;
|
||||
this.initTableData();
|
||||
})
|
||||
},
|
||||
getProject() {
|
||||
this.condition.projectIds = [];
|
||||
this.result = this.$get("/project/get/" + getCurrentProjectID(), response => {
|
||||
let project = response.data;
|
||||
this.items = [{id: project.id, label: project.name}];
|
||||
this.condition.projectIds = [project.id];
|
||||
this.condition.projectId = project.id;
|
||||
this.initTableData();
|
||||
});
|
||||
},
|
||||
getType(type) {
|
||||
return this.LOG_TYPE_MAP.get(type);
|
||||
},
|
||||
search() {
|
||||
this.initTableData();
|
||||
},
|
||||
openDetail(row) {
|
||||
this.$refs.logDetail.open(row.id);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -0,0 +1,154 @@
|
|||
export function LOG_TYPE(_this) {
|
||||
let LOG_TYPE = [
|
||||
{id: 'CREATE', label: _this.$t('api_test.definition.request.create_info')},
|
||||
{id: 'DELETE', label: _this.$t('commons.delete')},
|
||||
{id: 'UPDATE', label: _this.$t('commons.update')},
|
||||
{id: 'IMPORT', label: _this.$t('api_test.api_import.label')},
|
||||
{id: 'EXPORT', label: _this.$t('commons.export')},
|
||||
{id: 'ASSOCIATE_CASE', label: _this.$t('test_track.review_view.relevance_case')},
|
||||
{id: 'ASSOCIATE_ISSUE', label: _this.$t('test_track.case.relate_issue')},
|
||||
{id: 'UN_ASSOCIATE_CASE', label: _this.$t('test_track.case.unlink')},
|
||||
{id: 'REVIEW', label: _this.$t('test_track.review_view.start_review')},
|
||||
{id: 'COPY', label: _this.$t('commons.copy')},
|
||||
{id: 'EXECUTE', label: _this.$t('api_test.automation.execute')},
|
||||
{id: 'CREATE_PRE_TEST', label: _this.$t('api_test.create_performance_test')},
|
||||
{id: 'SHARE', label: _this.$t('operating_log.share')},
|
||||
{id: 'LOGIN', label: _this.$t('commons.login')},
|
||||
{id: 'RESTORE', label: _this.$t('commons.reduction')},
|
||||
{id: 'DEBUG', label: _this.$t('api_test.request.debug')},
|
||||
{id: 'GC', label: _this.$t('api_test.automation.trash')},
|
||||
{id: 'BATCH_DEL', label: _this.$t('api_test.definition.request.batch_delete')},
|
||||
{id: 'BATCH_UPDATE', label: _this.$t('api_test.definition.request.batch_edit')},
|
||||
{id: 'BATCH_ADD', label: _this.$t('commons.batch_add')},
|
||||
{id: 'BATCH_RESTORE', label: "批量恢复"},
|
||||
{id: 'BATCH_GC', label: "批量回收"}
|
||||
];
|
||||
return LOG_TYPE;
|
||||
}
|
||||
|
||||
export function LOG_TYPE_MAP(_this) {
|
||||
let LOG_TYPE_MAP = new Map([
|
||||
['CREATE', _this.$t('api_test.definition.request.create_info')],
|
||||
['DELETE', _this.$t('commons.delete')],
|
||||
['UPDATE', _this.$t('commons.update')],
|
||||
['IMPORT', _this.$t('api_test.api_import.label')],
|
||||
['EXPORT', _this.$t('commons.export')],
|
||||
['ASSOCIATE_CASE', _this.$t('test_track.review_view.relevance_case')],
|
||||
['ASSOCIATE_ISSUE', _this.$t('test_track.case.relate_issue')],
|
||||
['UN_ASSOCIATE_CASE', _this.$t('test_track.case.unlink')],
|
||||
['REVIEW', _this.$t('test_track.review_view.start_review')],
|
||||
['COPY', _this.$t('commons.copy')],
|
||||
['EXECUTE', _this.$t('api_test.automation.execute')],
|
||||
['CREATE_PRE_TEST', _this.$t('api_test.create_performance_test')],
|
||||
['SHARE', _this.$t('operating_log.share')],
|
||||
['LOGIN', _this.$t('commons.login')],
|
||||
['RESTORE', _this.$t('commons.reduction')],
|
||||
['DEBUG', _this.$t('api_test.request.debug')],
|
||||
['GC', _this.$t('api_test.automation.trash')],
|
||||
['BATCH_DEL', _this.$t('api_test.definition.request.batch_delete')],
|
||||
['BATCH_UPDATE', _this.$t('api_test.definition.request.batch_edit')],
|
||||
['BATCH_ADD', _this.$t('commons.batch_add')],
|
||||
['BATCH_RESTORE', "批量恢复"],
|
||||
['BATCH_GC', "批量回收"],
|
||||
]);
|
||||
return LOG_TYPE_MAP;
|
||||
}
|
||||
|
||||
export const 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}
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
export function getUrl(d) {
|
||||
let url = "/#";
|
||||
let resourceId = d.sourceId;
|
||||
if (resourceId && resourceId.startsWith("\"" || resourceId.startsWith("["))) {
|
||||
resourceId = JSON.parse(d.sourceId);
|
||||
}
|
||||
if (resourceId instanceof Array) {
|
||||
resourceId = resourceId[0];
|
||||
}
|
||||
switch (d.operModule) {
|
||||
case "接口自动化" || "Api automation" || "接口自動化":
|
||||
url += "/api/automation?resourceId=" + resourceId;
|
||||
break;
|
||||
case "测试计划" || "測試計劃" || "Test plan":
|
||||
url += "/track/plan/view/" + resourceId;
|
||||
break;
|
||||
case "用例评审" || "Case review" || "用例評審":
|
||||
url += "/track/review/view/" + resourceId;
|
||||
break;
|
||||
case "缺陷管理" || "Defect management":
|
||||
url += "/track/issue";
|
||||
break;
|
||||
case "SWAGGER_TASK" :
|
||||
url += "/api/definition";
|
||||
break;
|
||||
case "接口定义" || "接口定義" || "Api definition":
|
||||
url += "/api/definition?resourceId=" + resourceId;
|
||||
break;
|
||||
case "接口定义用例" || "接口定義用例" || "Api definition case":
|
||||
url += "/api/definition?caseId=" + resourceId;
|
||||
break;
|
||||
case "测试报告" || "測試報告" || "Test Report":
|
||||
url += "/api/automation/report";
|
||||
break;
|
||||
case "性能测试报告" || "性能測試報告" || "Performance test report" :
|
||||
url += "/performance/report/all";
|
||||
break;
|
||||
case "性能测试" || "性能測試" || "Performance test" :
|
||||
url += "/performance/test/edit/" + resourceId;
|
||||
break;
|
||||
case "测试用例" || "測試用例" || "Test case":
|
||||
url += "/track/case/all";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return url;
|
||||
}
|
Loading…
Reference in New Issue