From 8ab00b20d4eb6ec46fd06d0679e9fb940b0a5dac Mon Sep 17 00:00:00 2001 From: Azpect3120 <104033825+Azpect3120@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:22:39 -0700 Subject: [PATCH] FIX: Bug with clearing modal before sending The creation modal was sending data after being wiped, this was fixed and the data does not get cleared from the modal until AFTER the request is sent. --- internal/database/create.go | 2 ++ web/static/scripts/modal.js | 7 +++++-- web/templates/index.html | 11 +++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/internal/database/create.go b/internal/database/create.go index e7d7772..c5ecce7 100644 --- a/internal/database/create.go +++ b/internal/database/create.go @@ -17,6 +17,8 @@ func CreateConnection(c *gin.Context) { name string = c.PostForm("db-conn-name") ) + fmt.Println(name, ": ", url) + session := sessions.Default(c) var connections map[string]string diff --git a/web/static/scripts/modal.js b/web/static/scripts/modal.js index 99e0980..d1349f3 100644 --- a/web/static/scripts/modal.js +++ b/web/static/scripts/modal.js @@ -17,9 +17,10 @@ function HideModal() { modal.classList.add("hidden"); modal.classList.add("opacity-0"); - // Clear the inputs for (const key in input) { - input[key].value = ""; + if (key != "driver") { + input[key].value = ""; + } } } @@ -75,6 +76,8 @@ for (const key in input) { input[key].addEventListener("input", () => { ParseURL(input); }) + } else if (key == "name") { + continue; } else { // If the input changed is the database name, update the connection name as well. // This will create a default connection name based on the database name. diff --git a/web/templates/index.html b/web/templates/index.html index f20f1c2..b107656 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -201,8 +201,15 @@
-