mirror of
https://github.com/grafana/grafana.git
synced 2025-01-24 23:37:01 -06:00
Merge branch 'tsconfig-no-implicit-this'
This commit is contained in:
commit
36bc8b77fb
@ -1,7 +1,7 @@
|
|||||||
// Based on underscore.js debounce()
|
// Based on underscore.js debounce()
|
||||||
export default function debounce(func, wait) {
|
export default function debounce(func, wait) {
|
||||||
let timeout;
|
let timeout;
|
||||||
return function() {
|
return function(this: any) {
|
||||||
const context = this;
|
const context = this;
|
||||||
const args = arguments;
|
const args = arguments;
|
||||||
const later = function() {
|
const later = function() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Node.closest() polyfill
|
// Node.closest() polyfill
|
||||||
if ('Element' in window && !Element.prototype.closest) {
|
if ('Element' in window && !Element.prototype.closest) {
|
||||||
Element.prototype.closest = function(s) {
|
Element.prototype.closest = function(this: any, s) {
|
||||||
const matches = (this.document || this.ownerDocument).querySelectorAll(s);
|
const matches = (this.document || this.ownerDocument).querySelectorAll(s);
|
||||||
let el = this;
|
let el = this;
|
||||||
let i;
|
let i;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import coreModule from '../../core_module';
|
import coreModule from '../../core_module';
|
||||||
|
|
||||||
function typeaheadMatcher(item) {
|
function typeaheadMatcher(this: any, item) {
|
||||||
let str = this.query;
|
let str = this.query;
|
||||||
if (str === '') {
|
if (str === '') {
|
||||||
return true;
|
return true;
|
||||||
|
@ -33,7 +33,7 @@ export function queryPartEditorDirective($compile, templateSrv) {
|
|||||||
|
|
||||||
$scope.partActions = [];
|
$scope.partActions = [];
|
||||||
|
|
||||||
function clickFuncParam(paramIndex) {
|
function clickFuncParam(this: any, paramIndex) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
const $link = $(this);
|
const $link = $(this);
|
||||||
const $input = $link.next();
|
const $input = $link.next();
|
||||||
@ -53,7 +53,7 @@ export function queryPartEditorDirective($compile, templateSrv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function inputBlur(paramIndex) {
|
function inputBlur(this: any, paramIndex) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
const $input = $(this);
|
const $input = $(this);
|
||||||
const $link = $input.prev();
|
const $link = $input.prev();
|
||||||
@ -72,14 +72,14 @@ export function queryPartEditorDirective($compile, templateSrv) {
|
|||||||
$link.show();
|
$link.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function inputKeyPress(paramIndex, e) {
|
function inputKeyPress(this: any, paramIndex, e) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
if (e.which === 13) {
|
if (e.which === 13) {
|
||||||
inputBlur.call(this, paramIndex);
|
inputBlur.call(this, paramIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function inputKeyDown() {
|
function inputKeyDown(this: any) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
this.style.width = (3 + this.value.length) * 8 + 'px';
|
this.style.width = (3 + this.value.length) * 8 + 'px';
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ function bootstrapTagsinput() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
select.on('itemAdded', function(event) {
|
select.on('itemAdded', event => {
|
||||||
if (scope.model.indexOf(event.item) === -1) {
|
if (scope.model.indexOf(event.item) === -1) {
|
||||||
scope.model.push(event.item);
|
scope.model.push(event.item);
|
||||||
if (scope.onTagsUpdated) {
|
if (scope.onTagsUpdated) {
|
||||||
@ -79,7 +79,7 @@ function bootstrapTagsinput() {
|
|||||||
const tagElement = select
|
const tagElement = select
|
||||||
.next()
|
.next()
|
||||||
.children('span')
|
.children('span')
|
||||||
.filter(function() {
|
.filter(() => {
|
||||||
return $(this).text() === event.item;
|
return $(this).text() === event.item;
|
||||||
});
|
});
|
||||||
setColor(event.item, tagElement);
|
setColor(event.item, tagElement);
|
||||||
|
@ -9,10 +9,10 @@ $.fn.place_tt = (function() {
|
|||||||
offset: 5,
|
offset: 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
return function(x, y, opts) {
|
return function(this: any, x, y, opts) {
|
||||||
opts = $.extend(true, {}, defaults, opts);
|
opts = $.extend(true, {}, defaults, opts);
|
||||||
|
|
||||||
return this.each(function() {
|
return this.each(() => {
|
||||||
const $tooltip = $(this);
|
const $tooltip = $(this);
|
||||||
let width, height;
|
let width, height;
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ const reactComponent = function($injector) {
|
|||||||
attrs.props ? watchProps(attrs.watchDepth, scope, [attrs.props], renderMyComponent) : renderMyComponent();
|
attrs.props ? watchProps(attrs.watchDepth, scope, [attrs.props], renderMyComponent) : renderMyComponent();
|
||||||
|
|
||||||
// cleanup when scope is destroyed
|
// cleanup when scope is destroyed
|
||||||
scope.$on('$destroy', function() {
|
scope.$on('$destroy', () => {
|
||||||
if (!attrs.onScopeDestroy) {
|
if (!attrs.onScopeDestroy) {
|
||||||
ReactDOM.unmountComponentAtNode(elem[0]);
|
ReactDOM.unmountComponentAtNode(elem[0]);
|
||||||
} else {
|
} else {
|
||||||
@ -280,7 +280,7 @@ const reactDirective = function($injector) {
|
|||||||
props.length ? watchProps(attrs.watchDepth, scope, propExpressions, renderMyComponent) : renderMyComponent();
|
props.length ? watchProps(attrs.watchDepth, scope, propExpressions, renderMyComponent) : renderMyComponent();
|
||||||
|
|
||||||
// cleanup when scope is destroyed
|
// cleanup when scope is destroyed
|
||||||
scope.$on('$destroy', function() {
|
scope.$on('$destroy', () => {
|
||||||
if (!attrs.onScopeDestroy) {
|
if (!attrs.onScopeDestroy) {
|
||||||
ReactDOM.unmountComponentAtNode(elem[0]);
|
ReactDOM.unmountComponentAtNode(elem[0]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,7 +3,7 @@ import coreModule from 'app/core/core_module';
|
|||||||
import Drop from 'tether-drop';
|
import Drop from 'tether-drop';
|
||||||
|
|
||||||
/** @ngInject **/
|
/** @ngInject **/
|
||||||
function popoverSrv($compile, $rootScope, $timeout) {
|
function popoverSrv(this: any, $compile, $rootScope, $timeout) {
|
||||||
let openDrop = null;
|
let openDrop = null;
|
||||||
|
|
||||||
this.close = function() {
|
this.close = function() {
|
||||||
|
@ -2,10 +2,10 @@ import _ from 'lodash';
|
|||||||
import coreModule from '../core_module';
|
import coreModule from '../core_module';
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
export function uiSegmentSrv($sce, templateSrv) {
|
export function uiSegmentSrv(this: any, $sce, templateSrv) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
function MetricSegment(options) {
|
function MetricSegment(this: any, options) {
|
||||||
if (options === '*' || options.value === '*') {
|
if (options === '*' || options.value === '*') {
|
||||||
this.value = '*';
|
this.value = '*';
|
||||||
this.html = $sce.trustAsHtml('<i class="fa fa-asterisk"><i>');
|
this.html = $sce.trustAsHtml('<i class="fa fa-asterisk"><i>');
|
||||||
|
@ -140,15 +140,12 @@ export class DashboardMigrator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ensure query refIds
|
// ensure query refIds
|
||||||
panelUpgrades.push(function(panel) {
|
panelUpgrades.push(panel => {
|
||||||
_.each(
|
_.each(panel.targets, target => {
|
||||||
panel.targets,
|
if (!target.refId) {
|
||||||
function(target) {
|
target.refId = this.dashboard.getNextQueryLetter(panel);
|
||||||
if (!target.refId) {
|
}
|
||||||
target.refId = this.dashboard.getNextQueryLetter(panel);
|
});
|
||||||
}
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import angular from 'angular';
|
|||||||
import { ChangeTracker } from './change_tracker';
|
import { ChangeTracker } from './change_tracker';
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
export function unsavedChangesSrv($rootScope, $q, $location, $timeout, contextSrv, dashboardSrv, $window) {
|
export function unsavedChangesSrv(this: any, $rootScope, $q, $location, $timeout, contextSrv, dashboardSrv, $window) {
|
||||||
this.init = function(dashboard, scope) {
|
this.init = function(dashboard, scope) {
|
||||||
this.tracker = new ChangeTracker(dashboard, scope, 1000, $location, $window, $timeout, contextSrv, $rootScope);
|
this.tracker = new ChangeTracker(dashboard, scope, 1000, $location, $window, $timeout, contextSrv, $rootScope);
|
||||||
return this.tracker;
|
return this.tracker;
|
||||||
|
@ -3,7 +3,7 @@ import { VariableSrv } from '../variable_srv';
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import $q from 'q';
|
import $q from 'q';
|
||||||
|
|
||||||
describe('VariableSrv', function() {
|
describe('VariableSrv', function(this: any) {
|
||||||
const ctx = <any>{
|
const ctx = <any>{
|
||||||
datasourceSrv: {},
|
datasourceSrv: {},
|
||||||
timeSrv: {
|
timeSrv: {
|
||||||
|
@ -4,7 +4,7 @@ import _ from 'lodash';
|
|||||||
import { VariableSrv } from '../variable_srv';
|
import { VariableSrv } from '../variable_srv';
|
||||||
import $q from 'q';
|
import $q from 'q';
|
||||||
|
|
||||||
describe('VariableSrv init', function() {
|
describe('VariableSrv init', function(this: any) {
|
||||||
const templateSrv = {
|
const templateSrv = {
|
||||||
init: vars => {
|
init: vars => {
|
||||||
this.variables = vars;
|
this.variables = vars;
|
||||||
|
@ -203,7 +203,7 @@ export class ElasticDatasource {
|
|||||||
this.timeSrv.setTime({ from: 'now-1m', to: 'now' }, true);
|
this.timeSrv.setTime({ from: 'now-1m', to: 'now' }, true);
|
||||||
// validate that the index exist and has date field
|
// validate that the index exist and has date field
|
||||||
return this.getFields({ type: 'date' }).then(
|
return this.getFields({ type: 'date' }).then(
|
||||||
function(dateFields) {
|
dateFields => {
|
||||||
const timeField = _.find(dateFields, { text: this.timeField });
|
const timeField = _.find(dateFields, { text: this.timeField });
|
||||||
if (!timeField) {
|
if (!timeField) {
|
||||||
return {
|
return {
|
||||||
@ -212,7 +212,7 @@ export class ElasticDatasource {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
return { status: 'success', message: 'Index OK. Time field name OK.' };
|
return { status: 'success', message: 'Index OK. Time field name OK.' };
|
||||||
}.bind(this),
|
},
|
||||||
function(err) {
|
function(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
if (err.data && err.data.error) {
|
if (err.data && err.data.error) {
|
||||||
|
@ -5,7 +5,7 @@ import { ElasticDatasource } from '../datasource';
|
|||||||
|
|
||||||
import * as dateMath from 'app/core/utils/datemath';
|
import * as dateMath from 'app/core/utils/datemath';
|
||||||
|
|
||||||
describe('ElasticDatasource', function() {
|
describe('ElasticDatasource', function(this: any) {
|
||||||
const backendSrv = {
|
const backendSrv = {
|
||||||
datasourceRequest: jest.fn(),
|
datasourceRequest: jest.fn(),
|
||||||
};
|
};
|
||||||
|
@ -90,7 +90,7 @@ export function graphiteAddFunc($compile) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$(elem)
|
$(elem)
|
||||||
.on('mouseenter', 'ul.dropdown-menu li', function() {
|
.on('mouseenter', 'ul.dropdown-menu li', () => {
|
||||||
cleanUpDrop();
|
cleanUpDrop();
|
||||||
|
|
||||||
let funcDef;
|
let funcDef;
|
||||||
|
@ -4,7 +4,7 @@ import { isVersionGtOrEq, SemVersion } from 'app/core/utils/version';
|
|||||||
import gfunc from './gfunc';
|
import gfunc from './gfunc';
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv) {
|
export function GraphiteDatasource(this: any, instanceSettings, $q, backendSrv, templateSrv) {
|
||||||
this.basicAuth = instanceSettings.basicAuth;
|
this.basicAuth = instanceSettings.basicAuth;
|
||||||
this.url = instanceSettings.url;
|
this.url = instanceSettings.url;
|
||||||
this.name = instanceSettings.name;
|
this.name = instanceSettings.name;
|
||||||
|
@ -28,7 +28,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
|
|||||||
let paramCountAtLink = 0;
|
let paramCountAtLink = 0;
|
||||||
let cancelBlur = null;
|
let cancelBlur = null;
|
||||||
|
|
||||||
function clickFuncParam(paramIndex) {
|
function clickFuncParam(this: any, paramIndex) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
|
|
||||||
const $link = $(this);
|
const $link = $(this);
|
||||||
@ -108,7 +108,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this = input element
|
// this = input element
|
||||||
function inputBlur(paramIndex) {
|
function inputBlur(this: any, paramIndex) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
const inputElem = this;
|
const inputElem = this;
|
||||||
// happens long before the click event on the typeahead options
|
// happens long before the click event on the typeahead options
|
||||||
@ -118,14 +118,14 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
|
|||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
function inputKeyPress(paramIndex, e) {
|
function inputKeyPress(this: any, paramIndex, e) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
if (e.which === 13) {
|
if (e.which === 13) {
|
||||||
$(this).blur();
|
$(this).blur();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function inputKeyDown() {
|
function inputKeyDown(this: any) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
this.style.width = (3 + this.value.length) * 8 + 'px';
|
this.style.width = (3 + this.value.length) * 8 + 'px';
|
||||||
}
|
}
|
||||||
|
@ -964,26 +964,23 @@ export class FuncInstance {
|
|||||||
render(metricExp) {
|
render(metricExp) {
|
||||||
const str = this.def.name + '(';
|
const str = this.def.name + '(';
|
||||||
|
|
||||||
const parameters = _.map(
|
const parameters = _.map(this.params, (value, index) => {
|
||||||
this.params,
|
let paramType;
|
||||||
function(value, index) {
|
if (index < this.def.params.length) {
|
||||||
let paramType;
|
paramType = this.def.params[index].type;
|
||||||
if (index < this.def.params.length) {
|
} else if (_.get(_.last(this.def.params), 'multiple')) {
|
||||||
paramType = this.def.params[index].type;
|
paramType = _.get(_.last(this.def.params), 'type');
|
||||||
} else if (_.get(_.last(this.def.params), 'multiple')) {
|
}
|
||||||
paramType = _.get(_.last(this.def.params), 'type');
|
// param types that should never be quoted
|
||||||
}
|
if (_.includes(['value_or_series', 'boolean', 'int', 'float', 'node'], paramType)) {
|
||||||
// param types that should never be quoted
|
return value;
|
||||||
if (_.includes(['value_or_series', 'boolean', 'int', 'float', 'node'], paramType)) {
|
}
|
||||||
return value;
|
// param types that might be quoted
|
||||||
}
|
if (_.includes(['int_or_interval', 'node_or_tag'], paramType) && _.isFinite(+value)) {
|
||||||
// param types that might be quoted
|
return _.toString(+value);
|
||||||
if (_.includes(['int_or_interval', 'node_or_tag'], paramType) && _.isFinite(+value)) {
|
}
|
||||||
return _.toString(+value);
|
return "'" + value + "'";
|
||||||
}
|
});
|
||||||
return "'" + value + "'";
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
// don't send any blank parameters to graphite
|
// don't send any blank parameters to graphite
|
||||||
while (parameters[parameters.length - 1] === '') {
|
while (parameters[parameters.length - 1] === '') {
|
||||||
@ -1017,12 +1014,9 @@ export class FuncInstance {
|
|||||||
// handle optional parameters
|
// handle optional parameters
|
||||||
// if string contains ',' and next param is optional, split and update both
|
// if string contains ',' and next param is optional, split and update both
|
||||||
if (this._hasMultipleParamsInString(strValue, index)) {
|
if (this._hasMultipleParamsInString(strValue, index)) {
|
||||||
_.each(
|
_.each(strValue.split(','), (partVal, idx) => {
|
||||||
strValue.split(','),
|
this.updateParam(partVal.trim(), index + idx);
|
||||||
function(partVal, idx) {
|
});
|
||||||
this.updateParam(partVal.trim(), index + idx);
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -922,7 +922,7 @@ for (let i = 0; i < 128; i++) {
|
|||||||
|
|
||||||
const identifierPartTable = identifierStartTable;
|
const identifierPartTable = identifierStartTable;
|
||||||
|
|
||||||
export function Lexer(expression) {
|
export function Lexer(this: any, expression) {
|
||||||
this.input = expression;
|
this.input = expression;
|
||||||
this.char = 1;
|
this.char = 1;
|
||||||
this.from = 1;
|
this.from = 1;
|
||||||
@ -1037,7 +1037,7 @@ Lexer.prototype = {
|
|||||||
return /^[0-9a-fA-F]$/.test(str);
|
return /^[0-9a-fA-F]$/.test(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
const readUnicodeEscapeSequence = _.bind(function() {
|
const readUnicodeEscapeSequence = _.bind(function(this: any) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
index += 1;
|
index += 1;
|
||||||
|
|
||||||
@ -1065,7 +1065,7 @@ Lexer.prototype = {
|
|||||||
return null;
|
return null;
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
const getIdentifierStart = _.bind(function() {
|
const getIdentifierStart = _.bind(function(this: any) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
const chr = this.peek(index);
|
const chr = this.peek(index);
|
||||||
const code = chr.charCodeAt(0);
|
const code = chr.charCodeAt(0);
|
||||||
@ -1096,7 +1096,7 @@ Lexer.prototype = {
|
|||||||
return null;
|
return null;
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
const getIdentifierPart = _.bind(function() {
|
const getIdentifierPart = _.bind(function(this: any) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
const chr = this.peek(index);
|
const chr = this.peek(index);
|
||||||
const code = chr.charCodeAt(0);
|
const code = chr.charCodeAt(0);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Lexer } from './lexer';
|
import { Lexer } from './lexer';
|
||||||
|
|
||||||
export function Parser(expression) {
|
export function Parser(this: any, expression) {
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
this.lexer = new Lexer(expression);
|
this.lexer = new Lexer(expression);
|
||||||
this.tokens = this.lexer.tokenize();
|
this.tokens = this.lexer.tokenize();
|
||||||
|
@ -39,15 +39,12 @@ export default class OpenTsDatasource {
|
|||||||
const end = this.convertToTSDBTime(options.rangeRaw.to, true);
|
const end = this.convertToTSDBTime(options.rangeRaw.to, true);
|
||||||
const qs = [];
|
const qs = [];
|
||||||
|
|
||||||
_.each(
|
_.each(options.targets, target => {
|
||||||
options.targets,
|
if (!target.metric) {
|
||||||
function(target) {
|
return;
|
||||||
if (!target.metric) {
|
}
|
||||||
return;
|
qs.push(this.convertTargetToQuery(target, options, this.tsdbVersion));
|
||||||
}
|
});
|
||||||
qs.push(this.convertTargetToQuery(target, options, this.tsdbVersion));
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
const queries = _.compact(qs);
|
const queries = _.compact(qs);
|
||||||
|
|
||||||
@ -75,30 +72,19 @@ export default class OpenTsDatasource {
|
|||||||
return query.hide !== true;
|
return query.hide !== true;
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.performTimeSeriesQuery(queries, start, end).then(
|
return this.performTimeSeriesQuery(queries, start, end).then(response => {
|
||||||
function(response) {
|
const metricToTargetMapping = this.mapMetricsToTargets(response.data, options, this.tsdbVersion);
|
||||||
const metricToTargetMapping = this.mapMetricsToTargets(response.data, options, this.tsdbVersion);
|
const result = _.map(response.data, (metricData, index) => {
|
||||||
const result = _.map(
|
index = metricToTargetMapping[index];
|
||||||
response.data,
|
if (index === -1) {
|
||||||
function(metricData, index) {
|
index = 0;
|
||||||
index = metricToTargetMapping[index];
|
}
|
||||||
if (index === -1) {
|
this._saveTagKeys(metricData);
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
this._saveTagKeys(metricData);
|
|
||||||
|
|
||||||
return this.transformMetricData(
|
return this.transformMetricData(metricData, groupByTags, options.targets[index], options, this.tsdbResolution);
|
||||||
metricData,
|
});
|
||||||
groupByTags,
|
return { data: result };
|
||||||
options.targets[index],
|
});
|
||||||
options,
|
|
||||||
this.tsdbResolution
|
|
||||||
);
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
return { data: result };
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
annotationQuery(options) {
|
annotationQuery(options) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import { appEvents } from 'app/core/core';
|
import { appEvents } from 'app/core/core';
|
||||||
|
|
||||||
export default function GraphTooltip(elem, dashboard, scope, getSeriesFn) {
|
export default function GraphTooltip(this: any, elem, dashboard, scope, getSeriesFn) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const ctrl = scope.ctrl;
|
const ctrl = scope.ctrl;
|
||||||
const panel = ctrl.panel;
|
const panel = ctrl.panel;
|
||||||
|
@ -420,7 +420,7 @@ export class EventMarkers {
|
|||||||
event: event,
|
event: event,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mouseenter = function() {
|
const mouseenter = function(this: any) {
|
||||||
createAnnotationToolip(marker, $(this).data('event'), that._plot);
|
createAnnotationToolip(marker, $(this).data('event'), that._plot);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -541,7 +541,7 @@ export class EventMarkers {
|
|||||||
event: event,
|
event: event,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mouseenter = function() {
|
const mouseenter = function(this: any) {
|
||||||
createAnnotationToolip(region, $(this).data('event'), that._plot);
|
createAnnotationToolip(region, $(this).data('event'), that._plot);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -596,7 +596,7 @@ export class EventMarkers {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
export function init(plot) {
|
export function init(this: any, plot) {
|
||||||
/*jshint validthis:true */
|
/*jshint validthis:true */
|
||||||
const that = this;
|
const that = this;
|
||||||
const eventMarkers = new EventMarkers(plot);
|
const eventMarkers = new EventMarkers(plot);
|
||||||
|
@ -31,7 +31,7 @@ export const TeamModel = types
|
|||||||
groups: types.optional(types.map(TeamGroupModel), {}),
|
groups: types.optional(types.map(TeamGroupModel), {}),
|
||||||
})
|
})
|
||||||
.views(self => ({
|
.views(self => ({
|
||||||
get filteredMembers() {
|
get filteredMembers(this: Team) {
|
||||||
const members = this.members.values();
|
const members = this.members.values();
|
||||||
const regex = new RegExp(self.search, 'i');
|
const regex = new RegExp(self.search, 'i');
|
||||||
return members.filter(member => {
|
return members.filter(member => {
|
||||||
@ -121,7 +121,7 @@ export const TeamsStore = types
|
|||||||
search: types.optional(types.string, ''),
|
search: types.optional(types.string, ''),
|
||||||
})
|
})
|
||||||
.views(self => ({
|
.views(self => ({
|
||||||
get filteredTeams() {
|
get filteredTeams(this: any) {
|
||||||
const teams = this.map.values();
|
const teams = this.map.values();
|
||||||
const regex = new RegExp(self.search, 'i');
|
const regex = new RegExp(self.search, 'i');
|
||||||
return teams.filter(team => {
|
return teams.filter(team => {
|
||||||
|
@ -4,7 +4,7 @@ import * as dateMath from 'app/core/utils/datemath';
|
|||||||
import { angularMocks, sinon } from '../lib/common';
|
import { angularMocks, sinon } from '../lib/common';
|
||||||
import { PanelModel } from 'app/features/dashboard/panel_model';
|
import { PanelModel } from 'app/features/dashboard/panel_model';
|
||||||
|
|
||||||
export function ControllerTestContext() {
|
export function ControllerTestContext(this: any) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
this.datasource = {};
|
this.datasource = {};
|
||||||
@ -106,7 +106,7 @@ export function ControllerTestContext() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ServiceTestContext() {
|
export function ServiceTestContext(this: any) {
|
||||||
const self = this;
|
const self = this;
|
||||||
self.templateSrv = new TemplateSrvStub();
|
self.templateSrv = new TemplateSrvStub();
|
||||||
self.timeSrv = new TimeSrvStub();
|
self.timeSrv = new TimeSrvStub();
|
||||||
@ -138,11 +138,11 @@ export function ServiceTestContext() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DashboardViewStateStub() {
|
export function DashboardViewStateStub(this: any) {
|
||||||
this.registerPanel = function() {};
|
this.registerPanel = function() {};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TimeSrvStub() {
|
export function TimeSrvStub(this: any) {
|
||||||
this.init = sinon.spy();
|
this.init = sinon.spy();
|
||||||
this.time = { from: 'now-1h', to: 'now' };
|
this.time = { from: 'now-1h', to: 'now' };
|
||||||
this.timeRange = function(parse) {
|
this.timeRange = function(parse) {
|
||||||
@ -164,13 +164,13 @@ export function TimeSrvStub() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ContextSrvStub() {
|
export function ContextSrvStub(this: any) {
|
||||||
this.hasRole = function() {
|
this.hasRole = function() {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TemplateSrvStub() {
|
export function TemplateSrvStub(this: any) {
|
||||||
this.variables = [];
|
this.variables = [];
|
||||||
this.templateSettings = { interpolate: /\[\[([\s\S]+?)\]\]/g };
|
this.templateSettings = { interpolate: /\[\[([\s\S]+?)\]\]/g };
|
||||||
this.data = {};
|
this.data = {};
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
"emitDecoratorMetadata": false,
|
"emitDecoratorMetadata": false,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noImplicitThis": false,
|
"noImplicitThis": true,
|
||||||
"noImplicitUseStrict": false,
|
"noImplicitUseStrict": false,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user