diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json index 38e75bba5c..2631624acc 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -3657,6 +3657,7 @@ "同主机关联的其他集群,勾选后一并添加": "同主机关联的其他集群,勾选后一并添加", "点击上传": "点击上传", "请选择本地 SQL 文件": "请选择本地 SQL 文件", + "忽略错误": "忽略错误", + "强制失败节点成功": "强制失败节点成功", "这行勿动!新增翻译请在上一行添加!": "" - } diff --git a/dbm-ui/frontend/src/services/source/dbresourceResource.ts b/dbm-ui/frontend/src/services/source/dbresourceResource.ts index 1e7d81a36c..8aa2ee64c8 100644 --- a/dbm-ui/frontend/src/services/source/dbresourceResource.ts +++ b/dbm-ui/frontend/src/services/source/dbresourceResource.ts @@ -176,9 +176,9 @@ export function getSpecResourceCount(params: { export function updateResource(params: { bk_host_ids: number[]; for_biz?: number; - rack_id: string; + rack_id?: string; resource_type?: string; - storage_device: Record; + storage_device?: Record; }) { return http.post(`${path}/update/`, params); } diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/batch-setting/Index.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/batch-setting/Index.vue index aab44ad364..33035f45db 100644 --- a/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/batch-setting/Index.vue +++ b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/batch-setting/Index.vue @@ -167,9 +167,13 @@ ); const params = { bk_host_ids: props.data.map((item) => ~~item), - rack_id: formData.rack_id, - storage_device: storageDevice, }; + if (formData.rack_id !== '') { + Object.assign(params, { rack_id: formData.rack_id }); + } + if (Object.values(storageDevice).length > 0) { + Object.assign(params, { storage_device: storageDevice }); + } if (formData.for_biz !== '') { Object.assign(params, { for_biz: Number(formData.for_biz) }); } diff --git a/dbm-ui/frontend/src/views/task-history/common/graphRender.tsx b/dbm-ui/frontend/src/views/task-history/common/graphRender.tsx index 355cc1e13d..e06d4356d4 100644 --- a/dbm-ui/frontend/src/views/task-history/common/graphRender.tsx +++ b/dbm-ui/frontend/src/views/task-history/common/graphRender.tsx @@ -230,7 +230,16 @@ export default class GraphRender { {flowInfo.status !== 'REVOKED' && node.children === undefined && (
- {!node.isTodoNode && status === 'RUNNING' && ( + {node.isTodoNode ? ( + + ) : ( + '' + )} + {status === 'RUNNING' && ( - ) : ( - '' - )}
)} diff --git a/dbm-ui/frontend/src/views/task-history/components/NodeLog.vue b/dbm-ui/frontend/src/views/task-history/components/NodeLog.vue index 27ec7d4c64..2d4752fc3f 100644 --- a/dbm-ui/frontend/src/views/task-history/components/NodeLog.vue +++ b/dbm-ui/frontend/src/views/task-history/components/NodeLog.vue @@ -310,7 +310,7 @@ * 设置日志 */ const handleSetLog = (data: NodeLog[] = []) => { - logRef.value.handleLogAdd(data); + logRef.value?.handleLogAdd(data); }; /** 当前选中日志版本的信息 */ diff --git a/dbm-ui/frontend/src/views/task-history/components/PreviewNodeTree.vue b/dbm-ui/frontend/src/views/task-history/components/PreviewNodeTree.vue index abe0790b55..c5e0a0847b 100644 --- a/dbm-ui/frontend/src/views/task-history/components/PreviewNodeTree.vue +++ b/dbm-ui/frontend/src/views/task-history/components/PreviewNodeTree.vue @@ -25,6 +25,7 @@ :children="children" class="tree-node-tree-main" :data="nodesTreeData" + expand-all label="name" node-key="id" selectable @@ -75,7 +76,12 @@ interface Props { nodesCount: number; - nodesTreeData: Array; + nodesTreeData: Array< + NodeType & { + failedChildren?: NodeType[]; + todoChildren?: NodeType[]; + } + >; statusKeypath: string; titleKeypath: string; tooltips: string; @@ -85,7 +91,13 @@ } interface Emits { - (e: 'node-click', value: Props['nodesTreeData'][number], refValue: typeof treeRef, isShowLog: boolean): void; + ( + e: 'node-click', + value: Props['nodesTreeData'][number], + refValue: typeof treeRef, + isShowLog: boolean, + theme: NonNullable, + ): void; (e: 'after-show', value: typeof treeRef): void; } @@ -95,7 +107,7 @@ isOpen: () => boolean; } - withDefaults(defineProps(), { + const props = withDefaults(defineProps(), { theme: 'error', children: 'children', marginRight: false, @@ -114,8 +126,8 @@ }; const handleNodeClick = (node: Props['nodesTreeData'][number]) => { - const iShowLog = !node.failedChildren; - emits('node-click', node, treeRef, iShowLog); + const iShowLog = !node.failedChildren && !node.todoChildren; + emits('node-click', node, treeRef, iShowLog, props.theme); }; const handleNodePanelSwich = () => { diff --git a/dbm-ui/frontend/src/views/task-history/pages/Details.vue b/dbm-ui/frontend/src/views/task-history/pages/Details.vue index 2ac21b6ce4..fcc159aa5c 100644 --- a/dbm-ui/frontend/src/views/task-history/pages/Details.vue +++ b/dbm-ui/frontend/src/views/task-history/pages/Details.vue @@ -357,7 +357,7 @@ import { batchRetryNodes, - forceFailflowNode, + // forceFailflowNode, getTaskflowDetails, retryTaskflowNode, revokePipeline, @@ -509,8 +509,8 @@ node: {} as GraphNode, }); - let isFindFirstLeafFailNode = false; - let isFindFirstLeafTodoNode = false; + // let isFindFirstLeafFailNode = false; + // const isFindFirstLeafTodoNode = false; const rootId = computed(() => route.params.root_id as string); @@ -681,7 +681,7 @@ }) watch(failNodesCount, () => { - isFindFirstLeafFailNode = false; + // isFindFirstLeafFailNode = false; failLeafNodes.value = [] expandFailedNodeObjects = [] failNodesTreeData.value = flowState.details.flow_info?.status === 'FAILED' ? generateFailNodesTree(flowState.details.activities) : []; @@ -693,9 +693,9 @@ }) watch(todoNodesCount, () => { - isFindFirstLeafTodoNode = false + // isFindFirstLeafTodoNode = false expandTodoNodeObjects = [] - const todoNodeIdList = getTodoNodeIdList(flowState.details) + const todoNodeIdList = getTodoNodeIdList(flowState.details); todoNodesTreeData.value = todoNodeIdList.length ? generateTodoNodesTree(flowState.details.activities, todoNodeIdList) : []; setTreeOpen([ @@ -734,16 +734,16 @@ Object.values(activities).forEach(item => { if (item.status === 'FAILED') { flowList.push(item); - if (!isFindFirstLeafFailNode) { + // if (!isFindFirstLeafFailNode) { expandNodes.push(item.id); expandFailedNodeObjects.push(item); - } + // } if (item.pipeline) { Object.assign(item, { failedChildren: generateFailNodesTree(item.pipeline.activities), }); } else { - isFindFirstLeafFailNode = true; + // isFindFirstLeafFailNode = true; // failNodesCount.value = failNodesCount.value + 1; failLeafNodes.value.push({ data: _.cloneDeep(item) } as GraphNode) } @@ -762,11 +762,11 @@ }); if (activityChildren.length > 0) { flowList.push(activityItem) - if (!isFindFirstLeafTodoNode) { - isFindFirstLeafTodoNode = true + // if (!isFindFirstLeafTodoNode) { + // isFindFirstLeafTodoNode = true expandNodes.push(activityItem.id); expandTodoNodeObjects.push(activityItem); - } + // } } } else { if (nodeList.includes(activityItem.id)) { @@ -797,9 +797,9 @@ const handleNodeTreeAfterShow = (treeRef: Ref, isFailed = true) => { setTimeout(() => { const expandNodeObjects = isFailed ? expandFailedNodeObjects : expandTodoNodeObjects - expandNodeObjects.forEach(node => { - treeRef.value.setOpen(node); - }); + // expandNodeObjects.forEach(node => { + // treeRef.value.setOpen(node); + // }); const leafNode = expandNodeObjects[expandNodeObjects.length - 1]; treeRef.value.setSelect(leafNode); @@ -829,19 +829,20 @@ } // 点击父节点展开,点击叶子节点定位 - const handleTreeNodeClick = (node: TaskflowList[number], treeRef: Ref, showLog = true) => { + const handleTreeNodeClick = (node: TaskflowList[number], treeRef: Ref, showLog = true, theme: 'error' | 'warning') => { // eslint-disable-next-line no-underscore-dangle const { scale } = flowState.instance.flowInstance._diagramInstance._canvasTransform; + const isErrorTree = theme === 'error'; expandRetractNodes(node, treeRef, showLog) setTimeout(() => { const graphNode = flowState.instance.graphData.locations.find((item: GraphNode) => item.data.id === node.id); - if (showLog) { + if (showLog && isErrorTree) { handleShowLog(graphNode); } - const children = showLog ? node.failedChildren : node.todoChildren + const children = isErrorTree ? node.failedChildren : node.todoChildren; if (!children) { const x = ((flowRef.value!.clientWidth / 2) - graphNode.x) * scale; const y = ((flowRef.value!.clientHeight / 2) - graphNode.y - 128) * scale; @@ -1017,13 +1018,29 @@ * 强制失败节点 */ const handleForceFail = (node: GraphNode) => { - forceFailflowNode({ - root_id: rootId.value, - node_id: node.data.id, - }).then(() => { - renderNodes(); - fetchTaskflowDetails(); - }); + const todoItem = flowState.details.todos!.find(todoItem => todoItem.context.node_id === node.id) + if (todoItem) { + ticketBatchProcessTodo({ + action: "TERMINATE", + operations: [ + { + todo_id: todoItem.id, + params: {} + } + ]}) + .then(() => { + renderNodes(); + fetchTaskflowDetails(); + messageSuccess(t('强制失败节点成功')); + }) + } + // forceFailflowNode({ + // root_id: rootId.value, + // node_id: node.data.id, + // }).then(() => { + // renderNodes(); + // fetchTaskflowDetails(); + // }); }; const handleTodoAllPipeline = () => {