refactor(测试跟踪): 脑图粘贴未加载用例的模块提示优化

--bug=1022391 --user=陈建星 【测试跟踪】功能用例-脑图模式-当只展开到模块层级时复制模块到其它模块下-用例未复制过去 https://www.tapd.cn/55049933/s/1343914
This commit is contained in:
chenjianxing 2023-02-28 18:23:29 +08:00 committed by jianxing
parent 338a7c44d8
commit 728ea1bcfd
5 changed files with 31 additions and 2 deletions

View File

@ -53,7 +53,7 @@ import {
getChildNodeId,
handleAfterSave,
handleExpandToLevel,
handleMinderIssueDelete, handlePasteAfter, handleSaveError,
handleMinderIssueDelete, handlePasteAfter, handlePasteTip, handleSaveError,
handleTestCaseAdd,
handTestCaeEdit,
isCaseNodeData,
@ -251,6 +251,7 @@ export default {
}
if ('paste' === even.commandName) {
handlePasteTip(window.minder.getSelectedNode());
handlePasteAfter(window.minder.getSelectedNode());
}

View File

@ -1,6 +1,6 @@
import i18n from "@/i18n";
import {getCurrentProjectID, getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token";
import {$success, $warning} from "metersphere-frontend/src/plugins/message";
import {$success, $warning, $info} from "metersphere-frontend/src/plugins/message";
import {deleteIssueRelate} from "@/api/issue";
import {minderPageInfoMap} from "@/api/testCase";
import {setPriorityView} from "vue-minder-editor-plus/src/script/tool/utils";
@ -571,6 +571,31 @@ export function handlePasteAfter(rootNode) {
}
}
export function handlePasteTip(rootNode) {
if (hasUnloadedNode(rootNode)) {
$info(i18n.t('case.minder_paste_tip'));
}
}
/**
* 判断节点下面是否有没有加载过用例的模块节点
* @param rootNode
* @returns {boolean}
*/
export function hasUnloadedNode(rootNode) {
if (isModuleNode(rootNode) && !rootNode.data.loaded) {
return true;
}
if (rootNode.children) {
for (let i = 0; i < rootNode.children.length; i++) {
if (hasUnloadedNode(rootNode.children[i])) {
return true;
}
}
}
return false;
}
export function getChildNodeId(rootNode, nodeIds) {
//递归获取所有子节点ID
if (rootNode.data.id) {

View File

@ -19,6 +19,7 @@ const message = {
case_type: "Case Type",
test_plan: "Test Plan",
failure_times: "Failure times",
minder_paste_tip: "The pasted node has modules with unloaded use cases, copying unloaded use cases is not currently supported!"
},
rate: {
case_review: "Review rate",

View File

@ -19,6 +19,7 @@ const message = {
case_type: "用例类型",
test_plan: "所属测试计划",
failure_times: "失败次数",
minder_paste_tip: "粘贴的节点中有未加载用例的模块,目前不支持复制未加载的用例!"
},
rate: {
case_review: "评审率",

View File

@ -19,6 +19,7 @@ const message = {
case_type: "用例類型",
test_plan: "所屬測試計劃",
failure_times: "失敗次數",
minder_paste_tip: "粘貼的節點中有未加載用例的模塊,目前不支持復製未加載的用例!"
},
rate: {
case_review: "評審率",