Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2020-12-24 14:52:19 +08:00
commit 0d524415b6
10 changed files with 191 additions and 179 deletions

View File

@ -50,7 +50,7 @@
<el-table-column :label="$t('commons.operating')" width="200px" v-if="!referenced">
<template v-slot:default="{row}">
<div v-if="trashEnable">
<el-button type="text" @click="reductionApi(row)">恢复</el-button>
<el-button type="text" @click="reductionApi(row)">{{$t('commons.reduction')}}</el-button>
<el-button type="text" @click="remove(row)">{{ $t('api_test.automation.remove') }}</el-button>
</div>
<div v-else>

View File

@ -249,22 +249,13 @@
downloadFile("导出API.json", JSON.stringify(obj));
} else {
let condition = {};
if (this.isApiListEnable) {
let url = "/api/definition/list/1/100000";
condition.filters = ["Prepare", "Underway", "Completed"];
condition.projectId = getCurrentProjectID();
this.$post(url, condition, response => {
obj.data = response.data.listObject;
downloadFile("导出API.json", JSON.stringify(obj));
});
} else {
let url = "/api/testcase/list/";
condition.projectId = getCurrentProjectID();
this.$post(url, condition, response => {
obj.data = response.data;
downloadFile("导出API.json", JSON.stringify(obj));
});
}
let url = "/api/definition/list/1/100000";
condition.filters = ["Prepare", "Underway", "Completed"];
condition.projectId = getCurrentProjectID();
this.$post(url, condition, response => {
obj.data = response.data.listObject;
downloadFile("导出API.json", JSON.stringify(obj));
});
}
},
refresh(data) {

View File

@ -69,7 +69,7 @@
<el-table-column v-if="!isReadOnly && !isRelevanceModel" :label="$t('commons.operating')" min-width="130" align="center">
<template v-slot:default="scope">
<!--<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable">恢复</el-button>-->
<!--<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable">{{$t('commons.reduction')}}</el-button>-->
<el-button type="text" @click="handleTestCase(scope.row)" v-if="!trashEnable">{{$t('commons.edit')}}</el-button>
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C">{{$t('commons.delete')}}</el-button>
</template>

View File

@ -78,7 +78,7 @@
<el-table-column v-if="!isReadOnly && !isRelevance" :label="$t('commons.operating')" min-width="130" align="center">
<template v-slot:default="scope">
<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable">恢复</el-button>
<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable">{{$t('commons.reduction')}}</el-button>
<el-button type="text" @click="editApi(scope.row)" v-else>{{$t('commons.edit')}}</el-button>
<el-button type="text" @click="handleTestCase(scope.row)">{{$t('api_test.definition.request.case')}}</el-button>
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C">{{$t('commons.delete')}}</el-button>

View File

@ -1,123 +1,125 @@
<template>
<div>
<el-select class="protocol-select" size="small" v-model="condition.protocol">
<el-option
v-for="item in options"
:key="item.value"
:name="item.name"
:value="item.value"
:disabled="item.disabled">
</el-option>
</el-select>
<el-input class="filter-input" :class="{'read-only': isReadOnly}" :placeholder="$t('test_track.module.search')" v-model="condition.filterText" size="small">
<template v-slot:append>
<el-dropdown v-if="!isReadOnly" size="small" split-button type="primary" class="ms-api-button" @click="handleCommand('add-api')"
@command="handleCommand">
<el-button icon="el-icon-folder-add" @click="addApi"></el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="add-api">{{$t('api_test.definition.request.title')}}</el-dropdown-item>
<el-dropdown-item command="debug">{{$t('api_test.definition.request.fast_debug')}}</el-dropdown-item>
<el-dropdown-item command="import">{{$t('api_test.api_import.label')}}</el-dropdown-item>
<el-dropdown-item command="export">{{$t('report.export')}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-input>
<div>
<el-select class="protocol-select" size="small" v-model="condition.protocol">
<el-option
v-for="item in options"
:key="item.value"
:name="item.name"
:value="item.value"
:disabled="item.disabled">
</el-option>
</el-select>
<el-input class="filter-input" :class="{'read-only': isReadOnly}" :placeholder="$t('test_track.module.search')" v-model="condition.filterText"
size="small">
<template v-slot:append>
<el-dropdown v-if="!isReadOnly" size="small" split-button type="primary" class="ms-api-button" @click="handleCommand('add-api')"
v-tester
@command="handleCommand">
<el-button icon="el-icon-folder-add" @click="addApi"></el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="add-api">{{ $t('api_test.definition.request.title') }}</el-dropdown-item>
<el-dropdown-item command="debug">{{ $t('api_test.definition.request.fast_debug') }}</el-dropdown-item>
<el-dropdown-item command="import">{{ $t('api_test.api_import.label') }}</el-dropdown-item>
<el-dropdown-item command="export">{{ $t('report.export') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-input>
<module-trash-button v-if="!isReadOnly" :condition="condition" :exe="enableTrash"/>
<module-trash-button v-if="!isReadOnly" :condition="condition" :exe="enableTrash"/>
<ms-add-basis-api
:current-protocol="condition.protocol"
@saveAsEdit="saveAsEdit"
@refresh="refresh"
ref="basisApi"/>
<api-import ref="apiImport" @refresh="refresh"/>
</div>
<ms-add-basis-api
:current-protocol="condition.protocol"
@saveAsEdit="saveAsEdit"
@refresh="refresh"
ref="basisApi"/>
<api-import ref="apiImport" @refresh="refresh"/>
</div>
</template>
<script>
import {OPTIONS} from "../../model/JsonData";
import MsAddBasisApi from "../basis/AddBasisApi";
import ApiImport from "../import/ApiImport";
import ModuleTrashButton from "./ModuleTrashButton";
import {OPTIONS} from "../../model/JsonData";
import MsAddBasisApi from "../basis/AddBasisApi";
import ApiImport from "../import/ApiImport";
import ModuleTrashButton from "./ModuleTrashButton";
export default {
name: "ApiModuleHeader",
components: {ModuleTrashButton, ApiImport, MsAddBasisApi},
data() {
return {
options: OPTIONS,
}
},
props: {
condition: {
type: Object,
default() {
return {}
}
},
currentModule: {
type: Object,
default() {
return {}
}
},
isReadOnly: {
type: Boolean,
default() {
return false
}
}
},
methods: {
handleCommand(e) {
switch (e) {
case "debug":
this.$emit('debug');
break;
case "add-api":
this.addApi();
break;
case "add-module":
break;
case "import":
this.$refs.apiImport.open(this.currentModule);
break;
default:
this.$emit('exportAPI');
break;
}
},
addApi() {
this.$refs.basisApi.open(this.currentModule);
},
saveAsEdit(data) {
this.$emit('saveAsEdit', data);
},
refresh() {
this.$emit('refresh');
},
enableTrash() {
this.condition.trashEnable = true;
}
export default {
name: "ApiModuleHeader",
components: {ModuleTrashButton, ApiImport, MsAddBasisApi},
data() {
return {
options: OPTIONS,
}
},
props: {
condition: {
type: Object,
default() {
return {}
}
},
currentModule: {
type: Object,
default() {
return {}
}
},
isReadOnly: {
type: Boolean,
default() {
return false
}
}
},
methods: {
handleCommand(e) {
switch (e) {
case "debug":
this.$emit('debug');
break;
case "add-api":
this.addApi();
break;
case "add-module":
break;
case "import":
this.$refs.apiImport.open(this.currentModule);
break;
default:
this.$emit('exportAPI');
break;
}
},
addApi() {
this.$refs.basisApi.open(this.currentModule);
},
saveAsEdit(data) {
this.$emit('saveAsEdit', data);
},
refresh() {
this.$emit('refresh');
},
enableTrash() {
this.condition.trashEnable = true;
}
}
}
</script>
<style scoped>
.protocol-select {
width: 95px;
height: 30px;
}
.protocol-select {
width: 95px;
height: 30px;
}
.read-only {
width: 150px !important;
}
.read-only {
width: 150px !important;
}
.filter-input {
width: 175px;
padding-left: 3px;
}
.filter-input {
width: 175px;
padding-left: 3px;
}
</style>

View File

@ -11,7 +11,7 @@ import YanProgress from 'yan-progress';
import './permission' // permission control
import i18n from "../i18n/i18n";
import store from "./store";
import {permission, roles, xpack} from './permission'
import {permission, roles, tester, xpack} from './permission'
import chart from "../common/js/chart";
import CalendarHeatmap from "../common/js/calendar-heatmap";
import '../common/css/menu-header.css';
@ -41,6 +41,8 @@ Vue.directive('roles', roles);
Vue.directive('xpack', xpack);
Vue.directive('tester', tester);
new Vue({
el: '#app',
router,

View File

@ -1,6 +1,6 @@
import router from './components/common/router/router'
import {TokenKey} from '@/common/js/constants';
import {hasLicense, hasRolePermissions, hasRoles} from "@/common/js/utils";
import {checkoutTestManagerOrTestUser, hasLicense, hasRolePermissions, hasRoles} from "@/common/js/utils";
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
const whiteList = ['/login']; // no redirect whitelist
@ -25,6 +25,20 @@ export const xpack = {
}
};
export const tester = {
inserted(el, binding) {
checkTestManagerOrTestUser(el, binding);
}
};
function checkTestManagerOrTestUser(el, binding) {
let v = checkoutTestManagerOrTestUser();
if (!v) {
el.parentNode && el.parentNode.removeChild(el)
}
}
function checkLicense(el, binding, type) {
let v = hasLicense()

View File

@ -65,6 +65,7 @@ export default {
refresh: 'Refresh',
remark: 'Remark',
delete: 'Delete',
reduction: 'Reduction',
not_filled: 'Not filled',
please_select: 'Please select',
search_by_name: 'Search by name',

View File

@ -65,6 +65,7 @@ export default {
refresh: '刷新',
remark: '备注',
delete: '删除',
reduction: '恢复',
not_filled: '未填写',
please_select: '请选择',
search_by_name: '根据名称搜索',

View File

@ -65,6 +65,7 @@ export default {
refresh: '刷新',
remark: '備註',
delete: '刪除',
reduction: '恢复',
not_filled: '未填寫',
please_select: '請選擇',
search_by_name: '根據名稱搜索',
@ -796,88 +797,88 @@ export default {
suffixFormatErr: "文件格式不符合要求",
swagger_url_import: "使用URL導入",
},
home_page:{
unit_of_measurement:"個",
api_count_card:{
home_page: {
unit_of_measurement: "個",
api_count_card: {
title: "接口數量統計",
},
test_case_count_card:{
test_case_count_card: {
title: "接口用例數量統計",
},
test_scene_count_card:{
test_scene_count_card: {
title: "場景用例數量統計",
},
schedule_task_count_card:{
schedule_task_count_card: {
title: "定時任務數量統計",
},
detail_card:{
running:"進行中",
not_started:"未開始",
finished:"已完成",
uncoverage:"未覆蓋",
coverage:"已覆蓋",
unexecute:"未執行",
execution_failed:"未通過",
execution_pass:"已通過",
failed:"失敗",
success:"成功",
rate:{
completion:"完成率",
coverage:"覆蓋率",
pass:"通過率",
success:"成功率",
detail_card: {
running: "進行中",
not_started: "未開始",
finished: "已完成",
uncoverage: "未覆蓋",
coverage: "已覆蓋",
unexecute: "未執行",
execution_failed: "未通過",
execution_pass: "已通過",
failed: "失敗",
success: "成功",
rate: {
completion: "完成率",
coverage: "覆蓋率",
pass: "通過率",
success: "成功率",
},
},
api_details_card:{
api_details_card: {
title: "接口",
this_week_add:"本週新增: {0}个",
this_week_add: "本週新增: {0}个",
},
test_case_details_card:{
test_case_details_card: {
title: "用例",
this_week_add:"本週新增: {0}个",
this_week_execute:"本週執行: {0}次",
executed:"歷史總執行: {0}次",
this_week_add_sm:"本週新增:<br/>{0}个",
this_week_execute_sm:"本週執行:<br/>{0}次",
executed_sm:"歷史總執行:<br/>{0}次",
this_week_add: "本週新增: {0}个",
this_week_execute: "本週執行: {0}次",
executed: "歷史總執行: {0}次",
this_week_add_sm: "本週新增:<br/>{0}个",
this_week_execute_sm: "本週執行:<br/>{0}次",
executed_sm: "歷史總執行:<br/>{0}次",
},
test_scene_details_card:{
test_scene_details_card: {
title: "場景",
this_week_add:"本週新增: {0}个",
this_week_execute:"本週執行: {0}次",
executed:"歷史總執行: {0}次",
this_week_add_sm:"本週新增:<br/>{0}个",
this_week_execute_sm:"本週執行:<br/>{0}次",
executed_sm:"歷史總執行:<br/>{0}次",
this_week_add: "本週新增: {0}个",
this_week_execute: "本週執行: {0}次",
executed: "歷史總執行: {0}次",
this_week_add_sm: "本週新增:<br/>{0}个",
this_week_execute_sm: "本週執行:<br/>{0}次",
executed_sm: "歷史總執行:<br/>{0}次",
},
schedule_task_details_card:{
schedule_task_details_card: {
title: "定時任務",
this_week_add:"本週新增: {0}个",
this_week_execute:"本週執行: {0}次",
executed:"歷史總執行: {0}次",
this_week_add_sm:"本週新增:<br/>{0}个",
this_week_execute_sm:"本週執行:<br/>{0}次",
executed_sm:"歷史總執行:<br/>{0}次",
this_week_add: "本週新增: {0}个",
this_week_execute: "本週執行: {0}次",
executed: "歷史總執行: {0}次",
this_week_add_sm: "本週新增:<br/>{0}个",
this_week_execute_sm: "本週執行:<br/>{0}次",
executed_sm: "歷史總執行:<br/>{0}次",
},
failed_case_list:{
failed_case_list: {
title: "過去7天測試計畫失敗用例TOP 10",
table_coloum:{
table_coloum: {
index: "排名",
case_name: "用例名稱",
case_type: "用例類型",
test_plan: "所屬測試計畫",
failure_times: "失敗次數",
},
table_value:{
case_type:{
table_value: {
case_type: {
api: "接口用例",
scene: "場景用例",
}
}
},
running_task_list:{
running_task_list: {
title: "運行中的定時任務",
table_coloum:{
table_coloum: {
index: "序號",
scenario: "場景名稱",
run_rule: "運行規則",
@ -886,7 +887,7 @@ export default {
create_user: "創建人",
update_time: "更新時間",
},
confirm:{
confirm: {
close_title: "要關閉這條定時任務嗎?",
}
}