Commit c0da52aa by Torkel Ödegaard

fix(share): fixed share panel image url, did not generate correct url when…

fix(share): fixed share panel image url, did not generate correct url when domain name contained word dashboards, fixes #2916
parent c8313699
......@@ -75,7 +75,7 @@ function (angular, _, require, config) {
$scope.iframeHtml = '<iframe src="' + soloUrl + '" width="450" height="200" frameborder="0"></iframe>';
$scope.imageUrl = soloUrl.replace('/dashboard', '/render/dashboard');
$scope.imageUrl = soloUrl.replace('/dashboard-solo/', '/render/dashboard-solo/');
$scope.imageUrl += '&width=1000';
$scope.imageUrl += '&height=500';
};
......
......@@ -38,9 +38,10 @@ define([
};
this.createControllerPhase = function(controllerName) {
return inject(function($controller, $rootScope, $q, $location) {
return inject(function($controller, $rootScope, $q, $location, $browser) {
self.scope = $rootScope.$new();
self.$location = $location;
self.$browser = $browser;
self.scope.contextSrv = {};
self.scope.panel = {};
self.scope.row = { panels:[] };
......
......@@ -7,6 +7,7 @@ define([
describe('ShareModalCtrl', function() {
var ctx = new helpers.ControllerTestContext();
var browser;
function setTime(range) {
ctx.timeSrv.timeRange = sinon.stub().returns(range);
......@@ -31,6 +32,17 @@ define([
expect(ctx.scope.shareUrl).to.be('http://server/#/test?from=1000&to=2000&panelId=22&fullscreen');
});
it('should generate render url', function() {
ctx.$location.$$absUrl = 'http://dashboards.grafana.com/dashboard/db/my-dash';
ctx.scope.panel = { id: 22 };
ctx.scope.init();
var base = 'http://dashboards.grafana.com/render/dashboard-solo/db/my-dash';
var params = '?from=1000&to=2000&panelId=22&fullscreen&width=1000&height=500';
expect(ctx.scope.imageUrl).to.be(base + params);
});
it('should remove panel id when no panel in scope', function() {
ctx.$location.path('/test');
ctx.scope.options.forCurrent = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment