refactor(接口定义): 优化批量生成依赖关系数据量大时给出友好提示

--bug=1014704 --user=王孝刚
【接口测试】github#15559,接口自动化批量生成依赖关系图时,当选择所有数据时,生成失败并报错
https://www.tapd.cn/55049933/s/1201988
This commit is contained in:
wxg0103 2022-07-14 15:31:46 +08:00 committed by f2c-ci-robot[bot]
parent 76b8ead757
commit 9a407e4b4d
6 changed files with 23 additions and 4 deletions

View File

@ -315,7 +315,7 @@ import {
hasLicense, hasLicense,
hasPermission, hasPermission,
objToStrMap, objToStrMap,
strMapToObj strMapToObj,
} from "@/common/js/utils"; } from "@/common/js/utils";
import {API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components"; import {API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components";
import {API_SCENARIO_LIST} from "../../../../../common/js/constants"; import {API_SCENARIO_LIST} from "../../../../../common/js/constants";
@ -324,7 +324,8 @@ import {
buildBatchParam, buildBatchParam,
getCustomTableHeader, getCustomTableHeader,
getCustomTableWidth, getCustomTableWidth,
getLastTableSortField getLastTableSortField,
getSelectDataCounts
} from "@/common/js/tableUtils"; } from "@/common/js/tableUtils";
import {API_SCENARIO_FILTERS} from "@/common/js/table-constants"; import {API_SCENARIO_FILTERS} from "@/common/js/table-constants";
import MsTable from "@/business/components/common/components/table/MsTable"; import MsTable from "@/business/components/common/components/table/MsTable";
@ -682,6 +683,10 @@ export default {
}, },
methods: { methods: {
generateGraph() { generateGraph() {
if (getSelectDataCounts(this.condition, this.total, this.selectRows) > 100) {
this.$warning(this.$t('test_track.case.generate_dependencies_warning'));
return;
}
getGraphByCondition('API_SCENARIO', buildBatchParam(this, this.$refs.scenarioTable.selectIds), (data) => { getGraphByCondition('API_SCENARIO', buildBatchParam(this, this.$refs.scenarioTable.selectIds), (data) => {
this.graphData = data; this.graphData = data;
this.$refs.relationshipGraph.open(); this.$refs.relationshipGraph.open();

View File

@ -247,6 +247,7 @@ import {
getCustomTableHeader, getCustomTableHeader,
getCustomTableWidth, getCustomTableWidth,
getLastTableSortField, getLastTableSortField,
getSelectDataCounts,
initCondition initCondition
} from "@/common/js/tableUtils"; } from "@/common/js/tableUtils";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
@ -565,6 +566,10 @@ export default {
}); });
}, },
generateGraph() { generateGraph() {
if (getSelectDataCounts(this.condition, this.total, this.selectRows) > 100) {
this.$warning(this.$t('test_track.case.generate_dependencies_warning'));
return;
}
getGraphByCondition('API', buildBatchParam(this, this.$refs.table.selectIds), (data) => { getGraphByCondition('API', buildBatchParam(this, this.$refs.table.selectIds), (data) => {
this.graphData = data; this.graphData = data;
this.$refs.relationshipGraph.open(); this.$refs.relationshipGraph.open();

View File

@ -255,10 +255,12 @@ import {
buildBatchParam, buildBatchParam,
deepClone, deepClone,
getCustomFieldBatchEditOption, getCustomFieldBatchEditOption,
getCustomFieldValue, getCustomTableHeader, getCustomFieldValue,
getCustomTableHeader,
getCustomTableWidth, getCustomTableWidth,
getLastTableSortField, getLastTableSortField,
getPageInfo, getPageInfo,
getSelectDataCounts,
getTableHeaderWithCustomFields, getTableHeaderWithCustomFields,
initCondition, initCondition,
} from "@/common/js/tableUtils"; } from "@/common/js/tableUtils";
@ -953,6 +955,10 @@ export default {
}); });
}, },
generateGraph() { generateGraph() {
if (getSelectDataCounts(this.condition, this.total, this.selectRows) > 100) {
this.$warning(this.$t('test_track.case.generate_dependencies_warning'));
return;
}
getGraphByCondition('TEST_CASE', buildBatchParam(this, this.$refs.table.selectIds), (data) => { getGraphByCondition('TEST_CASE', buildBatchParam(this, this.$refs.table.selectIds), (data) => {
this.graphData = data; this.graphData = data;
this.$refs.relationshipGraph.open(); this.$refs.relationshipGraph.open();
@ -1242,7 +1248,7 @@ export default {
margin-left: 10px; margin-left: 10px;
} }
/deep/ .el-table{ /deep/ .el-table {
overflow: auto; overflow: auto;
} }
</style> </style>

View File

@ -2110,6 +2110,7 @@ export default {
batch_add_public: 'Batch add public', batch_add_public: 'Batch add public',
public_warning: 'The public library configuration is not enabled', public_warning: 'The public library configuration is not enabled',
generate_dependencies: 'Generate dependencies', generate_dependencies: 'Generate dependencies',
generate_dependencies_warning: 'For a better experience, it is recommended to check the data below 100',
batch_delete_case: 'Batch delete', batch_delete_case: 'Batch delete',
batch_unlink: 'Batch Unlink', batch_unlink: 'Batch Unlink',
unlink: 'Unlink', unlink: 'Unlink',

View File

@ -2112,6 +2112,7 @@ export default {
batch_add_public: '批量添加到公共用例库', batch_add_public: '批量添加到公共用例库',
public_warning: '未开启公共库用例配置', public_warning: '未开启公共库用例配置',
generate_dependencies: '生成依赖关系', generate_dependencies: '生成依赖关系',
generate_dependencies_warning: '为了更好的体验,建议勾选一百条以下的数据',
batch_unlink: '批量取消关联', batch_unlink: '批量取消关联',
unlink: '取消关联', unlink: '取消关联',
project_name: '所属项目', project_name: '所属项目',

View File

@ -2110,6 +2110,7 @@ export default {
batch_add_public: '批量添加到公共用例庫', batch_add_public: '批量添加到公共用例庫',
public_warning: '未開啟公共庫用例配置', public_warning: '未開啟公共庫用例配置',
generate_dependencies: '生成依賴關系', generate_dependencies: '生成依賴關系',
generate_dependencies_warning: '為了更好的體驗,建議勾選一百條以下的數據',
batch_unlink: '批量取消關聯', batch_unlink: '批量取消關聯',
unlink: '取消關聯', unlink: '取消關聯',
project_name: '所屬項目', project_name: '所屬項目',