Skip to content

Commit 3557f10

Browse files
authored
feat: allow yaml_utils to insert conditions on a trigger (#468)
1 parent 0dcaacb commit 3557f10

File tree

13 files changed

+1709
-1910
lines changed

13 files changed

+1709
-1910
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on: push
77

88
jobs:
99
npm:
10-
name: Publish to Npm
10+
name: Test the package
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@
1919
},
2020
"require": "./dist/kestra-ui.umd.cjs"
2121
},
22-
"./style.css": "./dist/kestra-ui.css",
22+
"./flow-yaml-utils": {
23+
"types": "./dist/utils/FlowYamlUtils.d.ts",
24+
"import": {
25+
"types": "./dist/utils/FlowYamlUtils.d.ts",
26+
"default": "./dist/kestra-flowyamlutils.es.js"
27+
},
28+
"require": "./dist/kestra-flowyamlutils.cjs.js"
29+
},
30+
"./style.css": "./dist/ui-libs.css",
2331
"./src/*": "./src/*"
2432
},
2533
"scripts": {

src/components/topology/Topology.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
import {CLUSTER_PREFIX, EVENTS} from "../../utils/constants"
117117
import Utils from "../../utils/Utils"
118118
import VueFlowUtils, {type FlowGraph} from "../../utils/VueFlowUtils";
119-
import {YamlUtils} from "../../utils/YamlUtils";
119+
import {isParentChildrenRelation, swapBlocks} from "../../utils/FlowYamlUtils";
120120
import {useScreenshot} from "./export/useScreenshot";
121121
122122
const props = defineProps({
@@ -295,7 +295,12 @@
295295
try {
296296
if(props.source){
297297
emit("swapped-task", {
298-
newSource: YamlUtils.swapTasks(props.source, Utils.afterLastDot(taskNode1.id) ?? "", Utils.afterLastDot(taskNode2.id) ?? ""),
298+
newSource: swapBlocks({
299+
source:props.source,
300+
section: "tasks",
301+
key1: Utils.afterLastDot(taskNode1.id) ?? "",
302+
key2: Utils.afterLastDot(taskNode2.id) ?? ""
303+
}),
299304
swappedTasks: [taskNode1.id, taskNode2.id]
300305
})
301306
}
@@ -354,7 +359,15 @@
354359
return "toomuchtaskerror";
355360
}
356361
try {
357-
if (tasksMeet.length === 1 && props.source && YamlUtils.isParentChildrenRelation(props.source, Utils.afterLastDot(tasksMeet[0]) ?? "", Utils.afterLastDot(node.id) ?? "")) {
362+
if (tasksMeet.length === 1 && props.source
363+
&& isParentChildrenRelation({
364+
source:props.source,
365+
sections:["tasks", "triggers"],
366+
key1: Utils.afterLastDot(tasksMeet[0]) ?? "",
367+
key2: Utils.afterLastDot(node.id) ?? "",
368+
keyName: "id"
369+
})
370+
) {
358371
return "parentchildrenerror";
359372
}
360373
} catch {

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export {YamlUtils} from "./utils/YamlUtils";
1+
export {YamlUtils} from "./utils/YamlUtilsLegacy";
22
export {cssVariable} from "./utils/global";
33
export {default as State, STATES} from "./utils/state";
44
export {default as Utils} from "./utils/Utils";
@@ -8,7 +8,7 @@ export * from "./utils/constants";
88
export * from "./utils/url";
99
export * from "./utils/plugins";
1010

11-
export type {YamlElement} from "./utils/YamlUtils";
11+
export type {YamlElement} from "./utils/YamlUtilsLegacy";
1212
export type {Plugin} from "./utils/plugins";
1313
export type {JSONSchema, JSONProperty} from "./utils/schemaUtils";
1414

0 commit comments

Comments
 (0)