Skip to content

Commit

Permalink
Cast true and false string to boolean for bind options.
Browse files Browse the repository at this point in the history
  • Loading branch information
cr0wst committed Mar 30, 2024
1 parent 72fc753 commit 84ced20
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ ipcMain.handle('rabbit-add-queue', async (_, { name, exchange, bindOptions }) =>
throw new Error('Not connected to RabbitMQ')
}

return await rabbitConnection.createQueue({ name, exchange, bindOptions })
return await rabbitConnection.createQueue({ id: undefined, name, exchange, bindOptions })
})

ipcMain.handle('rabbit-delete-queue', async (_, queue) => {
Expand Down
26 changes: 23 additions & 3 deletions src/renderer/src/components/AddQueueModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,33 @@
arguments: {}
}
if (argumentOne.key && argumentOne.value) {
bindOptions.arguments[argumentOne.key] = argumentOne.value
// if the argument value is "true" or "false" convert it to a boolean
// TODO: Add dropdown for boolean values in the future
if (argumentOne.value === 'true') {
bindOptions.arguments[argumentOne.key] = true
} else if (argumentOne.value === 'false') {
bindOptions.arguments[argumentOne.key] = false
} else {
bindOptions.arguments[argumentOne.key] = argumentOne.value
}
}
if (argumentTwo.key && argumentTwo.value) {
bindOptions.arguments[argumentTwo.key] = argumentTwo.value
if (argumentTwo.value === 'true') {
bindOptions.arguments[argumentTwo.key] = true
} else if (argumentTwo.value === 'false') {
bindOptions.arguments[argumentTwo.key] = false
} else {
bindOptions.arguments[argumentTwo.key] = argumentTwo.value
}
}
if (argumentThree.key && argumentThree.value) {
bindOptions.arguments[argumentThree.key] = argumentThree.value
if (argumentThree.value === 'true') {
bindOptions.arguments[argumentThree.key] = true
} else if (argumentThree.value === 'false') {
bindOptions.arguments[argumentThree.key] = false
} else {
bindOptions.arguments[argumentThree.key] = argumentThree.value
}
}
const queue = await api.rabbit.addQueue(name, $selectedExchange.name, bindOptions)
$queues = [...$queues, queue]
Expand Down

0 comments on commit 84ced20

Please sign in to comment.