From cb9036aab96895ddf03cab68f75d3356f5227968 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sun, 26 Jan 2025 14:53:14 +0100 Subject: feat: Add log pagination Now it is possible to navigate through all commit from a given repository. It implements a simple navigation which will plenty for now. --- pkg/handler/git/handler.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pkg/handler') diff --git a/pkg/handler/git/handler.go b/pkg/handler/git/handler.go index 6225b1a..436d364 100644 --- a/pkg/handler/git/handler.go +++ b/pkg/handler/git/handler.go @@ -130,7 +130,7 @@ func (g *GitHandler) Summary(w http.ResponseWriter, r *http.Request) error { return err } - commits, err := g.gitService.ListCommits(name, "", 10) + commits, _, err := g.gitService.ListCommits(name, "", "", 10) if err != nil { return err } @@ -324,8 +324,9 @@ func (g *GitHandler) Log(w http.ResponseWriter, r *http.Request) error { ext.SetHTML(w) name := r.PathValue("name") ref := r.PathValue("ref") + from := r.URL.Query().Get("from") - commits, err := g.gitService.ListCommits(name, ref, 1000) + commits, next, err := g.gitService.ListCommits(name, ref, from, 100) if err != nil { return err } @@ -335,6 +336,7 @@ func (g *GitHandler) Log(w http.ResponseWriter, r *http.Request) error { Ref: ref, GitItemBase: &templates.GitItemLogPage{ Commits: commits, + Next: next, }, } templates.WritePageTemplate(w, gitList, r.Context()) -- cgit v1.2.3