mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 16:02:28 +00:00
fix nextId for components
This commit is contained in:
@@ -56,7 +56,10 @@
|
||||
function addComponent(appComponent: AppComponent) {
|
||||
$dirtyStore = true
|
||||
const grid = $app.grid ?? []
|
||||
const id = getNextId(grid.map((gridItem) => gridItem.data.id))
|
||||
const id = getNextId(
|
||||
grid.map((gridItem) => gridItem.data.id),
|
||||
true
|
||||
)
|
||||
|
||||
appComponent.id = id
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ export async function loadFlowModuleState(flowModule: FlowModule): Promise<FlowM
|
||||
|
||||
export const idMutex = new Mutex()
|
||||
|
||||
export function getNextId(currentKeys: string[]): string {
|
||||
export function getNextId(currentKeys: string[], skipTilde: boolean = false): string {
|
||||
const max = currentKeys.reduce((acc, key) => {
|
||||
if (key === 'failure' || key.includes('branch') || key.includes('loop')) {
|
||||
return acc
|
||||
|
||||
@@ -179,7 +179,7 @@ export function emptyFlowModuleState(): FlowModuleState {
|
||||
|
||||
const aCharCode = 'a'.charCodeAt(0)
|
||||
|
||||
export function numberToChars(n: number) {
|
||||
export function numberToChars(n: number, skipTilde: boolean = false) {
|
||||
var b = [n],
|
||||
sp,
|
||||
out,
|
||||
@@ -187,11 +187,12 @@ export function numberToChars(n: number) {
|
||||
div
|
||||
|
||||
sp = 0
|
||||
const basisInc = skipTilde ? -1 : 0
|
||||
while (sp < b.length) {
|
||||
if (b[sp] > 25) {
|
||||
div = Math.floor(b[sp] / 27)
|
||||
if (b[sp] > (25 + basisInc)) {
|
||||
div = Math.floor(b[sp] / (27 + basisInc))
|
||||
b[sp + 1] = div - 1
|
||||
b[sp] %= 27
|
||||
b[sp] %= (27 + basisInc)
|
||||
}
|
||||
sp += 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user