Add paginated test history listing with disable option
Add GET /tests endpoint returning lightweight test summaries (grade, score, domain, date) with pagination, using database-level JSON extraction to avoid loading full report blobs. The feature can be disabled with --disable-test-list flag. Frontend includes a new /tests/ page with table view and a conditional "History" navbar link. Fixes: https://github.com/happyDomain/happydeliver/issues/12
This commit is contained in:
parent
e540377bd9
commit
7422f6ed0a
12 changed files with 546 additions and 3 deletions
|
|
@ -70,6 +70,10 @@ func DeclareRoutes(cfg *config.Config, router *gin.Engine) {
|
|||
appConfig["custom_logo_url"] = cfg.CustomLogoURL
|
||||
}
|
||||
|
||||
if !cfg.DisableTestList {
|
||||
appConfig["test_list_enabled"] = true
|
||||
}
|
||||
|
||||
if appcfg, err := json.MarshalIndent(appConfig, "", " "); err != nil {
|
||||
log.Println("Unable to generate JSON config to inject in web application")
|
||||
} else {
|
||||
|
|
@ -95,6 +99,7 @@ func DeclareRoutes(cfg *config.Config, router *gin.Engine) {
|
|||
router.GET("/domain/:domain", serveOrReverse("/", cfg))
|
||||
router.GET("/test/", serveOrReverse("/", cfg))
|
||||
router.GET("/test/:testid", serveOrReverse("/", cfg))
|
||||
router.GET("/history/", serveOrReverse("/", cfg))
|
||||
router.GET("/favicon.png", func(c *gin.Context) { c.Writer.Header().Set("Cache-Control", "public, max-age=604800, immutable") }, serveOrReverse("", cfg))
|
||||
router.GET("/img/*path", serveOrReverse("", cfg))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue