Added timefilter to problems
This commit is contained in:
parent
9700bc9d3c
commit
f7dcb4a079
4 changed files with 62 additions and 62 deletions
20
main.go
20
main.go
|
|
@ -521,7 +521,21 @@ func pageProblems(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{
|
|||
CONFIG: smonConfig.Settings,
|
||||
}
|
||||
|
||||
problems, err := ProblemsRetrieve()
|
||||
// Manage the values from the timefilter component
|
||||
var err error
|
||||
var timeFrom, timeTo time.Time
|
||||
timeFrom, timeTo, err = timefilterParse(
|
||||
r.URL.Query().Get("time-f"),
|
||||
r.URL.Query().Get("time-t"),
|
||||
r.URL.Query().Get("time-offset"),
|
||||
r.URL.Query().Get("time-preset"),
|
||||
)
|
||||
if err != nil {
|
||||
httpError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
problems, err := ProblemsRetrieve(true, timeFrom, timeTo)
|
||||
if err != nil {
|
||||
httpError(w, werr.Wrap(err).Log())
|
||||
return
|
||||
|
|
@ -546,6 +560,10 @@ func pageProblems(w http.ResponseWriter, r *http.Request, _ *session.T) { // {{{
|
|||
page.Data = map[string]any{
|
||||
"Problems": problems,
|
||||
"ProblemsGrouped": problemsGrouped,
|
||||
|
||||
"TimeSubmit": "/problems",
|
||||
"TimeFrom": timeFrom.Format("2006-01-02T15:04:05"),
|
||||
"TimeTo": timeTo.Format("2006-01-02T15:04:05"),
|
||||
}
|
||||
page.Render(w, r)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue