diff --git a/README.md b/README.md index 342e52e..72bdb80 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,6 @@ local Lixie instance which probably does not exist. - add error messages if log retrieval fails -- fix fts to update counters too - ## Big features - Optimize rule evaluation (it could be also used when generating rules for diff --git a/log.templ b/log.templ index 9e86ccd..406f70d 100644 --- a/log.templ +++ b/log.templ @@ -157,7 +157,13 @@ templ LogList(m LogListModel) { } @Col(2) { -
+
{ strconv.Itoa(m.TotalCount) } log entries
{ strconv.Itoa(m.FilteredCount) } shown diff --git a/log_list.go b/log_list.go index 544178c..5d295a0 100644 --- a/log_list.go +++ b/log_list.go @@ -111,6 +111,9 @@ type LogListModel struct { DisableActions bool DisablePagination bool + // Is this post request (.. sigh ..) + Post bool + // Convenience results from filter() EnableAccurateCounting bool FilteredCount int @@ -177,7 +180,7 @@ func logListHandler(db *data.Database) http.Handler { http.Error(w, err.Error(), 400) return } - model := LogListModel{Config: config, DB: db, Limit: 20} + model := LogListModel{Config: config, DB: db, Limit: 20, Post: r.Method == "POST"} model.Filter() err = LogList(model).Render(r.Context(), w) if err != nil { diff --git a/log_templ.go b/log_templ.go index ad4a251..6263a81 100644 --- a/log_templ.go +++ b/log_templ.go @@ -678,14 +678,24 @@ func LogList(m LogListModel) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var43 string templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(m.TotalCount)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `log.templ`, Line: 161, Col: 33} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `log.templ`, Line: 165, Col: 33} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43)) if templ_7745c5c3_Err != nil { @@ -698,7 +708,7 @@ func LogList(m LogListModel) templ.Component { var templ_7745c5c3_Var44 string templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(m.FilteredCount)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `log.templ`, Line: 163, Col: 36} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `log.templ`, Line: 167, Col: 36} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44)) if templ_7745c5c3_Err != nil {