Skip to content

Commit

Permalink
fix(frontend): 人工确认问题修复 #8288
Browse files Browse the repository at this point in the history
  • Loading branch information
jinquantianxia authored and iSecloud committed Dec 2, 2024
1 parent 797f039 commit 4658332
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 46 deletions.
3 changes: 2 additions & 1 deletion dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3657,6 +3657,7 @@
"同主机关联的其他集群,勾选后一并添加": "同主机关联的其他集群,勾选后一并添加",
"点击上传": "点击上传",
"请选择本地 SQL 文件": "请选择本地 SQL 文件",
"忽略错误": "忽略错误",
"强制失败节点成功": "强制失败节点成功",
"这行勿动!新增翻译请在上一行添加!": ""

}
4 changes: 2 additions & 2 deletions dbm-ui/frontend/src/services/source/dbresourceResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, { size: number; disk_type: string }>;
storage_device?: Record<string, { size: number; disk_type: string }>;
}) {
return http.post(`${path}/update/`, params);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) });
}
Expand Down
20 changes: 10 additions & 10 deletions dbm-ui/frontend/src/views/task-history/common/graphRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,16 @@ export default class GraphRender {

{flowInfo.status !== 'REVOKED' && node.children === undefined && (
<div class='node-ractangle__operations'>
{!node.isTodoNode && status === 'RUNNING' && (
{node.isTodoNode ? (
<i
class='operation-icon db-icon-check mr-5'
v-bk-tooltips={t('人工确认')}
data-evt-type='todo'
/>
) : (
''
)}
{status === 'RUNNING' && (
<i
class='operation-icon db-icon-qiangzhizhongzhi'
v-bk-tooltips={t('强制失败')}
Expand All @@ -255,15 +264,6 @@ export default class GraphRender {
) : (
''
)}
{node.isTodoNode ? (
<i
class='operation-icon db-icon-check'
v-bk-tooltips={t('人工确认')}
data-evt-type='todo'
/>
) : (
''
)}
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
* 设置日志
*/
const handleSetLog = (data: NodeLog[] = []) => {
logRef.value.handleLogAdd(data);
logRef.value?.handleLogAdd(data);
};

/** 当前选中日志版本的信息 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
:children="children"
class="tree-node-tree-main"
:data="nodesTreeData"
expand-all
label="name"
node-key="id"
selectable
Expand Down Expand Up @@ -75,7 +76,12 @@
interface Props {
nodesCount: number;
nodesTreeData: Array<NodeType & { failedChildren?: NodeType[] }>;
nodesTreeData: Array<
NodeType & {
failedChildren?: NodeType[];
todoChildren?: NodeType[];
}
>;
statusKeypath: string;
titleKeypath: string;
tooltips: string;
Expand All @@ -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<Props['theme']>,
): void;
(e: 'after-show', value: typeof treeRef): void;
}
Expand All @@ -95,7 +107,7 @@
isOpen: () => boolean;
}
withDefaults(defineProps<Props>(), {
const props = withDefaults(defineProps<Props>(), {
theme: 'error',
children: 'children',
marginRight: false,
Expand All @@ -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 = () => {
Expand Down
67 changes: 42 additions & 25 deletions dbm-ui/frontend/src/views/task-history/pages/Details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@

import {
batchRetryNodes,
forceFailflowNode,
// forceFailflowNode,
getTaskflowDetails,
retryTaskflowNode,
revokePipeline,
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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) : [];
Expand All @@ -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([
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = () => {
Expand Down

0 comments on commit 4658332

Please sign in to comment.