소스 검색

Fixed bug in png rendering when having changed public url

Torkel Ödegaard 11 년 전
부모
커밋
397dfc54cd
4개의 변경된 파일5개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 3
      .gitignore
  2. 2 1
      pkg/api/render.go
  3. 1 1
      pkg/api/search.go
  4. 1 1
      pkg/setting/setting.go

+ 1 - 3
.gitignore

@@ -14,9 +14,7 @@ src/css/*.min.css
 *.swp
 *.swp
 .idea/
 .idea/
 
 
-data/sessions
-data/*.db
-data/log
+/data/*
 /bin/*
 /bin/*
 /grafana-pro
 /grafana-pro
 
 

+ 2 - 1
pkg/api/render.go

@@ -6,6 +6,7 @@ import (
 
 
 	"github.com/grafana/grafana/pkg/components/renderer"
 	"github.com/grafana/grafana/pkg/components/renderer"
 	"github.com/grafana/grafana/pkg/middleware"
 	"github.com/grafana/grafana/pkg/middleware"
+	"github.com/grafana/grafana/pkg/setting"
 	"github.com/grafana/grafana/pkg/util"
 	"github.com/grafana/grafana/pkg/util"
 )
 )
 
 
@@ -19,7 +20,7 @@ func RenderToPng(c *middleware.Context) {
 		Height: queryReader.Get("height", "400"),
 		Height: queryReader.Get("height", "400"),
 	}
 	}
 
 
-	renderOpts.Url = "http://localhost:3000/" + renderOpts.Url
+	renderOpts.Url = setting.ToAbsUrl(renderOpts.Url)
 	pngPath, err := renderer.RenderToPng(renderOpts)
 	pngPath, err := renderer.RenderToPng(renderOpts)
 
 
 	if err != nil {
 	if err != nil {

+ 1 - 1
pkg/api/search.go

@@ -81,7 +81,7 @@ func Search(c *middleware.Context) {
 
 
 		result.Dashboards = query.Result
 		result.Dashboards = query.Result
 		for _, dash := range result.Dashboards {
 		for _, dash := range result.Dashboards {
-			dash.Url = setting.AbsUrlTo("dashboard/db/" + dash.Slug)
+			dash.Url = setting.ToAbsUrl("dashboard/db/" + dash.Slug)
 		}
 		}
 	}
 	}
 
 

+ 1 - 1
pkg/setting/setting.go

@@ -148,7 +148,7 @@ func parseAppUrlAndSubUrl(section *ini.Section) (string, string) {
 	return appUrl, appSubUrl
 	return appUrl, appSubUrl
 }
 }
 
 
-func AbsUrlTo(relativeUrl string) string {
+func ToAbsUrl(relativeUrl string) string {
 	return AppUrl + relativeUrl
 	return AppUrl + relativeUrl
 }
 }