Commit d88286ab by bergquist

orgs: set orgId as query param on load

ref #1613
parent 73830a44
......@@ -2,8 +2,9 @@ define([
'angular',
'lodash',
'jquery',
'app/core/config'
],
function (angular, _, $) {
function (angular, _, $, config) {
'use strict';
var module = angular.module('grafana.services');
......@@ -63,6 +64,7 @@ function (angular, _, $) {
state.fullscreen = state.fullscreen ? true : null;
state.edit = (state.edit === "true" || state.edit === true) || null;
state.editview = state.editview || null;
state.orgId = config.bootData.user.orgId;
return state;
};
......
define([
'app/features/dashboard/viewStateSrv'
], function() {
'app/features/dashboard/viewStateSrv',
'app/core/config'
], function(viewStateSrv, config) {
'use strict';
describe('when updating view state', function() {
......@@ -12,7 +13,13 @@ define([
orgId: 19
}
};
beforeEach(function() {
config.bootData = {
user: {
orgId: 1
}
};
});
beforeEach(module('grafana.services'));
beforeEach(module(function($provide) {
$provide.value('timeSrv', timeSrv);
......@@ -31,7 +38,7 @@ define([
it('should update querystring and view state', function() {
var updateState = {fullscreen: true, edit: true, panelId: 1};
viewState.update(updateState);
expect(location.search()).to.eql({fullscreen: true, edit: true, panelId: 1});
expect(location.search()).to.eql({fullscreen: true, edit: true, panelId: 1, orgId: 1});
expect(viewState.dashboard.meta.fullscreen).to.be(true);
expect(viewState.state.fullscreen).to.be(true);
});
......@@ -45,7 +52,5 @@ define([
expect(viewState.state.fullscreen).to.be(null);
});
});
});
});
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