noImplicitAny: Datasource files, under 2500 (#17959)

* noImplicitAny on Graphite

* More noImplicitAny
This commit is contained in:
Tobias Skarhed
2019-07-05 16:46:46 +02:00
committed by Torkel Ödegaard
parent b67905a963
commit 9b468caea4
12 changed files with 175 additions and 136 deletions

View File

@@ -1,9 +1,10 @@
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
import { TemplateSrv } from 'app/features/templating/template_srv';
/** @ngInject */
export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
export function graphiteFuncEditor($compile: any, templateSrv: TemplateSrv) {
const funcSpanTemplate = `
<function-editor
func="func"
@@ -17,27 +18,27 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
return {
restrict: 'A',
link: function postLink($scope, elem) {
link: function postLink($scope: any, elem: JQuery) {
const $funcLink = $(funcSpanTemplate);
const ctrl = $scope.ctrl;
const func = $scope.func;
let scheduledRelink = false;
let paramCountAtLink = 0;
let cancelBlur = null;
let cancelBlur: any = null;
ctrl.handleRemoveFunction = func => {
ctrl.handleRemoveFunction = (func: any) => {
ctrl.removeFunction(func);
};
ctrl.handleMoveLeft = func => {
ctrl.handleMoveLeft = (func: any) => {
ctrl.moveFunction(func, -1);
};
ctrl.handleMoveRight = func => {
ctrl.handleMoveRight = (func: any) => {
ctrl.moveFunction(func, 1);
};
function clickFuncParam(this: any, paramIndex) {
function clickFuncParam(this: any, paramIndex: any) {
/*jshint validthis:true */
const $link = $(this);
@@ -73,7 +74,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
}
}
function paramDef(index) {
function paramDef(index: number) {
if (index < func.def.params.length) {
return func.def.params[index];
}
@@ -83,7 +84,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
return {};
}
function switchToLink(inputElem, paramIndex) {
function switchToLink(inputElem: HTMLElement, paramIndex: any) {
/*jshint validthis:true */
const $input = $(inputElem);
@@ -117,7 +118,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
}
// this = input element
function inputBlur(this: any, paramIndex) {
function inputBlur(this: any, paramIndex: any) {
/*jshint validthis:true */
const inputElem = this;
// happens long before the click event on the typeahead options
@@ -127,7 +128,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
}, 200);
}
function inputKeyPress(this: any, paramIndex, e) {
function inputKeyPress(this: any, paramIndex: any, e: any) {
/*jshint validthis:true */
if (e.which === 13) {
$(this).blur();
@@ -139,7 +140,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
this.style.width = (3 + this.value.length) * 8 + 'px';
}
function addTypeahead($input, paramIndex) {
function addTypeahead($input: any, paramIndex: any) {
$input.attr('data-provide', 'typeahead');
let options = paramDef(paramIndex).options;
@@ -153,7 +154,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
source: options,
minLength: 0,
items: 20,
updater: value => {
updater: (value: any) => {
$input.val(value);
switchToLink($input[0], paramIndex);
return value;