Merge remote-tracking branch 'origin/master'

This commit is contained in:
q4speed 2020-08-10 17:04:56 +08:00
commit 27b5d37033
13 changed files with 191 additions and 11 deletions

View File

@ -154,7 +154,7 @@
</include>
</if>
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
and test_case.node_id in

View File

@ -126,7 +126,7 @@
</include>
</if>
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like CONCAT('%', #{request.name},'%'))
</if>
<if test="request.id != null">
and test_case.id = #{request.id}
@ -185,7 +185,14 @@
<if test="request.orders != null and request.orders.size() > 0">
order by
<foreach collection="request.orders" separator="," item="order">
<choose>
<when test="order.name == 'num'">
test_case.num ${order.type}
</when>
<otherwise>
test_plan_test_case.${order.name} ${order.type}
</otherwise>
</choose>
</foreach>
</if>
</select>

View File

@ -76,6 +76,7 @@
</span>
<p>{{ $t('api_test.request.parameters_filter_example') }}@string(10) | md5 | substr: 1, 3</p>
<p>{{ $t('api_test.request.parameters_filter_example') }}@integer(1, 5) | concat:_metersphere</p>
<p><strong>{{ $t('api_test.request.parameters_filter_tips') }}</strong></p>
</div>
</div>
</el-dialog>
@ -84,7 +85,7 @@
<script>
import {KeyValue} from "../model/ScenarioModel";
import {MOCKJS_FUNC} from "@/common/js/constants";
import {JMETER_FUNC, MOCKJS_FUNC} from "@/common/js/constants";
import {calculate} from "@/business/components/api/test/model/ScenarioModel";
export default {
@ -159,7 +160,7 @@ export default {
};
},
funcSearch(queryString, cb) {
let funcs = MOCKJS_FUNC;
let funcs = MOCKJS_FUNC.concat(JMETER_FUNC);
let results = queryString ? funcs.filter(this.funcFilter(queryString)) : funcs;
// callback
cb(results);

View File

@ -43,6 +43,10 @@ export const calculate = function (itemValue) {
return;
}
try {
if (itemValue.trim().startsWith("${")) {
// jmeter 内置函数不做处理
return itemValue;
}
let funcs = itemValue.split("|");
let value = Mock.mock(funcs[0].trim());
if (funcs.length === 1) {

View File

@ -33,6 +33,7 @@ import TestTrack from "../../track/TestTrack";
import ApiReportList from "../../api/report/ApiReportList";
import axios from "axios";
import ApiKeys from "../../settings/personal/ApiKeys";
import ServiceIntegration from "../../settings/organization/ServiceIntegration";
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/)
@ -70,6 +71,10 @@ const router = new VueRouter({
path: 'organizationworkspace',
component: OrganizationWorkspace,
},
{
path: 'serviceintegration',
component: ServiceIntegration,
},
{
path: 'personsetting',
component: PersonSetting

View File

@ -21,6 +21,8 @@
</el-menu-item>
<el-menu-item index="/setting/organizationworkspace" v-permission="['org_admin']">{{$t('commons.workspace')}}
</el-menu-item>
<el-menu-item index="/setting/serviceintegration" v-permission="['org_admin']">服务集成
</el-menu-item>
</el-submenu>
<el-submenu index="3" v-permission="['test_manager']" v-if="isCurrentWorkspaceUser">

View File

@ -0,0 +1,85 @@
<template>
<el-card class="header-title">
<div>
<div>请选择要集成的缺陷管理平台</div>
<el-radio-group v-model="platform" style="margin-top: 10px">
<el-radio v-for="(item, index) in platforms" :key="index" :label="item.value" size="small">
{{item.name}}
</el-radio>
</el-radio-group>
</div>
<div style="width: 500px">
<div style="margin-top: 20px;margin-bottom: 10px">Basic Auth账号信息</div>
<el-form :model="form" ref="form" label-width="100px" size="small">
<el-form-item label="API 账号" prop="account">
<el-input v-model="form.account" placeholder="请输入账号"/>
</el-form-item>
<el-form-item label="API 口令" prop="password">
<el-input v-model="form.password" auto-complete="new-password" placeholder="请输入口令" show-password/>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="submit('form')" style="width: 400px">
保存
</el-button>
</el-form-item>
</el-form>
</div>
<div class="defect-tip">
<div>使用指引</div>
<div>
1. Basic Auth 账号信息在"公司管理-安全与集成-开放平台"中查询
</div>
<div>
2. 保存 Basic Auth 账号信息后需要在 Metersphere 项目中手动关联 ID/key
<router-link to="/track/project/all" style="margin-left: 5px">马上关联项目</router-link>
</div>
</div>
</el-card>
</template>
<script>
export default {
name: "DefectManagement",
data() {
return {
form: {},
platform: '',
platforms: [
{
name: 'TAPD',
value: 'tapd',
},
{
name: 'JIRA',
value: 'jira',
}
],
rules: {
account: {required: true, message: "请输入账号", trigger: ['change', 'blur']},
password: {required: true, message: "请输入密码", trigger: ['change', 'blur']}
},
}
},
methods: {
submit(form) {
}
}
}
</script>
<style scoped>
.header-title {
padding: 10px 30px;
}
.defect-tip {
background: #EDEDED;
border: solid #E1E1E1 1px;
margin: 10px 0;
padding: 10px;
border-radius: 3px;
}
</style>

View File

@ -0,0 +1,30 @@
<template>
<div>
<el-tabs class="system-setting" v-model="activeName">
<el-tab-pane label="缺陷管理平台" name="defect">
<defect-management/>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import DefectManagement from "./DefectManagement";
export default {
name: "ServiceIntegration",
components: {
DefectManagement
},
data() {
return {
activeName: 'defect'
}
}
}
</script>
<style scoped>
</style>

View File

@ -55,6 +55,7 @@
</el-table-column>
<el-table-column
prop="num"
sortable="custom"
:label="$t('commons.id')"
show-overflow-tooltip>
</el-table-column>
@ -497,6 +498,10 @@
this.initTableData();
},
sort(column) {
//
if (this.condition.orders) {
this.condition.orders = [];
}
_sort(column, this.condition);
this.initTableData();
},

View File

@ -111,3 +111,41 @@ export const MOCKJS_FUNC = [
{name: '@id'},
{name: '@increment'}
]
export const JMETER_FUNC = [
{name: "${__threadNum}"},
{name: "${__samplerName}"},
{name: "${__machineIP}"},
{name: "${__machineName}"},
{name: "${__time}"},
{name: "${__log}"},
{name: "${__logn}"},
{name: "${__StringFromFile}"},
{name: "${__FileToString}"},
{name: "${__CSVRead}"},
{name: "${__XPath}"},
{name: "${__counter}"},
{name: "${__intSum}"},
{name: "${__longSum}"},
{name: "${__Random}"},
{name: "${__RandomString}"},
{name: "${__UUID}"},
{name: "${__BeanShell}"},
{name: "${__javaScript}"},
{name: "${__jexl}"},
{name: "${__jexl2}"},
{name: "${__property}"},
{name: "${__P}"},
{name: "${__setProperty}"},
{name: "${__split}"},
{name: "${__V}"},
{name: "${__eval}"},
{name: "${__evalVar}"},
{name: "${__regexFunction}"},
{name: "${__escapeOroRegexpChars}"},
{name: "${__char}"},
{name: "${__unescape}"},
{name: "${__unescapeHtml}"},
{name: "${__escapeHtml}"},
{name: "${__TestPlanName}"},
]

View File

@ -387,6 +387,7 @@ export default {
path_description: "etc/login",
parameters: "Query parameters",
parameters_filter_example: "Example",
parameters_filter_tips: "Only support MockJs function result preview",
parameters_advance: "Advanced parameter settings",
parameters_preview: "Preview",
parameters_preview_warning: "Please enter the template first",
@ -497,9 +498,9 @@ export default {
execution_result: ": Please select the execution result",
actual_result: ": The actual result is empty",
case: {
input_test_case:'Please enter the associated case name',
test_name:'TestName',
other:'--Other--',
input_test_case: 'Please enter the associated case name',
test_name: 'TestName',
other: '--Other--',
test_case: "Case",
move: "Move case",
case_list: "Test case list",

View File

@ -387,6 +387,7 @@ export default {
parameters_filter: "内置函数",
parameters_filter_desc: "使用方法",
parameters_filter_example: "示例",
parameters_filter_tips: "只支持 MockJs 函数结果预览",
parameters_advance: "高级参数设置",
parameters_preview: "预览",
parameters_preview_warning: "请先输入模版",

View File

@ -386,6 +386,7 @@ export default {
url_invalid: "URL無效",
parameters: "請求參數",
parameters_filter_example: "示例",
parameters_filter_tips: "只支持MockJs函數結果預覽",
parameters_advance: "高級參數設置",
parameters_preview: "預覽",
parameters_preview_warning: "請先輸入模版",
@ -496,9 +497,9 @@ export default {
execution_result: ": 請選擇執行結果",
actual_result: ": 實際結果為空",
case: {
input_test_case:'請輸入關聯用例名稱',
test_name:'測試名稱',
other:'--其他--',
input_test_case: '請輸入關聯用例名稱',
test_name: '測試名稱',
other: '--其他--',
test_case: "測試用例",
move: "移動用例",
case_list: "用例列表",