Skip to content

Commit 6c93eac

Browse files
Merge branch 'master' into changes-for-new-plugin-website
2 parents 78a21e8 + 979bfbf commit 6c93eac

File tree

6 files changed

+41
-53
lines changed

6 files changed

+41
-53
lines changed

src/components/misc/Collapsible.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
const getHash = computed(() => `#${props.href}-body`);
5050
const handleToggle = (event: Event) => {
5151
event.preventDefault();
52+
event.stopPropagation();
5253
collapsed.value = !collapsed.value;
5354
open.value = !collapsed.value;
5455
if(!collapsed.value) {
@@ -57,7 +58,12 @@
5758
if(props.noUrlChange) {
5859
return;
5960
}
60-
window.location.hash = collapsed.value ? "" : getHash.value
61+
62+
if (collapsed.value) {
63+
history.replaceState(null, "", window.location.pathname + window.location.search);
64+
} else {
65+
window.location.hash = getHash.value;
66+
}
6167
};
6268
6369
const open = ref(false);

src/components/misc/Status.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
22
<button
3-
data-test-id="status"
43
type="button"
54
:class="classes"
65
>

src/components/nodes/EdgeNode.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
:style="{
1818
pointerEvents: 'all',
1919
position: 'absolute',
20-
transform: `translate(-50%, -50%) translate(${path[1]}px,${path[2]}px)`,
20+
transform: `translate(-50%, -50%) translate(${path[1] + labelXOffset}px,${path[2] + labelYOffset}px)`,
2121
}"
2222
>
2323
<tooltip :title>
@@ -103,6 +103,22 @@
103103
104104
105105
const path = computed(() => getSmoothStepPath(props as any));
106+
const isVertical = computed(() => {
107+
const dx = (props.targetX ?? 0) - (props.sourceX ?? 0);
108+
const dy = (props.targetY ?? 0) - (props.sourceY ?? 0);
109+
return Math.abs(dy) >= Math.abs(dx);
110+
});
111+
112+
const OFFSET = 14;
113+
const labelYOffset = computed(() => {
114+
if (!isVertical.value) return 0;
115+
const boundary = props.data?.edgeBoundary;
116+
if (boundary === "top") return -OFFSET;
117+
if (boundary === "bottom") return OFFSET;
118+
return 0;
119+
});
120+
121+
const labelXOffset = computed(() => 0);
106122
107123
defineOptions({
108124
inheritAttrs: false,

src/components/plugins/SchemaToHtml.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,13 @@
160160
return;
161161
}
162162
163-
const definitionKey = hash.includes("#") ? hash.split("#").pop()?.split(".").pop() : hash;
163+
const cleanHash = hash.replace(/-body$/, "");
164+
165+
const definitionKey = Object.keys(props.schema.definitions).find(defKey =>
166+
cleanHash === defKey || cleanHash.startsWith(defKey + "_")
167+
);
164168
165-
if (definitionKey && definitionKey in props.schema.definitions) {
169+
if (definitionKey) {
166170
definitionsExpanded.value = true;
167171
forceExpandKey.value += 1;
168172
expandedDefinitions.value.clear();
@@ -174,7 +178,7 @@
174178
const maxAttempts = 30;
175179
176180
const attemptScroll = () => {
177-
const element = document.getElementById(definitionKey);
181+
const element = document.getElementById(cleanHash);
178182
if (element) {
179183
element.scrollIntoView({behavior: "smooth", block: "start"});
180184
} else if (attempts < maxAttempts) {

src/utils/VueFlowUtils.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export function generateDagreGraph(
176176
continue;
177177
}
178178
if (!edgeReplacer[cluster.cluster.uid]) {
179-
dagreGraph.setNode(cluster.cluster.uid, {clusterLabelPos: "top"});
179+
dagreGraph.setNode(cluster.cluster.uid, {clusterLabelPos: "top"});
180180

181181
for (const node of cluster.nodes || []) {
182182
if (!hiddenNodes.includes(node)) {
@@ -643,6 +643,14 @@ export function generateGraph(
643643
);
644644
if (newEdge) {
645645
const edgeColor = getEdgeColor(edge, nodeByUid, clusterByNodeUid);
646+
const targetNodeType = nodeByUid[newEdge.target]?.type ?? "";
647+
const sourceNodeType = nodeByUid[newEdge.source]?.type ?? "";
648+
let edgeBoundary: "top" | "bottom" | undefined = undefined;
649+
if (typeof targetNodeType === "string" && targetNodeType.endsWith("GraphClusterRoot")) {
650+
edgeBoundary = "top";
651+
} else if (typeof sourceNodeType === "string" && sourceNodeType.endsWith("GraphClusterEnd")) {
652+
edgeBoundary = "bottom";
653+
}
646654
elements.push({
647655
id: newEdge.source + "|" + newEdge.target,
648656
source: newEdge.source,
@@ -665,6 +673,7 @@ export function generateGraph(
665673
clusterRootTaskNodeUids,
666674
readOnlyUidPrefixes
667675
),
676+
edgeBoundary: edgeBoundary,
668677
haveDashArray:
669678
nodeByUid[edge.source].type.endsWith("GraphTrigger") ||
670679
nodeByUid[edge.target].type.endsWith("GraphTrigger") ||
@@ -682,7 +691,6 @@ export function generateGraph(
682691

683692
return elements;
684693
}
685-
686694
export function isClusterRootOrEnd(node: MinimalNode) {
687695
return ["GraphClusterRoot", "GraphClusterFinally", "GraphClusterAfterExecution", "GraphClusterEnd"].some((s) =>
688696
node.type.endsWith(s)

src/utils/constants.ts

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ export const EVENTS = {
2323

2424
export const CLUSTER_PREFIX = "cluster_";
2525

26-
export const stateGlobalChartTypes = {
27-
EXECUTIONS: "executions",
28-
TASKRUNS: "taskruns",
29-
} as const;
30-
31-
export const logDisplayTypes = {
32-
ALL: "all",
33-
ERROR: "error",
34-
HIDDEN: "hidden",
35-
DEFAULT: "all",
36-
} as const;
37-
3826
export const NODE_SIZES = {
3927
TASK_WIDTH: 184,
4028
TASK_HEIGHT: 44,
@@ -47,36 +35,3 @@ export const NODE_SIZES = {
4735
TRIGGER_CLUSTER_WIDTH: 350,
4836
TRIGGER_CLUSTER_HEIGHT: 180,
4937
} as const;
50-
51-
export const editorViewTypes = {
52-
STORAGE_KEY: "view-type",
53-
SOURCE: "source",
54-
SOURCE_TOPOLOGY: "source-topology",
55-
SOURCE_DOC: "source-doc",
56-
TOPOLOGY: "topology",
57-
SOURCE_BLUEPRINTS: "source-blueprints",
58-
} as const;
59-
60-
export const storageKeys = {
61-
DISPLAY_EXECUTIONS_COLUMNS: "displayExecutionsColumns",
62-
DISPLAY_FLOW_EXECUTIONS_COLUMNS: "displayFlowExecutionsColumns",
63-
SELECTED_TENANT: "selectedTenant",
64-
EXECUTE_FLOW_BEHAVIOUR: "executeFlowBehaviour",
65-
SHOW_CHART: "showChart",
66-
SHOW_FLOWS_CHART: "showFlowsChart",
67-
SHOW_LOGS_CHART: "showLogsChart",
68-
DEFAULT_NAMESPACE: "defaultNamespace",
69-
LATEST_NAMESPACE: "latestNamespace",
70-
PAGINATION_SIZE: "paginationSize",
71-
IMPERSONATE: "impersonate",
72-
EDITOR_VIEW_TYPE: "editorViewType",
73-
} as const;
74-
75-
export const executeFlowBehaviours = {
76-
SAME_TAB: "same tab",
77-
NEW_TAB: "new tab",
78-
} as const;
79-
80-
export const stateDisplayValues = {
81-
INPROGRESS: "IN-PROGRESS",
82-
} as const;

0 commit comments

Comments
 (0)