mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
changed var to let in 50 files (#13075)
This commit is contained in:
committed by
Torkel Ödegaard
parent
b494a29e02
commit
552a61b6ae
@@ -35,7 +35,7 @@ export function graphiteAddFunc($compile) {
|
||||
minLength: 1,
|
||||
items: 10,
|
||||
updater: function(value) {
|
||||
var funcDef = ctrl.datasource.getFuncDef(value);
|
||||
let funcDef = ctrl.datasource.getFuncDef(value);
|
||||
if (!funcDef) {
|
||||
// try find close match
|
||||
value = value.toLowerCase();
|
||||
@@ -81,7 +81,7 @@ export function graphiteAddFunc($compile) {
|
||||
$compile(elem.contents())($scope);
|
||||
});
|
||||
|
||||
var drop;
|
||||
let drop;
|
||||
const cleanUpDrop = function() {
|
||||
if (drop) {
|
||||
drop.destroy();
|
||||
@@ -93,7 +93,7 @@ export function graphiteAddFunc($compile) {
|
||||
.on('mouseenter', 'ul.dropdown-menu li', function() {
|
||||
cleanUpDrop();
|
||||
|
||||
var funcDef;
|
||||
let funcDef;
|
||||
try {
|
||||
funcDef = ctrl.datasource.getFuncDef($('a', this).text());
|
||||
} catch (e) {
|
||||
@@ -101,7 +101,7 @@ export function graphiteAddFunc($compile) {
|
||||
}
|
||||
|
||||
if (funcDef && funcDef.description) {
|
||||
var shortDesc = funcDef.description;
|
||||
let shortDesc = funcDef.description;
|
||||
if (shortDesc.length > 500) {
|
||||
shortDesc = shortDesc.substring(0, 497) + '...';
|
||||
}
|
||||
|
||||
@@ -74,9 +74,9 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
|
||||
if (!result || !result.data) {
|
||||
return [];
|
||||
}
|
||||
for (var i = 0; i < result.data.length; i++) {
|
||||
for (let i = 0; i < result.data.length; i++) {
|
||||
const series = result.data[i];
|
||||
for (var y = 0; y < series.datapoints.length; y++) {
|
||||
for (let y = 0; y < series.datapoints.length; y++) {
|
||||
series.datapoints[y][1] *= 1000;
|
||||
}
|
||||
}
|
||||
@@ -109,10 +109,10 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
|
||||
return this.query(graphiteQuery).then(function(result) {
|
||||
const list = [];
|
||||
|
||||
for (var i = 0; i < result.data.length; i++) {
|
||||
for (let i = 0; i < result.data.length; i++) {
|
||||
const target = result.data[i];
|
||||
|
||||
for (var y = 0; y < target.datapoints.length; y++) {
|
||||
for (let y = 0; y < target.datapoints.length; y++) {
|
||||
const datapoint = target.datapoints[y];
|
||||
if (!datapoint[0]) {
|
||||
continue;
|
||||
@@ -133,10 +133,10 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
|
||||
const tags = templateSrv.replace(options.annotation.tags);
|
||||
return this.events({ range: options.rangeRaw, tags: tags }).then(results => {
|
||||
const list = [];
|
||||
for (var i = 0; i < results.data.length; i++) {
|
||||
for (let i = 0; i < results.data.length; i++) {
|
||||
const e = results.data[i];
|
||||
|
||||
var tags = e.tags;
|
||||
let tags = e.tags;
|
||||
if (_.isString(e.tags)) {
|
||||
tags = this.parseTags(e.tags);
|
||||
}
|
||||
@@ -157,7 +157,7 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
|
||||
|
||||
this.events = function(options) {
|
||||
try {
|
||||
var tags = '';
|
||||
let tags = '';
|
||||
if (options.tags) {
|
||||
tags = '&tags=' + options.tags;
|
||||
}
|
||||
@@ -493,10 +493,10 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv
|
||||
const graphite_options = ['from', 'until', 'rawData', 'format', 'maxDataPoints', 'cacheTimeout'];
|
||||
const clean_options = [],
|
||||
targets = {};
|
||||
var target, targetValue, i;
|
||||
let target, targetValue, i;
|
||||
const regex = /\#([A-Z])/g;
|
||||
const intervalFormatFixRegex = /'(\d+)m'/gi;
|
||||
var hasTargets = false;
|
||||
let hasTargets = false;
|
||||
|
||||
options['format'] = 'json';
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
|
||||
const $funcControls = $(funcControlsTemplate);
|
||||
const ctrl = $scope.ctrl;
|
||||
const func = $scope.func;
|
||||
var scheduledRelink = false;
|
||||
var paramCountAtLink = 0;
|
||||
var cancelBlur = null;
|
||||
let scheduledRelink = false;
|
||||
let paramCountAtLink = 0;
|
||||
let cancelBlur = null;
|
||||
|
||||
function clickFuncParam(paramIndex) {
|
||||
/*jshint validthis:true */
|
||||
@@ -133,7 +133,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
|
||||
function addTypeahead($input, paramIndex) {
|
||||
$input.attr('data-provide', 'typeahead');
|
||||
|
||||
var options = paramDef(paramIndex).options;
|
||||
let options = paramDef(paramIndex).options;
|
||||
if (paramDef(paramIndex).type === 'int') {
|
||||
options = _.map(options, function(val) {
|
||||
return val.toString();
|
||||
@@ -190,7 +190,7 @@ export function graphiteFuncEditor($compile, templateSrv, popoverSrv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var paramValue = templateSrv.highlightVariablesAsHtml(func.params[index]);
|
||||
let paramValue = templateSrv.highlightVariablesAsHtml(func.params[index]);
|
||||
|
||||
const last = index >= func.params.length - 1 && param.optional && !paramValue;
|
||||
if (last && param.multiple) {
|
||||
|
||||
@@ -967,7 +967,7 @@ export class FuncInstance {
|
||||
const parameters = _.map(
|
||||
this.params,
|
||||
function(value, index) {
|
||||
var paramType;
|
||||
let paramType;
|
||||
if (index < this.def.params.length) {
|
||||
paramType = this.def.params[index].type;
|
||||
} else if (_.get(_.last(this.def.params), 'multiple')) {
|
||||
@@ -1041,7 +1041,7 @@ export class FuncInstance {
|
||||
return;
|
||||
}
|
||||
|
||||
var text = this.def.name + '(';
|
||||
let text = this.def.name + '(';
|
||||
text += this.params.join(', ');
|
||||
text += ')';
|
||||
this.text = text;
|
||||
@@ -1086,7 +1086,7 @@ function parseFuncDefs(rawDefs) {
|
||||
return;
|
||||
}
|
||||
|
||||
var description = funcDef.description;
|
||||
let description = funcDef.description;
|
||||
if (description) {
|
||||
// tidy up some pydoc syntax that rst2html can't handle
|
||||
description = description
|
||||
|
||||
@@ -179,7 +179,7 @@ export default class GraphiteQuery {
|
||||
delete targetsByRefId[target.refId];
|
||||
|
||||
const nestedSeriesRefRegex = /\#([A-Z])/g;
|
||||
var targetWithNestedQueries = target.target;
|
||||
let targetWithNestedQueries = target.target;
|
||||
|
||||
// Use ref count to track circular references
|
||||
function countTargetRefs(targetsByRefId, refId) {
|
||||
|
||||
@@ -900,7 +900,7 @@ const unicodeLetterTable = [
|
||||
|
||||
const identifierStartTable = [];
|
||||
|
||||
for (var i = 0; i < 128; i++) {
|
||||
for (let i = 0; i < 128; i++) {
|
||||
identifierStartTable[i] =
|
||||
(i >= 48 && i <= 57) || // 0-9
|
||||
i === 36 || // $
|
||||
@@ -941,7 +941,7 @@ Lexer.prototype = {
|
||||
|
||||
tokenize: function() {
|
||||
const list = [];
|
||||
var token;
|
||||
let token;
|
||||
while ((token = this.next())) {
|
||||
list.push(token);
|
||||
}
|
||||
@@ -964,7 +964,7 @@ Lexer.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
var match = this.scanStringLiteral();
|
||||
let match = this.scanStringLiteral();
|
||||
if (match) {
|
||||
return match;
|
||||
}
|
||||
@@ -1007,9 +1007,9 @@ Lexer.prototype = {
|
||||
* (true/false) and NullLiteral (null).
|
||||
*/
|
||||
scanIdentifier: function() {
|
||||
var id = '';
|
||||
var index = 0;
|
||||
var type, char;
|
||||
let id = '';
|
||||
let index = 0;
|
||||
let type, char;
|
||||
|
||||
// Detects any character in the Unicode categories "Uppercase
|
||||
// letter (Lu)", "Lowercase letter (Ll)", "Titlecase letter
|
||||
@@ -1020,7 +1020,7 @@ Lexer.prototype = {
|
||||
// Google's Traceur.
|
||||
|
||||
function isUnicodeLetter(code) {
|
||||
for (var i = 0; i < unicodeLetterTable.length; ) {
|
||||
for (let i = 0; i < unicodeLetterTable.length; ) {
|
||||
if (code < unicodeLetterTable[i++]) {
|
||||
return false;
|
||||
}
|
||||
@@ -1049,7 +1049,7 @@ Lexer.prototype = {
|
||||
const ch2 = this.peek(index + 2);
|
||||
const ch3 = this.peek(index + 3);
|
||||
const ch4 = this.peek(index + 4);
|
||||
var code;
|
||||
let code;
|
||||
|
||||
if (isHexDigit(ch1) && isHexDigit(ch2) && isHexDigit(ch3) && isHexDigit(ch4)) {
|
||||
code = parseInt(ch1 + ch2 + ch3 + ch4, 16);
|
||||
@@ -1168,11 +1168,11 @@ Lexer.prototype = {
|
||||
* scanNumericLiteral function in the Esprima parser's source code.
|
||||
*/
|
||||
scanNumericLiteral: function(): any {
|
||||
var index = 0;
|
||||
var value = '';
|
||||
let index = 0;
|
||||
let value = '';
|
||||
const length = this.input.length;
|
||||
var char = this.peek(index);
|
||||
var bad;
|
||||
let char = this.peek(index);
|
||||
let bad;
|
||||
|
||||
function isDecimalDigit(str) {
|
||||
return /^[0-9]$/.test(str);
|
||||
@@ -1418,7 +1418,7 @@ Lexer.prototype = {
|
||||
return null;
|
||||
}
|
||||
|
||||
var value = '';
|
||||
let value = '';
|
||||
|
||||
this.skip();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ Parser.prototype = {
|
||||
|
||||
curlyBraceSegment: function() {
|
||||
if (this.match('identifier', '{') || this.match('{')) {
|
||||
var curlySegment = '';
|
||||
let curlySegment = '';
|
||||
|
||||
while (!this.match('') && !this.match('}')) {
|
||||
curlySegment += this.consumeToken().value;
|
||||
|
||||
@@ -106,7 +106,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
|
||||
}
|
||||
|
||||
getAltSegments(index, prefix) {
|
||||
var query = prefix && prefix.length > 0 ? '*' + prefix + '*' : '*';
|
||||
let query = prefix && prefix.length > 0 ? '*' + prefix + '*' : '*';
|
||||
if (index > 0) {
|
||||
query = this.queryModel.getSegmentPathUpTo(index) + '.' + query;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ export class GraphiteQueryCtrl extends QueryCtrl {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < this.segments.length; i++) {
|
||||
for (let i = 0; i < this.segments.length; i++) {
|
||||
if (this.segments[i].value.indexOf('*') >= 0) {
|
||||
func.params[0] = i;
|
||||
func.added = false;
|
||||
|
||||
Reference in New Issue
Block a user