mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
updated
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
grafana-pro
BIN
grafana-pro
Binary file not shown.
@@ -44,6 +44,7 @@ func Logger() macaron.Handler {
|
||||
switch rw.Status() {
|
||||
case 200:
|
||||
content = fmt.Sprintf("\033[1;32m%s\033[0m", content)
|
||||
return
|
||||
case 304:
|
||||
return
|
||||
content = fmt.Sprintf("\033[1;33m%s\033[0m", content)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/torkelo/grafana-pro/pkg/components/renderer"
|
||||
@@ -14,17 +15,18 @@ func RenderToPng(c *middleware.Context) {
|
||||
queryParams := "?render&accountId=" + strconv.Itoa(accountId) + "&" + c.Req.URL.RawQuery
|
||||
|
||||
renderOpts := &renderer.RenderOpts{
|
||||
Url: c.Params("url") + queryParams,
|
||||
Url: c.Params("*") + queryParams,
|
||||
Width: queryReader.Get("width", "800"),
|
||||
Height: queryReader.Get("height", "400"),
|
||||
}
|
||||
|
||||
renderOpts.Url = "http://localhost:3000" + renderOpts.Url
|
||||
renderOpts.Url = "http://localhost:3000/" + renderOpts.Url
|
||||
|
||||
pngPath, err := renderer.RenderToPng(renderOpts)
|
||||
if err != nil {
|
||||
c.HTML(500, "error.html", nil)
|
||||
}
|
||||
|
||||
c.ServeFile(pngPath)
|
||||
c.Resp.Header().Set("Content-Type", "image/png")
|
||||
http.ServeFile(c.Resp, c.Req, pngPath)
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ func Register(m *macaron.Macaron) {
|
||||
m.Delete("/api/dashboard/:slug", auth, api.DeleteDashboard)
|
||||
|
||||
// rendering
|
||||
m.Get("/render/*url", auth, api.RenderToPng)
|
||||
m.Get("/render/*", auth, api.RenderToPng)
|
||||
}
|
||||
|
||||
func Index(ctx *middleware.Context) {
|
||||
|
Reference in New Issue
Block a user