rename html fragments to go.tmpl extension
This commit is contained in:
@@ -42,7 +42,7 @@ type GlobalConfig struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserConfig struct {
|
type UserConfigResources struct {
|
||||||
CPU struct {
|
CPU struct {
|
||||||
Global []CPUConfig
|
Global []CPUConfig
|
||||||
Nodes map[string][]CPUConfig
|
Nodes map[string][]CPUConfig
|
||||||
@@ -102,7 +102,7 @@ func HandleGETConfigVolumesFragment(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.Header("Content-Type", "text/plain")
|
c.Header("Content-Type", "text/plain")
|
||||||
common.TMPL.ExecuteTemplate(c.Writer, "html/config-volumes.frag", gin.H{
|
common.TMPL.ExecuteTemplate(c.Writer, "html/config-volumes.go.tmpl", gin.H{
|
||||||
"config": config,
|
"config": config,
|
||||||
})
|
})
|
||||||
c.Status(http.StatusOK)
|
c.Status(http.StatusOK)
|
||||||
@@ -125,7 +125,7 @@ func HandleGETConfigNetsFragment(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.Header("Content-Type", "text/plain")
|
c.Header("Content-Type", "text/plain")
|
||||||
common.TMPL.ExecuteTemplate(c.Writer, "html/config-nets.frag", gin.H{
|
common.TMPL.ExecuteTemplate(c.Writer, "html/config-nets.go.tmpl", gin.H{
|
||||||
"config": config,
|
"config": config,
|
||||||
})
|
})
|
||||||
c.Status(http.StatusOK)
|
c.Status(http.StatusOK)
|
||||||
@@ -148,7 +148,7 @@ func HandleGETConfigDevicesFragment(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.Header("Content-Type", "text/plain")
|
c.Header("Content-Type", "text/plain")
|
||||||
common.TMPL.ExecuteTemplate(c.Writer, "html/config-devices.frag", gin.H{
|
common.TMPL.ExecuteTemplate(c.Writer, "html/config-devices.go.tmpl", gin.H{
|
||||||
"config": config,
|
"config": config,
|
||||||
})
|
})
|
||||||
c.Status(http.StatusOK)
|
c.Status(http.StatusOK)
|
||||||
@@ -171,7 +171,7 @@ func HandleGETConfigBootFragment(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.Header("Content-Type", "text/plain")
|
c.Header("Content-Type", "text/plain")
|
||||||
common.TMPL.ExecuteTemplate(c.Writer, "html/config-boot.frag", gin.H{
|
common.TMPL.ExecuteTemplate(c.Writer, "html/config-boot.go.tmpl", gin.H{
|
||||||
"config": config,
|
"config": config,
|
||||||
})
|
})
|
||||||
c.Status(http.StatusOK)
|
c.Status(http.StatusOK)
|
||||||
@@ -264,7 +264,7 @@ func GetCPUTypes(vm VMPath, auth common.Auth) (common.Select, error) {
|
|||||||
if code != 200 {
|
if code != 200 {
|
||||||
return cputypes, fmt.Errorf("request to %s resulted in %+v", path, res)
|
return cputypes, fmt.Errorf("request to %s resulted in %+v", path, res)
|
||||||
}
|
}
|
||||||
user := UserConfig{}
|
user := UserConfigResources{}
|
||||||
err = mapstructure.Decode(ctx.Body, &user)
|
err = mapstructure.Decode(ctx.Body, &user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cputypes, err
|
return cputypes, err
|
||||||
|
@@ -50,11 +50,12 @@ func HandleGETIndex(c *gin.Context) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
common.HandleNonFatalError(c, err)
|
common.HandleNonFatalError(c, err)
|
||||||
}
|
}
|
||||||
c.HTML(http.StatusOK, "html/index.html", gin.H{
|
page := gin.H{
|
||||||
"global": common.Global,
|
"global": common.Global,
|
||||||
"page": "index",
|
"page": "index",
|
||||||
"instances": instances,
|
"instances": instances,
|
||||||
})
|
}
|
||||||
|
c.HTML(http.StatusOK, "html/index.html", page)
|
||||||
} else { // return index without populating
|
} else { // return index without populating
|
||||||
c.Redirect(http.StatusFound, "/login") // if user is not authed, redirect user to login page
|
c.Redirect(http.StatusFound, "/login") // if user is not authed, redirect user to login page
|
||||||
}
|
}
|
||||||
@@ -68,7 +69,7 @@ func HandleGETInstancesFragment(c *gin.Context) {
|
|||||||
common.HandleNonFatalError(c, err)
|
common.HandleNonFatalError(c, err)
|
||||||
}
|
}
|
||||||
c.Header("Content-Type", "text/plain")
|
c.Header("Content-Type", "text/plain")
|
||||||
common.TMPL.ExecuteTemplate(c.Writer, "html/index-instances.frag", gin.H{
|
common.TMPL.ExecuteTemplate(c.Writer, "html/index-instances.go.tmpl", gin.H{
|
||||||
"instances": instances,
|
"instances": instances,
|
||||||
})
|
})
|
||||||
c.Status(http.StatusOK)
|
c.Status(http.StatusOK)
|
||||||
|
Reference in New Issue
Block a user