Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

fixed task card open in Chrome and Firefox #3447

Merged
merged 3 commits into from
May 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions ui/src/components/diagram/WorkflowGraph.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,19 @@ class WorkflowGraph extends React.Component {
inner.selectAll("g.node").on("click", this.handleClick);
};

/**
* Get the taskRef id base on browsers
* @param e
* @returns {string | undefined} The id of the task ref
*/
getTaskRef = (e) => {
const flag = navigator.userAgent.toLowerCase().indexOf("firefox") > -1 || navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
if (flag) {
return e.target?.parentNode?.id;
}
return e?.path[1]?.id || e?.path[2]?.id; // could be 2 layers down
};

handleClick = (e) => {
const taskRef = e.composedPath()[1].id || e.composedPath()[2].id; // could be 2 layers down
const node = this.graph.node(taskRef);
Expand Down Expand Up @@ -667,7 +680,7 @@ function barRenderer(parent, bbox, node) {
return {
x:
(node.fanDir === "down" && point.y > node.y) ||
(node.fanDir === "up" && point.y < node.y)
(node.fanDir === "up" && point.y < node.y)
? point.x
: intersect.rect(node, point).x,
y: point.y < node.y ? node.y - bbox.height / 2 : node.y + bbox.height / 2,
Expand All @@ -687,8 +700,7 @@ function stackRenderer(parent, bbox, node) {
.attr("height", bbox.height)
.attr(
"transform",
`translate(${-bbox.width / 2 - STACK_OFFSET * 2}, ${
-bbox.height / 2 - STACK_OFFSET * 2
`translate(${-bbox.width / 2 - STACK_OFFSET * 2}, ${-bbox.height / 2 - STACK_OFFSET * 2
})`
);
group
Expand All @@ -697,8 +709,7 @@ function stackRenderer(parent, bbox, node) {
.attr("height", bbox.height)
.attr(
"transform",
`translate(${-bbox.width / 2 - STACK_OFFSET}, ${
-bbox.height / 2 - STACK_OFFSET
`translate(${-bbox.width / 2 - STACK_OFFSET}, ${-bbox.height / 2 - STACK_OFFSET
})`
);
group
Expand All @@ -722,4 +733,4 @@ function getTranslateX(elem) {
}
function getTranslateY(elem) {
return elem.transform.baseVal[0].matrix.f;
}
}
Loading