This commit is contained in:
@@ -4,9 +4,25 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/flamego/template"
|
||||
|
||||
"git.metaunix.net/bitgoblin/blt/models"
|
||||
)
|
||||
|
||||
func GetDashboard(t template.Template, data template.Data) {
|
||||
// add tests to template; limited to 10 most recent
|
||||
var tests []models.Test
|
||||
models.DB.Order("updated_at desc").Limit(10).Find(&tests)
|
||||
data["tests"] = tests
|
||||
|
||||
// add hardwares to template; limited to 5 most recent
|
||||
var hardware []models.Hardware
|
||||
models.DB.Order("updated_at desc").Limit(5).Find(&hardware)
|
||||
data["hardware"] = hardware
|
||||
// add benchmarks to template; limited to 5 most recent
|
||||
var benchmarks []models.Benchmark
|
||||
models.DB.Order("updated_at desc").Limit(5).Find(&benchmarks)
|
||||
data["benchmarks"] = benchmarks
|
||||
|
||||
data["title"] = "Dashboard"
|
||||
t.HTML(http.StatusOK, "index/dashboard")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user