feat: enable proxy toggle on quick deploy, event log clearing, and UX fixes

- Add enable_proxy toggle to Quick Deploy form (defaults to on)
- Add DELETE /api/events/log/{id} and DELETE /api/events/log endpoints
- Add Clear All button with confirmation on Events page
- Rename "NPM Proxy" to "Enable Proxy" on stage form (provider-agnostic)
- Fix polling interval validation (min 60s) and number input trim errors
- Fix domain field no longer required in settings
This commit is contained in:
2026-04-05 01:50:19 +03:00
parent 61febefca9
commit c26c41e6a1
10 changed files with 134 additions and 13 deletions
+28
View File
@@ -5,6 +5,8 @@ import (
"net/http"
"strconv"
"github.com/go-chi/chi/v5"
"github.com/alexei/docker-watcher/internal/store"
)
@@ -46,3 +48,29 @@ func (s *Server) getEventLogStats(w http.ResponseWriter, r *http.Request) {
respondJSON(w, http.StatusOK, stats)
}
// deleteEvent handles DELETE /api/events/log/{id}.
func (s *Server) deleteEvent(w http.ResponseWriter, r *http.Request) {
id, err := strconv.ParseInt(chi.URLParam(r, "id"), 10, 64)
if err != nil {
respondError(w, http.StatusBadRequest, "invalid event ID")
return
}
if err := s.store.DeleteEvent(id); err != nil {
slog.Error("failed to delete event", "id", id, "error", err)
respondError(w, http.StatusInternalServerError, "internal server error")
return
}
respondJSON(w, http.StatusOK, map[string]string{"status": "deleted"})
}
// clearEvents handles DELETE /api/events/log.
func (s *Server) clearEvents(w http.ResponseWriter, r *http.Request) {
cleared, err := s.store.ClearAllEvents()
if err != nil {
slog.Error("failed to clear events", "error", err)
respondError(w, http.StatusInternalServerError, "internal server error")
return
}
respondJSON(w, http.StatusOK, map[string]any{"status": "cleared", "count": cleared})
}