mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-21 00:02:30 +00:00
fix graph viewer for negative ids
This commit is contained in:
@@ -180,6 +180,9 @@ export function emptyFlowModuleState(): FlowModuleState {
|
||||
const aCharCode = 'a'.charCodeAt(0)
|
||||
|
||||
export function numberToChars(n: number, skipTilde: boolean = false) {
|
||||
if (n < 0) {
|
||||
return "-" + numberToChars(-n, skipTilde)
|
||||
}
|
||||
var b = [n],
|
||||
sp,
|
||||
out,
|
||||
@@ -207,6 +210,9 @@ export function numberToChars(n: number, skipTilde: boolean = false) {
|
||||
}
|
||||
|
||||
export function charsToNumber(n: string): number {
|
||||
if (n.charAt(0) == '-') {
|
||||
return charsToNumber(n.slice(1)) * -1
|
||||
}
|
||||
let b = Math.pow(27, n.length - 1)
|
||||
let res = 0
|
||||
for (let c of n) {
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
return flowModuleToBranch(
|
||||
module,
|
||||
branches,
|
||||
['Default', ...module.value.branches.map((x) => `If ${truncateRev(x.expr, 20)}`)],
|
||||
['Default', ...module.value.branches.map((x) => `${truncateRev(x.expr, 20)}`)],
|
||||
parent,
|
||||
insideLoop
|
||||
)
|
||||
@@ -328,11 +328,11 @@
|
||||
if (!modules.length) {
|
||||
items.push(createVirtualNode(branchParent, 'Empty branch', edgesLabel[i]))
|
||||
} else {
|
||||
modules.forEach((module) => {
|
||||
modules.forEach((module, j) => {
|
||||
const item = getConvertedFlowModule(
|
||||
module,
|
||||
items.length ? items : numberToChars(branch.node.id),
|
||||
edgesLabel[i],
|
||||
j == 0 ? edgesLabel[i] : undefined,
|
||||
insideLoop
|
||||
)
|
||||
item && items.push(item)
|
||||
@@ -434,8 +434,9 @@
|
||||
edgesLabel?: string,
|
||||
offset?: number
|
||||
): Node {
|
||||
const id = -idGenerator.next().value - 1 + (offset ?? 0)
|
||||
return {
|
||||
id: -idGenerator.next().value - 1 + (offset ?? 0),
|
||||
id,
|
||||
position: { x: -1, y: -1 },
|
||||
data: {
|
||||
html: `
|
||||
|
||||
Reference in New Issue
Block a user