collect submit source

This commit is contained in:
Robin Olsen
2026-03-24 12:32:57 +01:00
parent fc10321430
commit 6808ed3bbe
14 changed files with 300 additions and 63 deletions

View File

@@ -14,18 +14,23 @@ import (
type ValidationFeedback = models.ValidationFeedback
var taskFeedback ValidationFeedback
var submitChan chan<- struct{}
var submitChan chan<- models.ValidationTrigger
func SetTaskFeedback(feedback ValidationFeedback) {
taskFeedback = feedback
}
func SetSubmitChan(ch chan<- struct{}) {
func SetSubmitChan(ch chan<- models.ValidationTrigger) {
submitChan = ch
}
func HandleTaskStatus(w http.ResponseWriter, r *http.Request) {
submitChan <- struct{}{}
if submitChan != nil {
select {
case submitChan <- models.ValidationTrigger{Source: models.ValidationTriggerAutoPoll}:
default:
}
}
time.Sleep(100 * time.Millisecond)
hx := HTMX(r)

View File

@@ -90,11 +90,21 @@ func shouldLogWebAction(path string) bool {
if strings.HasPrefix(path, "/assets/") {
return false
}
if strings.HasPrefix(path, "/.well-known/") {
return false
}
switch path {
case "/status":
return false
case "/status/modal":
return false
case "/favicon.ico":
return false
default:
if strings.HasSuffix(path, "/dependencies") || strings.HasSuffix(path, "/dependencies/options") {
return false
}
return true
}
}

View File

@@ -27,7 +27,7 @@ type ValidationFeedback = models.ValidationFeedback
type Web struct {
feedbackChan chan ValidationFeedback
quitChan chan bool
submitChan chan<- struct{}
submitChan chan<- models.ValidationTrigger
}
func New() *Web {
@@ -195,6 +195,6 @@ func (w *Web) SetChannels(feedbackChan chan ValidationFeedback, quitChan chan bo
w.quitChan = quitChan
}
func (w *Web) SetSubmitChan(submitChan chan<- struct{}) {
func (w *Web) SetSubmitChan(submitChan chan<- models.ValidationTrigger) {
w.submitChan = submitChan
}