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.
This commit is contained in:
parent
c35ab0d0b1
commit
8ab00b20d4
@ -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
|
||||
|
||||
@ -17,11 +17,12 @@ function HideModal() {
|
||||
modal.classList.add("hidden");
|
||||
modal.classList.add("opacity-0");
|
||||
|
||||
// Clear the inputs
|
||||
for (const key in input) {
|
||||
if (key != "driver") {
|
||||
input[key].value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const input = {
|
||||
host: document.getElementById("db-host"),
|
||||
@ -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.
|
||||
|
||||
@ -201,8 +201,15 @@
|
||||
</div>
|
||||
</form>
|
||||
<div class="flex items-center space-x-4 mt-4">
|
||||
<button hx-post="/v1/api/connections" hx-trigger="click" hx-target="#connected-database" hx-swap="outerHTML"
|
||||
hx-include="#connection-form" onclick="HideModal();" class="bg-blue-500 text-white px-4 py-2 rounded-md">
|
||||
<button
|
||||
hx-post="/v1/api/connections"
|
||||
hx-trigger="click"
|
||||
hx-target="#connected-database"
|
||||
hx-swap="outerHTML"
|
||||
hx-include="#connection-form"
|
||||
hx-on::after-request="HideModal();"
|
||||
class="bg-blue-500 text-white px-4 py-2 rounded-md"
|
||||
>
|
||||
Create Connection
|
||||
</button>
|
||||
<button hx-post="/v1/api/connections/test" hx-trigger="click" hx-swap="outerHTML"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user