mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-01-25 22:18:51 -06:00
Replace all htmx client side handling
This commit is contained in:
@@ -6,14 +6,14 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/database/dbgen"
|
||||
"github.com/eduardolat/pgbackweb/internal/logger"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/reqctx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
func (m *Middleware) InjectReqctx(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
reqCtx := reqctx.Ctx{
|
||||
IsHTMXBoosted: htmx.ServerIsBoosted(c),
|
||||
IsHTMXBoosted: htmxs.ServerIsBoosted(c),
|
||||
}
|
||||
|
||||
found, user, err := m.servs.AuthService.GetUserFromSessionCookie(c)
|
||||
|
||||
@@ -8,10 +8,11 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/layout"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -118,10 +119,10 @@ func (h *handlers) createFirstUserHandler(c echo.Context) error {
|
||||
PasswordConfirmation string `form:"password_confirmation" validate:"required,eqfield=Password"`
|
||||
}
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
_, err := h.servs.UsersService.CreateUser(ctx, dbgen.UsersServiceCreateUserParams{
|
||||
@@ -130,10 +131,10 @@ func (h *handlers) createFirstUserHandler(c echo.Context) error {
|
||||
Password: formData.Password,
|
||||
})
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondAlertWithRedirect(
|
||||
return htmxs.RespondAlertWithRedirect(
|
||||
c, "User created successfully", "/auth/login",
|
||||
)
|
||||
}
|
||||
|
||||
@@ -7,10 +7,11 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/layout"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -87,10 +88,10 @@ func (h *handlers) loginHandler(c echo.Context) error {
|
||||
Password string `form:"password" validate:"required,max=50"`
|
||||
}
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
session, err := h.servs.AuthService.Login(
|
||||
@@ -103,9 +104,9 @@ func (h *handlers) loginHandler(c echo.Context) error {
|
||||
"ua": c.Request().UserAgent(),
|
||||
"err": err,
|
||||
})
|
||||
return htmx.RespondToastError(c, "Login failed")
|
||||
return htmxs.RespondToastError(c, "Login failed")
|
||||
}
|
||||
|
||||
h.servs.AuthService.SetSessionCookie(c, session.DecryptedToken)
|
||||
return htmx.RespondRedirect(c, "/dashboard")
|
||||
return htmxs.RespondRedirect(c, "/dashboard")
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package auth
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/view/reqctx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
@@ -11,11 +11,11 @@ func (h *handlers) logoutHandler(c echo.Context) error {
|
||||
reqCtx := reqctx.GetCtx(c)
|
||||
|
||||
if err := h.servs.AuthService.DeleteSession(ctx, reqCtx.SessionID); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
h.servs.AuthService.ClearSessionCookie(c)
|
||||
return htmx.RespondRedirect(c, "/auth/login")
|
||||
return htmxs.RespondRedirect(c, "/auth/login")
|
||||
}
|
||||
|
||||
func (h *handlers) logoutAllSessionsHandler(c echo.Context) error {
|
||||
@@ -24,9 +24,9 @@ func (h *handlers) logoutAllSessionsHandler(c echo.Context) error {
|
||||
|
||||
err := h.servs.AuthService.DeleteAllUserSessions(ctx, reqCtx.User.ID)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
h.servs.AuthService.ClearSessionCookie(c)
|
||||
return htmx.RespondRedirect(c, "/auth/login")
|
||||
return htmxs.RespondRedirect(c, "/auth/login")
|
||||
}
|
||||
|
||||
@@ -9,11 +9,12 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
alpine "github.com/nodxdev/nodxgo-alpine"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -38,10 +39,10 @@ func (h *handlers) createBackupHandler(c echo.Context) error {
|
||||
OptNoComments string `form:"opt_no_comments" validate:"required,oneof=true false"`
|
||||
}
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
_, err := h.servs.BackupsService.CreateBackup(
|
||||
@@ -66,10 +67,10 @@ func (h *handlers) createBackupHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondRedirect(c, "/dashboard/backups")
|
||||
return htmxs.RespondRedirect(c, "/dashboard/backups")
|
||||
}
|
||||
|
||||
func (h *handlers) createBackupFormHandler(c echo.Context) error {
|
||||
@@ -77,12 +78,12 @@ func (h *handlers) createBackupFormHandler(c echo.Context) error {
|
||||
|
||||
databases, err := h.servs.DatabasesService.GetAllDatabases(ctx)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
destinations, err := h.servs.DestinationsService.GetAllDestinations(ctx)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return echoutil.RenderNodx(
|
||||
|
||||
@@ -2,10 +2,11 @@ package backups
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -14,14 +15,14 @@ func (h *handlers) deleteBackupHandler(c echo.Context) error {
|
||||
|
||||
backupID, err := uuid.Parse(c.Param("backupID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
if err = h.servs.BackupsService.DeleteBackup(ctx, backupID); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondRefresh(c)
|
||||
return htmxs.RespondRefresh(c)
|
||||
}
|
||||
|
||||
func deleteBackupButton(backupID uuid.UUID) nodx.Node {
|
||||
|
||||
@@ -2,10 +2,11 @@ package backups
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -14,14 +15,14 @@ func (h *handlers) duplicateBackupHandler(c echo.Context) error {
|
||||
|
||||
backupID, err := uuid.Parse(c.Param("backupID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
if _, err = h.servs.BackupsService.DuplicateBackup(ctx, backupID); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondRefresh(c)
|
||||
return htmxs.RespondRefresh(c)
|
||||
}
|
||||
|
||||
func duplicateBackupButton(backupID uuid.UUID) nodx.Node {
|
||||
|
||||
@@ -8,10 +8,11 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/staticdata"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -20,7 +21,7 @@ func (h *handlers) editBackupHandler(c echo.Context) error {
|
||||
|
||||
backupID, err := uuid.Parse(c.Param("backupID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
var formData struct {
|
||||
@@ -38,10 +39,10 @@ func (h *handlers) editBackupHandler(c echo.Context) error {
|
||||
OptNoComments string `form:"opt_no_comments" validate:"required,oneof=true false"`
|
||||
}
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
_, err = h.servs.BackupsService.UpdateBackup(
|
||||
@@ -62,10 +63,10 @@ func (h *handlers) editBackupHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondAlertWithRefresh(c, "Backup updated")
|
||||
return htmxs.RespondAlertWithRefresh(c, "Backup updated")
|
||||
}
|
||||
|
||||
func editBackupButton(backup dbgen.BackupsServicePaginateBackupsRow) nodx.Node {
|
||||
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/reqctx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/layout"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
)
|
||||
|
||||
func (h *handlers) indexPageHandler(c echo.Context) error {
|
||||
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/timeutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -24,10 +25,10 @@ func (h *handlers) listBackupsHandler(c echo.Context) error {
|
||||
Page int `query:"page" validate:"required,min=1"`
|
||||
}
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
pagination, backups, err := h.servs.BackupsService.PaginateBackups(
|
||||
@@ -37,7 +38,7 @@ func (h *handlers) listBackupsHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return echoutil.RenderNodx(
|
||||
|
||||
@@ -4,24 +4,25 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
func (h *handlers) manualRunHandler(c echo.Context) error {
|
||||
backupID, err := uuid.Parse(c.Param("backupID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
go func() {
|
||||
_ = h.servs.ExecutionsService.RunExecution(context.Background(), backupID)
|
||||
}()
|
||||
|
||||
return htmx.RespondToastSuccess(c, "Backup started, check the backup executions for more details")
|
||||
return htmxs.RespondToastSuccess(c, "Backup started, check the backup executions for more details")
|
||||
}
|
||||
|
||||
func manualRunbutton(backupID uuid.UUID) nodx.Node {
|
||||
|
||||
@@ -6,9 +6,10 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/database/dbgen"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -23,10 +24,10 @@ func (h *handlers) createDatabaseHandler(c echo.Context) error {
|
||||
|
||||
var formData createDatabaseDTO
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
_, err := h.servs.DatabasesService.CreateDatabase(
|
||||
@@ -37,10 +38,10 @@ func (h *handlers) createDatabaseHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondRedirect(c, "/dashboard/databases")
|
||||
return htmxs.RespondRedirect(c, "/dashboard/databases")
|
||||
}
|
||||
|
||||
func createDatabaseButton() nodx.Node {
|
||||
|
||||
@@ -2,10 +2,11 @@ package databases
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -14,14 +15,14 @@ func (h *handlers) deleteDatabaseHandler(c echo.Context) error {
|
||||
|
||||
databaseID, err := uuid.Parse(c.Param("databaseID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
if err = h.servs.DatabasesService.DeleteDatabase(ctx, databaseID); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondRefresh(c)
|
||||
return htmxs.RespondRefresh(c)
|
||||
}
|
||||
|
||||
func deleteDatabaseButton(databaseID uuid.UUID) nodx.Node {
|
||||
|
||||
@@ -6,10 +6,11 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/database/dbgen"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -18,15 +19,15 @@ func (h *handlers) editDatabaseHandler(c echo.Context) error {
|
||||
|
||||
databaseID, err := uuid.Parse(c.Param("databaseID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
var formData createDatabaseDTO
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
_, err = h.servs.DatabasesService.UpdateDatabase(
|
||||
@@ -38,10 +39,10 @@ func (h *handlers) editDatabaseHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondAlertWithRefresh(c, "Database updated")
|
||||
return htmxs.RespondAlertWithRefresh(c, "Database updated")
|
||||
}
|
||||
|
||||
func editDatabaseButton(
|
||||
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/reqctx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/layout"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
)
|
||||
|
||||
func (h *handlers) indexPageHandler(c echo.Context) error {
|
||||
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/timeutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -24,10 +25,10 @@ func (h *handlers) listDatabasesHandler(c echo.Context) error {
|
||||
Page int `query:"page" validate:"required,min=1"`
|
||||
}
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
pagination, databases, err := h.servs.DatabasesService.PaginateDatabases(
|
||||
@@ -37,7 +38,7 @@ func (h *handlers) listDatabasesHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return echoutil.RenderNodx(
|
||||
|
||||
@@ -2,7 +2,7 @@ package databases
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
@@ -12,33 +12,33 @@ func (h *handlers) testDatabaseHandler(c echo.Context) error {
|
||||
|
||||
var formData createDatabaseDTO
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
err := h.servs.DatabasesService.TestDatabase(
|
||||
ctx, formData.Version, formData.ConnectionString,
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondToastSuccess(c, "Connection successful")
|
||||
return htmxs.RespondToastSuccess(c, "Connection successful")
|
||||
}
|
||||
|
||||
func (h *handlers) testExistingDatabaseHandler(c echo.Context) error {
|
||||
ctx := c.Request().Context()
|
||||
databaseID, err := uuid.Parse(c.Param("databaseID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
err = h.servs.DatabasesService.TestDatabaseAndStoreResult(ctx, databaseID)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondToastSuccess(c, "Connection successful")
|
||||
return htmxs.RespondToastSuccess(c, "Connection successful")
|
||||
}
|
||||
|
||||
@@ -4,9 +4,10 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/database/dbgen"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -24,10 +25,10 @@ func (h *handlers) createDestinationHandler(c echo.Context) error {
|
||||
|
||||
var formData createDestinationDTO
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
_, err := h.servs.DestinationsService.CreateDestination(
|
||||
@@ -41,10 +42,10 @@ func (h *handlers) createDestinationHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondRedirect(c, "/dashboard/destinations")
|
||||
return htmxs.RespondRedirect(c, "/dashboard/destinations")
|
||||
}
|
||||
|
||||
func createDestinationButton() nodx.Node {
|
||||
|
||||
@@ -2,10 +2,11 @@ package destinations
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -14,15 +15,15 @@ func (h *handlers) deleteDestinationHandler(c echo.Context) error {
|
||||
|
||||
destinationID, err := uuid.Parse(c.Param("destinationID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
err = h.servs.DestinationsService.DeleteDestination(ctx, destinationID)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondRefresh(c)
|
||||
return htmxs.RespondRefresh(c)
|
||||
}
|
||||
|
||||
func deleteDestinationButton(destinationID uuid.UUID) nodx.Node {
|
||||
|
||||
@@ -6,10 +6,11 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/database/dbgen"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -18,15 +19,15 @@ func (h *handlers) editDestinationHandler(c echo.Context) error {
|
||||
|
||||
destinationID, err := uuid.Parse(c.Param("destinationID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
var formData createDestinationDTO
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
_, err = h.servs.DestinationsService.UpdateDestination(
|
||||
@@ -41,10 +42,10 @@ func (h *handlers) editDestinationHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondAlertWithRefresh(c, "Destination updated")
|
||||
return htmxs.RespondAlertWithRefresh(c, "Destination updated")
|
||||
}
|
||||
|
||||
func editDestinationButton(
|
||||
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/reqctx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/layout"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
)
|
||||
|
||||
func (h *handlers) indexPageHandler(c echo.Context) error {
|
||||
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/timeutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -24,10 +25,10 @@ func (h *handlers) listDestinationsHandler(c echo.Context) error {
|
||||
Page int `query:"page" validate:"required,min=1"`
|
||||
}
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
pagination, destinations, err := h.servs.DestinationsService.PaginateDestinations(
|
||||
@@ -37,7 +38,7 @@ func (h *handlers) listDestinationsHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return echoutil.RenderNodx(
|
||||
|
||||
@@ -2,7 +2,7 @@ package destinations
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
func (h *handlers) testDestinationHandler(c echo.Context) error {
|
||||
var formData createDestinationDTO
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
err := h.servs.DestinationsService.TestDestination(
|
||||
@@ -21,23 +21,23 @@ func (h *handlers) testDestinationHandler(c echo.Context) error {
|
||||
formData.BucketName,
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondToastSuccess(c, "Connection successful")
|
||||
return htmxs.RespondToastSuccess(c, "Connection successful")
|
||||
}
|
||||
|
||||
func (h *handlers) testExistingDestinationHandler(c echo.Context) error {
|
||||
ctx := c.Request().Context()
|
||||
destinationID, err := uuid.Parse(c.Param("destinationID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
err = h.servs.DestinationsService.TestDestinationAndStoreResult(ctx, destinationID)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondToastSuccess(c, "Connection successful")
|
||||
return htmxs.RespondToastSuccess(c, "Connection successful")
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/reqctx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/layout"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
)
|
||||
|
||||
type execsQueryData struct {
|
||||
|
||||
@@ -12,10 +12,11 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/timeutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
)
|
||||
|
||||
type listExecsQueryData struct {
|
||||
@@ -30,10 +31,10 @@ func (h *handlers) listExecutionsHandler(c echo.Context) error {
|
||||
|
||||
var queryData listExecsQueryData
|
||||
if err := c.Bind(&queryData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&queryData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
pagination, executions, err := h.servs.ExecutionsService.PaginateExecutions(
|
||||
@@ -52,7 +53,7 @@ func (h *handlers) listExecutionsHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return echoutil.RenderNodx(
|
||||
|
||||
@@ -9,11 +9,12 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
alpine "github.com/nodxdev/nodxgo-alpine"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -26,20 +27,20 @@ func (h *handlers) restoreExecutionHandler(c echo.Context) error {
|
||||
ConnString string `form:"conn_string" validate:"omitempty"`
|
||||
}
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
if formData.DatabaseID == uuid.Nil && formData.ConnString == "" {
|
||||
return htmx.RespondToastError(
|
||||
return htmxs.RespondToastError(
|
||||
c, "Database or connection string is required",
|
||||
)
|
||||
}
|
||||
|
||||
if formData.DatabaseID != uuid.Nil && formData.ConnString != "" {
|
||||
return htmx.RespondToastError(
|
||||
return htmxs.RespondToastError(
|
||||
c, "Database and connection string cannot be both set",
|
||||
)
|
||||
}
|
||||
@@ -56,7 +57,7 @@ func (h *handlers) restoreExecutionHandler(c echo.Context) error {
|
||||
ctx, execution.DatabasePgVersion, formData.ConnString,
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +74,7 @@ func (h *handlers) restoreExecutionHandler(c echo.Context) error {
|
||||
)
|
||||
}()
|
||||
|
||||
return htmx.RespondToastSuccess(
|
||||
return htmxs.RespondToastSuccess(
|
||||
c, "Process started, check the restorations page for more details",
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,10 +2,11 @@ package executions
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -14,15 +15,15 @@ func (h *handlers) deleteExecutionHandler(c echo.Context) error {
|
||||
|
||||
executionID, err := uuid.Parse(c.Param("executionID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
err = h.servs.ExecutionsService.SoftDeleteExecution(ctx, executionID)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondRefresh(c)
|
||||
return htmxs.RespondRefresh(c)
|
||||
}
|
||||
|
||||
func deleteExecutionButton(executionID uuid.UUID) nodx.Node {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/service"
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
)
|
||||
@@ -19,11 +19,11 @@ func healthButtonHandler(servs *service.Service) echo.HandlerFunc {
|
||||
|
||||
databasesQty, err := servs.DatabasesService.GetDatabasesQty(ctx)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
destinationsQty, err := servs.DestinationsService.GetDestinationsQty(ctx)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return echoutil.RenderNodx(c, http.StatusOK, healthButton(
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/database/dbgen"
|
||||
"github.com/eduardolat/pgbackweb/internal/util/timeutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,9 +7,10 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/reqctx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -24,10 +25,10 @@ func (h *handlers) updateUserHandler(c echo.Context) error {
|
||||
PasswordConfirmation string `form:"password_confirmation" validate:"omitempty,eqfield=Password"`
|
||||
}
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
_, err := h.servs.UsersService.UpdateUser(ctx, dbgen.UsersServiceUpdateUserParams{
|
||||
@@ -37,10 +38,10 @@ func (h *handlers) updateUserHandler(c echo.Context) error {
|
||||
Password: sql.NullString{String: formData.Password, Valid: formData.Password != ""},
|
||||
})
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondToastSuccess(c, "Profile updated")
|
||||
return htmxs.RespondToastSuccess(c, "Profile updated")
|
||||
}
|
||||
|
||||
func updateUserForm(user dbgen.User) nodx.Node {
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/reqctx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/layout"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
)
|
||||
|
||||
type resQueryData struct {
|
||||
|
||||
@@ -12,10 +12,11 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/timeutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
)
|
||||
|
||||
type listResQueryData struct {
|
||||
@@ -29,10 +30,10 @@ func (h *handlers) listRestorationsHandler(c echo.Context) error {
|
||||
|
||||
var queryData listResQueryData
|
||||
if err := c.Bind(&queryData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&queryData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
pagination, restorations, err := h.servs.RestorationsService.PaginateRestorations(
|
||||
@@ -48,7 +49,7 @@ func (h *handlers) listRestorationsHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return echoutil.RenderNodx(
|
||||
|
||||
@@ -8,10 +8,11 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -31,10 +32,10 @@ func (h *handlers) createWebhookHandler(c echo.Context) error {
|
||||
|
||||
var formData createWebhookDTO
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
_, err := h.servs.WebhooksService.CreateWebhook(
|
||||
@@ -50,10 +51,10 @@ func (h *handlers) createWebhookHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondRedirect(c, "/dashboard/webhooks")
|
||||
return htmxs.RespondRedirect(c, "/dashboard/webhooks")
|
||||
}
|
||||
|
||||
func (h *handlers) createWebhookFormHandler(c echo.Context) error {
|
||||
@@ -61,17 +62,17 @@ func (h *handlers) createWebhookFormHandler(c echo.Context) error {
|
||||
|
||||
databases, err := h.servs.DatabasesService.GetAllDatabases(ctx)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
destinations, err := h.servs.DestinationsService.GetAllDestinations(ctx)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
backups, err := h.servs.BackupsService.GetAllBackups(ctx)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return echoutil.RenderNodx(c, http.StatusOK, createWebhookForm(
|
||||
|
||||
@@ -2,10 +2,11 @@ package webhooks
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -14,14 +15,14 @@ func (h *handlers) deleteWebhookHandler(c echo.Context) error {
|
||||
|
||||
webhookID, err := uuid.Parse(c.Param("webhookID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
if err = h.servs.WebhooksService.DeleteWebhook(ctx, webhookID); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondRefresh(c)
|
||||
return htmxs.RespondRefresh(c)
|
||||
}
|
||||
|
||||
func deleteWebhookButton(webhookID uuid.UUID) nodx.Node {
|
||||
|
||||
@@ -2,10 +2,11 @@ package webhooks
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -14,14 +15,14 @@ func (h *handlers) duplicateWebhookHandler(c echo.Context) error {
|
||||
|
||||
webhookID, err := uuid.Parse(c.Param("webhookID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
if _, err = h.servs.WebhooksService.DuplicateWebhook(ctx, webhookID); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondRefresh(c)
|
||||
return htmxs.RespondRefresh(c)
|
||||
}
|
||||
|
||||
func duplicateWebhookButton(webhookID uuid.UUID) nodx.Node {
|
||||
|
||||
@@ -8,10 +8,11 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -30,15 +31,15 @@ func (h *handlers) editWebhookHandler(c echo.Context) error {
|
||||
ctx := c.Request().Context()
|
||||
webhookID, err := uuid.Parse(c.Param("webhookID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
var formData editWebhookDTO
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
_, err = h.servs.WebhooksService.UpdateWebhook(
|
||||
@@ -55,37 +56,37 @@ func (h *handlers) editWebhookHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return htmx.RespondAlertWithRefresh(c, "Webhook updated")
|
||||
return htmxs.RespondAlertWithRefresh(c, "Webhook updated")
|
||||
}
|
||||
|
||||
func (h *handlers) editWebhookFormHandler(c echo.Context) error {
|
||||
ctx := c.Request().Context()
|
||||
webhookID, err := uuid.Parse(c.Param("webhookID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
webhook, err := h.servs.WebhooksService.GetWebhook(ctx, webhookID)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
databases, err := h.servs.DatabasesService.GetAllDatabases(ctx)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
destinations, err := h.servs.DestinationsService.GetAllDestinations(ctx)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
backups, err := h.servs.BackupsService.GetAllBackups(ctx)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return echoutil.RenderNodx(c, http.StatusOK, editWebhookForm(
|
||||
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/echoutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/reqctx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/layout"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
)
|
||||
|
||||
func (h *handlers) indexPageHandler(c echo.Context) error {
|
||||
|
||||
@@ -12,9 +12,10 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/timeutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
)
|
||||
|
||||
func (h *handlers) listWebhooksHandler(c echo.Context) error {
|
||||
@@ -24,10 +25,10 @@ func (h *handlers) listWebhooksHandler(c echo.Context) error {
|
||||
Page int `query:"page" validate:"required,min=1"`
|
||||
}
|
||||
if err := c.Bind(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&formData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
pagination, whooks, err := h.servs.WebhooksService.PaginateWebhooks(
|
||||
@@ -37,7 +38,7 @@ func (h *handlers) listWebhooksHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return echoutil.RenderNodx(
|
||||
|
||||
@@ -5,17 +5,18 @@ import (
|
||||
|
||||
"github.com/eduardolat/pgbackweb/internal/logger"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
func (h *handlers) runWebhookHandler(c echo.Context) error {
|
||||
webhookID, err := uuid.Parse(c.Param("webhookID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
go func() {
|
||||
@@ -37,7 +38,7 @@ func (h *handlers) runWebhookHandler(c echo.Context) error {
|
||||
}
|
||||
}()
|
||||
|
||||
return htmx.RespondToastSuccess(c, "Running webhook, check the webhook executions for more details")
|
||||
return htmxs.RespondToastSuccess(c, "Running webhook, check the webhook executions for more details")
|
||||
}
|
||||
|
||||
func runWebhookButton(webhookID uuid.UUID) nodx.Node {
|
||||
|
||||
@@ -13,11 +13,12 @@ import (
|
||||
"github.com/eduardolat/pgbackweb/internal/util/timeutil"
|
||||
"github.com/eduardolat/pgbackweb/internal/validate"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmxs"
|
||||
"github.com/google/uuid"
|
||||
"github.com/labstack/echo/v4"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
alpine "github.com/nodxdev/nodxgo-alpine"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
@@ -25,17 +26,17 @@ func (h *handlers) paginateWebhookExecutionsHandler(c echo.Context) error {
|
||||
ctx := c.Request().Context()
|
||||
webhookID, err := uuid.Parse(c.Param("webhookID"))
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
var queryData struct {
|
||||
Page int `query:"page" validate:"required,min=1"`
|
||||
}
|
||||
if err := c.Bind(&queryData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
if err := validate.Struct(&queryData); err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
pagination, execs, err := h.servs.WebhooksService.PaginateWebhookExecutions(
|
||||
@@ -46,7 +47,7 @@ func (h *handlers) paginateWebhookExecutionsHandler(c echo.Context) error {
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return htmx.RespondToastError(c, err.Error())
|
||||
return htmxs.RespondToastError(c, err.Error())
|
||||
}
|
||||
|
||||
return echoutil.RenderNodx(
|
||||
|
||||
@@ -1,267 +0,0 @@
|
||||
package htmx
|
||||
|
||||
import nodx "github.com/nodxdev/nodxgo"
|
||||
|
||||
// HxGet returns a NodX node with the hx-get
|
||||
// attribute set to the given path.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-get/
|
||||
func HxGet(path string) nodx.Node {
|
||||
return nodx.Attr("hx-get", path)
|
||||
}
|
||||
|
||||
// HxPost returns a NodX node with the hx-post
|
||||
// attribute set to the given path.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-post/
|
||||
func HxPost(path string) nodx.Node {
|
||||
return nodx.Attr("hx-post", path)
|
||||
}
|
||||
|
||||
// HxPut returns a NodX node with the hx-put
|
||||
// attribute set to the given path.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-put/
|
||||
func HxPut(path string) nodx.Node {
|
||||
return nodx.Attr("hx-put", path)
|
||||
}
|
||||
|
||||
// HxPatch returns a NodX node with the hx-patch
|
||||
// attribute set to the given path.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-patch/
|
||||
func HxPatch(path string) nodx.Node {
|
||||
return nodx.Attr("hx-patch", path)
|
||||
}
|
||||
|
||||
// HxDelete returns a NodX node with the hx-delete
|
||||
// attribute set to the given path.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-delete/
|
||||
func HxDelete(path string) nodx.Node {
|
||||
return nodx.Attr("hx-delete", path)
|
||||
}
|
||||
|
||||
// HxTrigger returns a NodX node with the hx-trigger
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-trigger/
|
||||
func HxTrigger(value string) nodx.Node {
|
||||
return nodx.Attr("hx-trigger", value)
|
||||
}
|
||||
|
||||
// HxTarget returns a NodX node with the hx-target
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-target/
|
||||
func HxTarget(value string) nodx.Node {
|
||||
return nodx.Attr("hx-target", value)
|
||||
}
|
||||
|
||||
// HxSwap returns a NodX node with the hx-swap
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-swap/
|
||||
func HxSwap(value string) nodx.Node {
|
||||
return nodx.Attr("hx-swap", value)
|
||||
}
|
||||
|
||||
// HxIndicator returns a NodX node with the hx-indicator
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-indicator/
|
||||
func HxIndicator(value string) nodx.Node {
|
||||
return nodx.Attr("hx-indicator", value)
|
||||
}
|
||||
|
||||
// HxConfirm returns a NodX node with the hx-confirm
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-confirm/
|
||||
func HxConfirm(value string) nodx.Node {
|
||||
return nodx.Attr("hx-confirm", value)
|
||||
}
|
||||
|
||||
// HxBoost returns a NodX node with the hx-boost
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// See https://htmx.org/attributes/hx-boost/
|
||||
func HxBoost(value string) nodx.Node {
|
||||
return nodx.Attr("hx-boost", value)
|
||||
}
|
||||
|
||||
// HxOn returns a NodX node with the hx-on:name="value"
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-on/
|
||||
func HxOn(name string, value string) nodx.Node {
|
||||
return nodx.Attr("hx-on:"+name, value)
|
||||
}
|
||||
|
||||
// HxPushURL returns a NodX node with the hx-push-url
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-push-url/
|
||||
func HxPushURL(value string) nodx.Node {
|
||||
return nodx.Attr("hx-push-url", value)
|
||||
}
|
||||
|
||||
// HxSelect returns a NodX node with the hx-select
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-select/
|
||||
func HxSelect(value string) nodx.Node {
|
||||
return nodx.Attr("hx-select", value)
|
||||
}
|
||||
|
||||
// HxSelectOOB returns a NodX node with the hx-select-oob
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-select-oob/
|
||||
func HxSelectOOB(value string) nodx.Node {
|
||||
return nodx.Attr("hx-select-oob", value)
|
||||
}
|
||||
|
||||
// HxSwapOOB returns a NodX node with the hx-swap-oob
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-swap-oob/
|
||||
func HxSwapOOB(value string) nodx.Node {
|
||||
return nodx.Attr("hx-swap-oob", value)
|
||||
}
|
||||
|
||||
// HxVals returns a NodX node with the hx-vals
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-vals/
|
||||
func HxVals(value string) nodx.Node {
|
||||
return nodx.Attr("hx-vals", value)
|
||||
}
|
||||
|
||||
// HxDisable returns a NodX node with the hx-disable
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-disable/
|
||||
func HxDisable(value string) nodx.Node {
|
||||
return nodx.Attr("hx-disable", value)
|
||||
}
|
||||
|
||||
// HxDisabledELT returns a NodX node with the hx-disabled-elt
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-disabled-elt/
|
||||
func HxDisabledELT(value string) nodx.Node {
|
||||
return nodx.Attr("hx-disabled-elt", value)
|
||||
}
|
||||
|
||||
// HxDisinherit returns a NodX node with the hx-disinherit
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-disinherit/
|
||||
func HxDisinherit(value string) nodx.Node {
|
||||
return nodx.Attr("hx-disinherit", value)
|
||||
}
|
||||
|
||||
// HxEncoding returns a NodX node with the hx-encoding
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-encoding/
|
||||
func HxEncoding(value string) nodx.Node {
|
||||
return nodx.Attr("hx-encoding", value)
|
||||
}
|
||||
|
||||
// HxExt returns a NodX node with the hx-ext
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-ext/
|
||||
func HxExt(value string) nodx.Node {
|
||||
return nodx.Attr("hx-ext", value)
|
||||
}
|
||||
|
||||
// HxHeaders returns a NodX node with the hx-headers
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-headers/
|
||||
func HxHeaders(value string) nodx.Node {
|
||||
return nodx.Attr("hx-headers", value)
|
||||
}
|
||||
|
||||
// HxHistory returns a NodX node with the hx-history
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-history/
|
||||
func HxHistory(value string) nodx.Node {
|
||||
return nodx.Attr("hx-history", value)
|
||||
}
|
||||
|
||||
// HxHistoryElt returns a NodX node with the hx-history-elt
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-history-elt/
|
||||
func HxHistoryElt(value string) nodx.Node {
|
||||
return nodx.Attr("hx-history-elt", value)
|
||||
}
|
||||
|
||||
// HxInclude returns a NodX node with the hx-include
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-include/
|
||||
func HxInclude(value string) nodx.Node {
|
||||
return nodx.Attr("hx-include", value)
|
||||
}
|
||||
|
||||
// HxParams returns a NodX node with the hx-params
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-params/
|
||||
func HxParams(value string) nodx.Node {
|
||||
return nodx.Attr("hx-params", value)
|
||||
}
|
||||
|
||||
// HxPreserve returns a NodX node with the hx-preserve
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-preserve/
|
||||
func HxPreserve(value string) nodx.Node {
|
||||
return nodx.Attr("hx-preserve", value)
|
||||
}
|
||||
|
||||
// HxPrompt returns a NodX node with the hx-prompt
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-prompt/
|
||||
func HxPrompt(value string) nodx.Node {
|
||||
return nodx.Attr("hx-prompt", value)
|
||||
}
|
||||
|
||||
// HxReplaceURL returns a NodX node with the hx-replace-url
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-replace-url/
|
||||
func HxReplaceURL(value string) nodx.Node {
|
||||
return nodx.Attr("hx-replace-url", value)
|
||||
}
|
||||
|
||||
// HxRequest returns a NodX node with the hx-request
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-request/
|
||||
func HxRequest(value string) nodx.Node {
|
||||
return nodx.Attr("hx-request", value)
|
||||
}
|
||||
|
||||
// HxSync returns a NodX node with the hx-sync
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-sync/
|
||||
func HxSync(value string) nodx.Node {
|
||||
return nodx.Attr("hx-sync", value)
|
||||
}
|
||||
|
||||
// HxValidate returns a NodX node with the hx-validate
|
||||
// attribute set to the given value.
|
||||
//
|
||||
// https://htmx.org/attributes/hx-validate/
|
||||
func HxValidate(value string) nodx.Node {
|
||||
return nodx.Attr("hx-validate", value)
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package htmx
|
||||
package htmxs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -1,4 +1,4 @@
|
||||
package htmx
|
||||
package htmxs
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
@@ -3,8 +3,8 @@ package layout
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/view/reqctx"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
)
|
||||
|
||||
type DashboardParams struct {
|
||||
|
||||
@@ -3,9 +3,9 @@ package layout
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
alpine "github.com/nodxdev/nodxgo-alpine"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package layout
|
||||
|
||||
import (
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/component"
|
||||
"github.com/eduardolat/pgbackweb/internal/view/web/htmx"
|
||||
nodx "github.com/nodxdev/nodxgo"
|
||||
htmx "github.com/nodxdev/nodxgo-htmx"
|
||||
lucide "github.com/nodxdev/nodxgo-lucide"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user