forked from shamanec/GADS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage_routes.go
40 lines (34 loc) · 1.14 KB
/
page_routes.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
28
29
30
31
32
33
34
35
36
37
38
39
40
package router
import (
"GADS/util"
"fmt"
"html/template"
"net/http"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
)
func GetInitialPage(c *gin.Context) {
var index = template.Must(template.ParseFiles("static/index.html"))
err := index.Execute(c.Writer, nil)
if err != nil {
c.String(http.StatusInternalServerError, fmt.Sprintf("Could not create the initial page html - %s", err.Error()))
}
}
func GetSeleniumGridPage(c *gin.Context) {
var index = template.Must(template.ParseFiles("static/selenium_grid.html"))
err := index.Execute(c.Writer, util.ConfigData)
if err != nil {
c.String(http.StatusInternalServerError, fmt.Sprintf("Could not create the selenium grid page html - %s", err.Error()))
}
}
func GetLogsPage(c *gin.Context) {
var logs_page = template.Must(template.ParseFiles("static/project_logs.html"))
util.ConfigData.Providers = util.GetProvidersFromDB()
err := logs_page.Execute(c.Writer, util.ConfigData)
if err != nil {
log.WithFields(log.Fields{
"event": "project_logs_page",
}).Error("Couldn't load project_logs.html: " + err.Error())
c.String(http.StatusInternalServerError, err.Error())
}
}