From c3e00b94103591f445bf1f131640d2649e84c04b Mon Sep 17 00:00:00 2001 From: Azpect3120 <104033825+Azpect3120@users.noreply.github.com> Date: Tue, 13 Aug 2024 20:38:57 -0700 Subject: [PATCH] FEAT: Toggle for auto-run Still not stored in the session like I would like, but for now, it works! --- internal/http/router.go | 4 ++ internal/templates/query.go | 51 ++++++++++++++++++ web/static/styles/main.css | 103 ++++++++++++++++++++++++++++++------ web/templates/index.html | 36 ++++++++++--- 4 files changed, 173 insertions(+), 21 deletions(-) create mode 100644 internal/templates/query.go diff --git a/internal/http/router.go b/internal/http/router.go index ec0b490..adb5993 100644 --- a/internal/http/router.go +++ b/internal/http/router.go @@ -72,4 +72,8 @@ func populate(web, api *gin.RouterGroup) { web.GET("/connections/tree", func(c *gin.Context) { c.String(200, database.TableTree(c)) }) + + // This should return an HTML template which will be used to auto or not + // auto send the query to the server. + web.GET("/query/auto", templates.ToggleQueryType) } diff --git a/internal/templates/query.go b/internal/templates/query.go new file mode 100644 index 0000000..e199e23 --- /dev/null +++ b/internal/templates/query.go @@ -0,0 +1,51 @@ +package templates + +import ( + "github.com/gin-gonic/gin" +) + +const MANUAL_QUERY string = ` +