Commit d8df421b by Torkel Ödegaard

fix(build): fixed issues with optimized build, fixes #6096

parent 39af588a
...@@ -18,7 +18,7 @@ export class ConstantVariable implements Variable { ...@@ -18,7 +18,7 @@ export class ConstantVariable implements Variable {
current: {}, current: {},
}; };
/** @ngInject */ /** @ngInject **/
constructor(private model, private variableSrv) { constructor(private model, private variableSrv) {
assignModelProperties(this, model, this.defaults); assignModelProperties(this, model, this.defaults);
} }
......
...@@ -22,7 +22,7 @@ export class DatasourceVariable implements Variable { ...@@ -22,7 +22,7 @@ export class DatasourceVariable implements Variable {
query: '', query: '',
}; };
/** @ngInject */ /** @ngInject **/
constructor(private model, private datasourceSrv, private variableSrv) { constructor(private model, private datasourceSrv, private variableSrv) {
assignModelProperties(this, model, this.defaults); assignModelProperties(this, model, this.defaults);
} }
......
...@@ -6,7 +6,7 @@ import {variableTypes} from './variable'; ...@@ -6,7 +6,7 @@ import {variableTypes} from './variable';
export class VariableEditorCtrl { export class VariableEditorCtrl {
/** @ngInject */ /** @ngInject **/
constructor(private $scope, private datasourceSrv, private variableSrv, templateSrv) { constructor(private $scope, private datasourceSrv, private variableSrv, templateSrv) {
$scope.variableTypes = variableTypes; $scope.variableTypes = variableTypes;
$scope.ctrl = {}; $scope.ctrl = {};
......
...@@ -28,7 +28,7 @@ export class IntervalVariable implements Variable { ...@@ -28,7 +28,7 @@ export class IntervalVariable implements Variable {
auto_count: 30, auto_count: 30,
}; };
/** @ngInject */ /** @ngInject **/
constructor(private model, private timeSrv, private templateSrv, private variableSrv) { constructor(private model, private timeSrv, private templateSrv, private variableSrv) {
assignModelProperties(this, model, this.defaults); assignModelProperties(this, model, this.defaults);
this.refresh = 2; this.refresh = 2;
......
...@@ -40,6 +40,7 @@ export class QueryVariable implements Variable { ...@@ -40,6 +40,7 @@ export class QueryVariable implements Variable {
tagValuesQuery: null, tagValuesQuery: null,
}; };
/** @ngInject **/
constructor(private model, private datasourceSrv, private templateSrv, private variableSrv, private $q) { constructor(private model, private datasourceSrv, private templateSrv, private variableSrv, private $q) {
// copy model properties to this instance // copy model properties to this instance
assignModelProperties(this, model, this.defaults); assignModelProperties(this, model, this.defaults);
......
define([
'../mocks/dashboard-mock',
'./helpers',
'app/features/templating/templateValuesSrv'
], function(dashboardMock, helpers) {
'use strict';
describe('templateValuesSrv', function() {
var ctx = new helpers.ServiceTestContext();
beforeEach(module('grafana.services'));
beforeEach(ctx.providePhase(['datasourceSrv', 'timeSrv', 'templateSrv', '$location']));
beforeEach(ctx.createService('templateValuesSrv'));
describe('when template variable is present in url', function() {
describe('and setting simple variable', function() {
var variable = {
name: 'apps',
current: {text: "test", value: "test"},
options: [{text: "test", value: "test"}]
};
beforeEach(function(done) {
var dashboard = { templating: { list: [variable] } };
var urlParams = {};
urlParams["var-apps"] = "new";
ctx.$location.search = sinon.stub().returns(urlParams);
ctx.service.init(dashboard).then(function() { done(); });
ctx.$rootScope.$digest();
});
it('should update current value', function() {
expect(variable.current.value).to.be("new");
expect(variable.current.text).to.be("new");
});
});
// describe('and setting adhoc variable', function() {
// var variable = {name: 'filters', type: 'adhoc'};
//
// beforeEach(function(done) {
// var dashboard = { templating: { list: [variable] } };
// var urlParams = {};
// urlParams["var-filters"] = "hostname|gt|server2";
// ctx.$location.search = sinon.stub().returns(urlParams);
// ctx.service.init(dashboard).then(function() { done(); });
// ctx.$rootScope.$digest();
// });
//
// it('should update current value', function() {
// expect(variable.tags[0]).to.eq({tag: 'hostname', value: 'server2'});
// });
// });
});
});
});
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