mirror of
https://github.com/JustKato/drive-health.git
synced 2026-03-19 15:09:46 +02:00
Basic disk page implementation
+ Basic information about the disk
This commit is contained in:
@@ -15,6 +15,21 @@ func setupFrontend(r *gin.Engine) {
|
||||
r.LoadHTMLGlob("templates/*")
|
||||
r.Static("/static", "./static")
|
||||
|
||||
r.GET("/disk/:id", func(ctx *gin.Context) {
|
||||
id := ctx.Param("id")
|
||||
var hdd hardware.HardDrive
|
||||
tx := svc.GetDatabaseRef().Where("id = ?", id).Preload("Temperatures").First(&hdd)
|
||||
if tx.Error != nil {
|
||||
ctx.AbortWithError(500, tx.Error)
|
||||
return
|
||||
}
|
||||
|
||||
// Render the HTML template
|
||||
ctx.HTML(http.StatusOK, "drive.html", gin.H{
|
||||
"hdd": hdd,
|
||||
})
|
||||
})
|
||||
|
||||
// Set up a route for the root URL
|
||||
r.GET("/", func(ctx *gin.Context) {
|
||||
hardDrives, err := hardware.GetSystemHardDrives(svc.GetDatabaseRef(), nil, nil)
|
||||
|
||||
Reference in New Issue
Block a user