/
index.go
27 lines (22 loc) 路 925 Bytes
/
index.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package controller
import (
"github.com/Shitovdm/GitRsync/src/component/conf"
"github.com/Shitovdm/GitRsync/src/component/gui"
"github.com/Shitovdm/GitRsync/src/component/logger"
"github.com/gin-gonic/gin"
"net/http"
)
// IndexController struct describes index section controller.
type IndexController struct{}
// Index describes index index page.
func (ctrl IndexController) Index(c *gin.Context) {
menu := gui.GetMenu(c)
templateParams := gin.H{"menu": menu}
templateParams["title"] = "Dashboard"
templateParams["config"], _ = conf.GetAppConfigData()
templateParams["platforms"], _ = conf.GetPlatformsConfigData()
templateParams["active_repositories"], _ = conf.GetActiveRepositoriesConfigData()
templateParams["blocked_repositories"], _ = conf.GetBlockedRepositoriesConfigData()
templateParams["log_error_count"] = logger.CountErrorsInRuntimeLog()
c.HTML(http.StatusOK, "index/index", templateParams)
}