diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ade6b78d33..15e1527ad8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,14 @@ # 2.0.0 (unreleased) **New features** +- [Issue #1622](https://github.com/grafana/grafana/issues/1622). Share Panel: The share modal now has an embed option, gives you an iframe that you can use to embedd a single graph on another web site - [Issue #718](https://github.com/grafana/grafana/issues/718). Dashboard: When saving a dashboard and another user has made changes inbetween the user is promted with a warning if he really wants to overwrite the other's changes - [Issue #1331](https://github.com/grafana/grafana/issues/1331). Graph & Singlestat: New axis/unit format selector and more units (kbytes, Joule, Watt, eV), and new design for graph axis & grid tab and single stat options tab views - [Issue #1241](https://github.com/grafana/grafana/issues/1242). Timepicker: New option in timepicker (under dashboard settings), to change ``now`` to be for example ``now-1m``, usefull when you want to ignore last minute because it contains incomplete data - [Issue #171](https://github.com/grafana/grafana/issues/171). Panel: Different time periods, panels can override dashboard relative time and/or add a time shift - [Issue #1488](https://github.com/grafana/grafana/issues/1488). Dashboard: Clone dashboard / Save as - [Issue #1458](https://github.com/grafana/grafana/issues/1458). User: persisted user option for dark or light theme (no longer an option on a dashboard) -- [Issue #452](https://github.com/grafana/grafana/issues/452). Graph: Adds logarithmic scale option (log base 10) +- [Issue #452](https://github.com/grafana/grafana/issues/452). Graph: Adds logarithmic scale option for base 10, base 16 and base 1024 **Enhancements** - [Issue #1366](https://github.com/grafana/grafana/issues/1366). Graph & Singlestat: Support for additional units, Fahrenheit (°F) and Celsius (°C), Humidity (%H), kW, watt-hour (Wh), kilowatt-hour (kWh), velocities (m/s, km/h, mpg, knot) diff --git a/pkg/api/render.go b/pkg/api/render.go index 8649dfe4c6b..0398d455cc8 100644 --- a/pkg/api/render.go +++ b/pkg/api/render.go @@ -12,12 +12,13 @@ import ( func RenderToPng(c *middleware.Context) { queryReader := util.NewUrlQueryReader(c.Req.URL) - queryParams := fmt.Sprintf("?render=1&%s=%d&%s", middleware.SESS_KEY_USERID, c.UserId, c.Req.URL.RawQuery) + queryParams := fmt.Sprintf("?%s", c.Req.URL.RawQuery) renderOpts := &renderer.RenderOpts{ - Url: c.Params("*") + queryParams, - Width: queryReader.Get("width", "800"), - Height: queryReader.Get("height", "400"), + Url: c.Params("*") + queryParams, + Width: queryReader.Get("width", "800"), + Height: queryReader.Get("height", "400"), + SessionId: c.Session.ID(), } renderOpts.Url = setting.ToAbsUrl(renderOpts.Url) diff --git a/pkg/components/renderer/renderer.go b/pkg/components/renderer/renderer.go index cd8979a57bc..054632395ce 100644 --- a/pkg/components/renderer/renderer.go +++ b/pkg/components/renderer/renderer.go @@ -14,9 +14,10 @@ import ( ) type RenderOpts struct { - Url string - Width string - Height string + Url string + Width string + Height string + SessionId string } func RenderToPng(params *RenderOpts) (string, error) { @@ -26,7 +27,9 @@ func RenderToPng(params *RenderOpts) (string, error) { pngPath, _ := filepath.Abs(filepath.Join(setting.ImagesDir, getHash(params.Url))) pngPath = pngPath + ".png" - cmd := exec.Command(binPath, scriptPath, "url="+params.Url, "width="+params.Width, "height="+params.Height, "png="+pngPath) + cmd := exec.Command(binPath, scriptPath, "url="+params.Url, "width="+params.Width, + "height="+params.Height, "png="+pngPath, "cookiename="+setting.SessionOptions.CookieName, + "domain="+setting.Domain, "sessionid="+params.SessionId) stdout, err := cmd.StdoutPipe() if err != nil { diff --git a/pkg/middleware/auth.go b/pkg/middleware/auth.go index 7c8f8f30087..53b554942a6 100644 --- a/pkg/middleware/auth.go +++ b/pkg/middleware/auth.go @@ -22,13 +22,6 @@ func getRequestUserId(c *Context) int64 { return userId.(int64) } - // TODO: figure out a way to secure this - if c.Req.URL.Query().Get("render") == "1" { - userId := c.QueryInt64(SESS_KEY_USERID) - c.Session.Set(SESS_KEY_USERID, userId) - return userId - } - return 0 } diff --git a/src/app/features/dashboard/dashboardNavCtrl.js b/src/app/features/dashboard/dashboardNavCtrl.js index a47e19b561f..5950c504a3a 100644 --- a/src/app/features/dashboard/dashboardNavCtrl.js +++ b/src/app/features/dashboard/dashboardNavCtrl.js @@ -42,7 +42,7 @@ function (angular, _, moment) { $scope.shareDashboard = function() { $scope.appEvent('show-modal', { - src: './app/features/dashboard/partials/shareModal.html', + src: './app/features/dashboard/partials/shareDashboard.html', scope: $scope.$new(), }); }; diff --git a/src/app/features/dashboard/partials/shareDashboard.html b/src/app/features/dashboard/partials/shareDashboard.html new file mode 100644 index 00000000000..e052c5b298f --- /dev/null +++ b/src/app/features/dashboard/partials/shareDashboard.html @@ -0,0 +1,48 @@ + diff --git a/src/app/features/dashboard/partials/shareModal.html b/src/app/features/dashboard/partials/shareModal.html deleted file mode 100644 index c5c36d889e4..00000000000 --- a/src/app/features/dashboard/partials/shareModal.html +++ /dev/null @@ -1,53 +0,0 @@ -