mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 04:59:15 -06:00
changed var to let in last files (#13087)
This commit is contained in:
parent
ceadced6f0
commit
b494a29e02
@ -2,7 +2,7 @@ import _ from 'lodash';
|
||||
import coreModule from '../../core_module';
|
||||
|
||||
function typeaheadMatcher(item) {
|
||||
var str = this.query;
|
||||
let str = this.query;
|
||||
if (str === '') {
|
||||
return true;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ export class GrafanaCtrl {
|
||||
|
||||
$rootScope.onAppEvent = function(name, callback, localScope) {
|
||||
const unbind = $rootScope.$on(name, callback);
|
||||
var callerScope = this;
|
||||
let callerScope = this;
|
||||
if (callerScope.$id === 1 && !localScope) {
|
||||
console.log('warning rootScope onAppEvent called without localscope');
|
||||
}
|
||||
@ -75,7 +75,7 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop
|
||||
restrict: 'E',
|
||||
controller: GrafanaCtrl,
|
||||
link: (scope, elem) => {
|
||||
var sidemenuOpen;
|
||||
let sidemenuOpen;
|
||||
const body = $('body');
|
||||
|
||||
// see https://github.com/zenorocha/clipboard.js/issues/155
|
||||
@ -108,7 +108,7 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop
|
||||
|
||||
// tooltip removal fix
|
||||
// manage page classes
|
||||
var pageClass;
|
||||
let pageClass;
|
||||
scope.$on('$routeChangeSuccess', function(evt, data) {
|
||||
if (pageClass) {
|
||||
body.removeClass(pageClass);
|
||||
@ -151,10 +151,10 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop
|
||||
});
|
||||
|
||||
// handle in active view state class
|
||||
var lastActivity = new Date().getTime();
|
||||
var activeUser = true;
|
||||
let lastActivity = new Date().getTime();
|
||||
let activeUser = true;
|
||||
const inActiveTimeLimit = 60 * 1000;
|
||||
var sidemenuHidden = false;
|
||||
let sidemenuHidden = false;
|
||||
|
||||
function checkForInActiveUser() {
|
||||
if (!activeUser) {
|
||||
|
@ -52,7 +52,7 @@ export function layoutMode($rootScope) {
|
||||
scope: {},
|
||||
link: function(scope, elem) {
|
||||
const layout = store.get('grafana.list.layout.mode') || 'grid';
|
||||
var className = 'card-list-layout-' + layout;
|
||||
let className = 'card-list-layout-' + layout;
|
||||
elem.addClass(className);
|
||||
|
||||
$rootScope.onAppEvent(
|
||||
|
@ -91,7 +91,7 @@ export function queryPartEditorDirective($compile, templateSrv) {
|
||||
|
||||
const typeaheadSource = function(query, callback) {
|
||||
if (param.options) {
|
||||
var options = param.options;
|
||||
let options = param.options;
|
||||
if (param.type === 'int') {
|
||||
options = _.map(options, function(val) {
|
||||
return val.toString();
|
||||
|
@ -56,7 +56,7 @@ coreModule.filter('noXml', function() {
|
||||
/** @ngInject */
|
||||
function interpolateTemplateVars(templateSrv) {
|
||||
const filterFunc: any = function(text, scope) {
|
||||
var scopedVars;
|
||||
let scopedVars;
|
||||
if (scope.ctrl) {
|
||||
scopedVars = (scope.ctrl.panel || scope.ctrl.row).scopedVars;
|
||||
} else {
|
||||
|
@ -38,7 +38,7 @@ export class NavModelSrv {
|
||||
}
|
||||
|
||||
getNav(...args) {
|
||||
var children = this.navItems;
|
||||
let children = this.navItems;
|
||||
const nav = new NavModel();
|
||||
|
||||
for (const id of args) {
|
||||
|
@ -55,8 +55,8 @@ describe('DateMath', () => {
|
||||
});
|
||||
|
||||
describe('subtraction', () => {
|
||||
var now;
|
||||
var anchored;
|
||||
let now;
|
||||
let anchored;
|
||||
|
||||
beforeEach(() => {
|
||||
clock = sinon.useFakeTimers(unix);
|
||||
@ -83,7 +83,7 @@ describe('DateMath', () => {
|
||||
});
|
||||
|
||||
describe('rounding', () => {
|
||||
var now;
|
||||
let now;
|
||||
|
||||
beforeEach(() => {
|
||||
clock = sinon.useFakeTimers(unix);
|
||||
|
@ -26,7 +26,7 @@ describe('when sorting table desc', () => {
|
||||
});
|
||||
|
||||
describe('when sorting table asc', () => {
|
||||
var table;
|
||||
let table;
|
||||
const panel = {
|
||||
sort: { col: 1, desc: false },
|
||||
};
|
||||
@ -46,8 +46,8 @@ describe('when sorting table asc', () => {
|
||||
});
|
||||
|
||||
describe('when sorting with nulls', () => {
|
||||
var table;
|
||||
var values;
|
||||
let table;
|
||||
let values;
|
||||
|
||||
beforeEach(() => {
|
||||
table = new TableModel();
|
||||
|
@ -174,7 +174,7 @@ describe('TimeSeries', function() {
|
||||
});
|
||||
|
||||
describe('can detect if series contains ms precision', function() {
|
||||
var fakedata;
|
||||
let fakedata;
|
||||
|
||||
beforeEach(function() {
|
||||
fakedata = testData;
|
||||
@ -194,7 +194,7 @@ describe('TimeSeries', function() {
|
||||
});
|
||||
|
||||
describe('series overrides', function() {
|
||||
var series;
|
||||
let series;
|
||||
beforeEach(function() {
|
||||
series = new TimeSeries(testData);
|
||||
});
|
||||
@ -313,7 +313,7 @@ describe('TimeSeries', function() {
|
||||
});
|
||||
|
||||
describe('value formatter', function() {
|
||||
var series;
|
||||
let series;
|
||||
beforeEach(function() {
|
||||
series = new TimeSeries(testData);
|
||||
});
|
||||
|
@ -11,7 +11,7 @@ for (let i = 0; i < links.length; i++) {
|
||||
const isWebkit = !!window.navigator.userAgent.match(/AppleWebKit\/([^ ;]*)/);
|
||||
const webkitLoadCheck = function(link, callback) {
|
||||
setTimeout(function() {
|
||||
for (var i = 0; i < document.styleSheets.length; i++) {
|
||||
for (let i = 0; i < document.styleSheets.length; i++) {
|
||||
const sheet = document.styleSheets[i];
|
||||
if (sheet.href === link.href) {
|
||||
return callback();
|
||||
@ -68,7 +68,7 @@ export function fetch(load): any {
|
||||
}
|
||||
|
||||
// don't reload styles loaded in the head
|
||||
for (var i = 0; i < linkHrefs.length; i++) {
|
||||
for (let i = 0; i < linkHrefs.length; i++) {
|
||||
if (load.address === linkHrefs[i]) {
|
||||
return '';
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ export default class AdminListUsersCtrl {
|
||||
this.showPaging = this.totalPages > 1;
|
||||
this.pages = [];
|
||||
|
||||
for (var i = 1; i < this.totalPages + 1; i++) {
|
||||
for (let i = 1; i < this.totalPages + 1; i++) {
|
||||
this.pages.push({ page: i, current: i === this.page });
|
||||
}
|
||||
});
|
||||
|
@ -22,12 +22,12 @@ export function annotationTooltipDirective($sanitize, dashboardSrv, contextSrv,
|
||||
},
|
||||
link: function(scope, element) {
|
||||
const event = scope.event;
|
||||
var title = event.title;
|
||||
var text = event.text;
|
||||
let title = event.title;
|
||||
let text = event.text;
|
||||
const dashboard = dashboardSrv.getCurrent();
|
||||
|
||||
var tooltip = '<div class="graph-annotation">';
|
||||
var titleStateClass = '';
|
||||
let tooltip = '<div class="graph-annotation">';
|
||||
let titleStateClass = '';
|
||||
|
||||
if (event.alertId) {
|
||||
const stateModel = alertDef.getStateDisplayModel(event.newState);
|
||||
@ -42,7 +42,7 @@ export function annotationTooltipDirective($sanitize, dashboardSrv, contextSrv,
|
||||
title = '';
|
||||
}
|
||||
|
||||
var header = `<div class="graph-annotation__header">`;
|
||||
let header = `<div class="graph-annotation__header">`;
|
||||
if (event.login) {
|
||||
header += `<div class="graph-annotation__user" bs-tooltip="'Created by ${event.login}'"><img src="${
|
||||
event.avatarUrl
|
||||
|
@ -144,7 +144,7 @@ export class DashboardCtrl implements PanelContainer {
|
||||
removePanel(panel: PanelModel, ask: boolean) {
|
||||
// confirm deletion
|
||||
if (ask !== false) {
|
||||
var text2, confirmText;
|
||||
let text2, confirmText;
|
||||
|
||||
if (panel.alert) {
|
||||
text2 = 'Panel includes an alert rule, removing panel will also remove alert rule';
|
||||
|
@ -36,7 +36,7 @@ export class DashboardLoaderSrv {
|
||||
}
|
||||
|
||||
loadDashboard(type, slug, uid) {
|
||||
var promise;
|
||||
let promise;
|
||||
|
||||
if (type === 'script') {
|
||||
promise = this._loadScriptedDashboard(slug);
|
||||
|
@ -179,8 +179,8 @@ export class SettingsCtrl {
|
||||
}
|
||||
|
||||
deleteDashboard() {
|
||||
var confirmText = '';
|
||||
var text2 = this.dashboard.title;
|
||||
let confirmText = '';
|
||||
let text2 = this.dashboard.title;
|
||||
|
||||
const alerts = _.sumBy(this.dashboard.panels, panel => {
|
||||
return panel.alert ? 1 : 0;
|
||||
|
@ -35,7 +35,7 @@ export function ShareModalCtrl($scope, $rootScope, $location, $timeout, timeSrv,
|
||||
};
|
||||
|
||||
$scope.buildUrl = function() {
|
||||
var baseUrl = $location.absUrl();
|
||||
let baseUrl = $location.absUrl();
|
||||
const queryStart = baseUrl.indexOf('?');
|
||||
|
||||
if (queryStart !== -1) {
|
||||
@ -72,7 +72,7 @@ export function ShareModalCtrl($scope, $rootScope, $location, $timeout, timeSrv,
|
||||
|
||||
$scope.shareUrl = linkSrv.addParamsToUrl(baseUrl, params);
|
||||
|
||||
var soloUrl = baseUrl.replace(config.appSubUrl + '/dashboard/', config.appSubUrl + '/dashboard-solo/');
|
||||
let soloUrl = baseUrl.replace(config.appSubUrl + '/dashboard/', config.appSubUrl + '/dashboard-solo/');
|
||||
soloUrl = soloUrl.replace(config.appSubUrl + '/d/', config.appSubUrl + '/d-solo/');
|
||||
delete params.fullscreen;
|
||||
delete params.edit;
|
||||
|
@ -5,7 +5,7 @@ import { expect } from 'test/lib/common';
|
||||
jest.mock('app/core/services/context_srv', () => ({}));
|
||||
|
||||
describe('given dashboard with panel repeat', function() {
|
||||
var dashboard;
|
||||
let dashboard;
|
||||
|
||||
beforeEach(function() {
|
||||
const dashboardJSON = {
|
||||
@ -56,7 +56,7 @@ describe('given dashboard with panel repeat', function() {
|
||||
});
|
||||
|
||||
describe('given dashboard with panel repeat in horizontal direction', function() {
|
||||
var dashboard;
|
||||
let dashboard;
|
||||
|
||||
beforeEach(function() {
|
||||
dashboard = new DashboardModel({
|
||||
@ -188,7 +188,7 @@ describe('given dashboard with panel repeat in horizontal direction', function()
|
||||
});
|
||||
|
||||
describe('given dashboard with panel repeat in vertical direction', function() {
|
||||
var dashboard;
|
||||
let dashboard;
|
||||
|
||||
beforeEach(function() {
|
||||
dashboard = new DashboardModel({
|
||||
|
@ -18,7 +18,7 @@ export function inputDateDirective() {
|
||||
return text;
|
||||
}
|
||||
|
||||
var parsed;
|
||||
let parsed;
|
||||
if ($scope.ctrl.isUtc) {
|
||||
parsed = moment.utc(text, format);
|
||||
} else {
|
||||
|
@ -75,7 +75,7 @@ export class TimePickerCtrl {
|
||||
const range = this.timeSrv.timeRange();
|
||||
|
||||
const timespan = (range.to.valueOf() - range.from.valueOf()) / 2;
|
||||
var to, from;
|
||||
let to, from;
|
||||
if (direction === -1) {
|
||||
to = range.to.valueOf() - timespan;
|
||||
from = range.from.valueOf() - timespan;
|
||||
|
@ -21,7 +21,7 @@ function uploadDashboardDirective(timer, alertSrv, $location) {
|
||||
const files = evt.target.files; // FileList object
|
||||
const readerOnload = function() {
|
||||
return function(e) {
|
||||
var dash;
|
||||
let dash;
|
||||
try {
|
||||
dash = JSON.parse(e.target.result);
|
||||
} catch (err) {
|
||||
@ -36,7 +36,7 @@ function uploadDashboardDirective(timer, alertSrv, $location) {
|
||||
};
|
||||
};
|
||||
|
||||
for (var i = 0, f; (f = files[i]); i++) {
|
||||
for (let i = 0, f; (f = files[i]); i++) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = readerOnload();
|
||||
reader.readAsText(f);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
|
||||
export var iconMap = {
|
||||
export let iconMap = {
|
||||
'external link': 'fa-external-link',
|
||||
dashboard: 'fa-th-large',
|
||||
question: 'fa-question',
|
||||
|
@ -20,7 +20,7 @@ function dashLink($compile, $sanitize, linkSrv) {
|
||||
restrict: 'E',
|
||||
link: function(scope, elem) {
|
||||
const link = scope.link;
|
||||
var template =
|
||||
let template =
|
||||
'<div class="gf-form">' +
|
||||
'<a class="pointer gf-form-label" data-placement="bottom"' +
|
||||
(link.asDropdown ? ' ng-click="fillDropdown(link)" data-toggle="dropdown"' : '') +
|
||||
|
@ -87,7 +87,7 @@ export class QueryTroubleshooterCtrl {
|
||||
}
|
||||
|
||||
handleMocking(data) {
|
||||
var mockedData;
|
||||
let mockedData;
|
||||
try {
|
||||
mockedData = JSON.parse(this.mockedResponse);
|
||||
} catch (err) {
|
||||
|
@ -88,7 +88,7 @@ export class PlaylistEditCtrl {
|
||||
}
|
||||
|
||||
savePlaylist(playlist, playlistItems) {
|
||||
var savePromise;
|
||||
let savePromise;
|
||||
|
||||
playlist.items = playlistItems;
|
||||
|
||||
|
@ -2,7 +2,7 @@ import '../playlist_edit_ctrl';
|
||||
import { PlaylistEditCtrl } from '../playlist_edit_ctrl';
|
||||
|
||||
describe('PlaylistEditCtrl', () => {
|
||||
var ctx: any;
|
||||
let ctx: any;
|
||||
beforeEach(() => {
|
||||
const navModelSrv = {
|
||||
getNav: () => {
|
||||
|
@ -136,13 +136,13 @@ export class DatasourceSrv {
|
||||
|
||||
addDataSourceVariables(list) {
|
||||
// look for data source variables
|
||||
for (var i = 0; i < this.templateSrv.variables.length; i++) {
|
||||
for (let i = 0; i < this.templateSrv.variables.length; i++) {
|
||||
const variable = this.templateSrv.variables[i];
|
||||
if (variable.type !== 'datasource') {
|
||||
continue;
|
||||
}
|
||||
|
||||
var first = variable.current.value;
|
||||
let first = variable.current.value;
|
||||
if (first === 'default') {
|
||||
first = config.defaultDatasource;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import config from 'app/core/config';
|
||||
import { coreModule, appEvents } from 'app/core/core';
|
||||
import { store } from 'app/stores/store';
|
||||
|
||||
var datasourceTypes = [];
|
||||
let datasourceTypes = [];
|
||||
|
||||
const defaults = {
|
||||
name: '',
|
||||
@ -16,7 +16,7 @@ const defaults = {
|
||||
secureJsonData: {},
|
||||
};
|
||||
|
||||
var datasourceCreated = false;
|
||||
let datasourceCreated = false;
|
||||
|
||||
export class DataSourceEditCtrl {
|
||||
isNew: boolean;
|
||||
|
@ -69,7 +69,7 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
|
||||
};
|
||||
|
||||
const panelInfo = config.panels[scope.panel.type];
|
||||
var panelCtrlPromise = Promise.resolve(UnknownPanelCtrl);
|
||||
let panelCtrlPromise = Promise.resolve(UnknownPanelCtrl);
|
||||
if (panelInfo) {
|
||||
panelCtrlPromise = importPluginModule(panelInfo.module).then(function(panelModule) {
|
||||
return panelModule.PanelCtrl;
|
||||
|
@ -43,14 +43,14 @@ export class DatasourceVariable implements Variable {
|
||||
updateOptions() {
|
||||
const options = [];
|
||||
const sources = this.datasourceSrv.getMetricSources({ skipVariables: true });
|
||||
var regex;
|
||||
let regex;
|
||||
|
||||
if (this.regex) {
|
||||
regex = this.templateSrv.replace(this.regex, null, 'regex');
|
||||
regex = kbn.stringToJsRegex(regex);
|
||||
}
|
||||
|
||||
for (var i = 0; i < sources.length; i++) {
|
||||
for (let i = 0; i < sources.length; i++) {
|
||||
const source = sources[i];
|
||||
// must match on type
|
||||
if (source.meta.id !== this.query) {
|
||||
|
@ -91,7 +91,7 @@ export class QueryVariable implements Variable {
|
||||
if (this.useTags) {
|
||||
return this.metricFindQuery(datasource, this.tagsQuery).then(results => {
|
||||
this.tags = [];
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
this.tags.push(results[i].text);
|
||||
}
|
||||
return datasource;
|
||||
@ -142,7 +142,7 @@ export class QueryVariable implements Variable {
|
||||
}
|
||||
|
||||
metricNamesToVariableValues(metricNames) {
|
||||
var regex, options, i, matches;
|
||||
let regex, options, i, matches;
|
||||
options = [];
|
||||
|
||||
if (this.regex) {
|
||||
@ -150,9 +150,9 @@ export class QueryVariable implements Variable {
|
||||
}
|
||||
for (i = 0; i < metricNames.length; i++) {
|
||||
const item = metricNames[i];
|
||||
var text = item.text === undefined || item.text === null ? item.value : item.text;
|
||||
let text = item.text === undefined || item.text === null ? item.value : item.text;
|
||||
|
||||
var value = item.value === undefined || item.value === null ? item.text : item.value;
|
||||
let value = item.value === undefined || item.value === null ? item.text : item.value;
|
||||
|
||||
if (_.isNumber(value)) {
|
||||
value = value.toString();
|
||||
|
@ -32,7 +32,7 @@ export class TemplateSrv {
|
||||
updateTemplateData() {
|
||||
this.index = {};
|
||||
|
||||
for (var i = 0; i < this.variables.length; i++) {
|
||||
for (let i = 0; i < this.variables.length; i++) {
|
||||
const variable = this.variables[i];
|
||||
|
||||
if (!variable.current || (!variable.current.isNone && !variable.current.value)) {
|
||||
@ -48,9 +48,9 @@ export class TemplateSrv {
|
||||
}
|
||||
|
||||
getAdhocFilters(datasourceName) {
|
||||
var filters = [];
|
||||
let filters = [];
|
||||
|
||||
for (var i = 0; i < this.variables.length; i++) {
|
||||
for (let i = 0; i < this.variables.length; i++) {
|
||||
const variable = this.variables[i];
|
||||
if (variable.type !== 'adhoc') {
|
||||
continue;
|
||||
@ -171,7 +171,7 @@ export class TemplateSrv {
|
||||
return variable.allValue;
|
||||
}
|
||||
const values = [];
|
||||
for (var i = 1; i < variable.options.length; i++) {
|
||||
for (let i = 1; i < variable.options.length; i++) {
|
||||
values.push(variable.options[i].value);
|
||||
}
|
||||
return values;
|
||||
@ -182,7 +182,7 @@ export class TemplateSrv {
|
||||
return target;
|
||||
}
|
||||
|
||||
var variable, systemValue, value, fmt;
|
||||
let variable, systemValue, value, fmt;
|
||||
this.regex.lastIndex = 0;
|
||||
|
||||
return target.replace(this.regex, (match, var1, var2, fmt2, var3, fmt3) => {
|
||||
@ -227,7 +227,7 @@ export class TemplateSrv {
|
||||
return target;
|
||||
}
|
||||
|
||||
var variable;
|
||||
let variable;
|
||||
this.regex.lastIndex = 0;
|
||||
|
||||
return target.replace(this.regex, (match, var1, var2, fmt2, var3) => {
|
||||
|
@ -138,7 +138,7 @@ export class VariableSrv {
|
||||
}
|
||||
|
||||
selectOptionsForCurrentValue(variable) {
|
||||
var i, y, value, option;
|
||||
let i, y, value, option;
|
||||
const selected: any = [];
|
||||
|
||||
for (i = 0; i < variable.options.length; i++) {
|
||||
@ -167,7 +167,7 @@ export class VariableSrv {
|
||||
}
|
||||
|
||||
if (_.isArray(variable.current.value)) {
|
||||
var selected = this.selectOptionsForCurrentValue(variable);
|
||||
let selected = this.selectOptionsForCurrentValue(variable);
|
||||
|
||||
// if none pick first
|
||||
if (selected.length === 0) {
|
||||
@ -200,14 +200,14 @@ export class VariableSrv {
|
||||
}
|
||||
|
||||
setOptionFromUrl(variable, urlValue) {
|
||||
var promise = this.$q.when();
|
||||
let promise = this.$q.when();
|
||||
|
||||
if (variable.refresh) {
|
||||
promise = variable.updateOptions();
|
||||
}
|
||||
|
||||
return promise.then(() => {
|
||||
var option = _.find(variable.options, op => {
|
||||
let option = _.find(variable.options, op => {
|
||||
return op.text === urlValue || op.value === urlValue;
|
||||
});
|
||||
|
||||
@ -262,7 +262,7 @@ export class VariableSrv {
|
||||
}
|
||||
|
||||
setAdhocFilter(options) {
|
||||
var variable = _.find(this.variables, {
|
||||
let variable = _.find(this.variables, {
|
||||
type: 'adhoc',
|
||||
datasource: options.datasource,
|
||||
});
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { ElasticResponse } from '../elastic_response';
|
||||
|
||||
describe('ElasticResponse', () => {
|
||||
var targets;
|
||||
var response;
|
||||
var result;
|
||||
let targets;
|
||||
let response;
|
||||
let result;
|
||||
|
||||
describe('simple query and count', () => {
|
||||
beforeEach(() => {
|
||||
@ -48,7 +48,7 @@ describe('ElasticResponse', () => {
|
||||
});
|
||||
|
||||
describe('simple query count & avg aggregation', () => {
|
||||
var result;
|
||||
let result;
|
||||
|
||||
beforeEach(() => {
|
||||
targets = [
|
||||
@ -97,7 +97,7 @@ describe('ElasticResponse', () => {
|
||||
});
|
||||
|
||||
describe('single group by query one metric', () => {
|
||||
var result;
|
||||
let result;
|
||||
|
||||
beforeEach(() => {
|
||||
targets = [
|
||||
@ -149,7 +149,7 @@ describe('ElasticResponse', () => {
|
||||
});
|
||||
|
||||
describe('single group by query two metrics', () => {
|
||||
var result;
|
||||
let result;
|
||||
|
||||
beforeEach(() => {
|
||||
targets = [
|
||||
@ -209,7 +209,7 @@ describe('ElasticResponse', () => {
|
||||
});
|
||||
|
||||
describe('with percentiles ', () => {
|
||||
var result;
|
||||
let result;
|
||||
|
||||
beforeEach(() => {
|
||||
targets = [
|
||||
@ -257,7 +257,7 @@ describe('ElasticResponse', () => {
|
||||
});
|
||||
|
||||
describe('with extended_stats', () => {
|
||||
var result;
|
||||
let result;
|
||||
|
||||
beforeEach(() => {
|
||||
targets = [
|
||||
@ -333,7 +333,7 @@ describe('ElasticResponse', () => {
|
||||
});
|
||||
|
||||
describe('single group by with alias pattern', () => {
|
||||
var result;
|
||||
let result;
|
||||
|
||||
beforeEach(() => {
|
||||
targets = [
|
||||
@ -394,7 +394,7 @@ describe('ElasticResponse', () => {
|
||||
});
|
||||
|
||||
describe('histogram response', () => {
|
||||
var result;
|
||||
let result;
|
||||
|
||||
beforeEach(() => {
|
||||
targets = [
|
||||
@ -426,7 +426,7 @@ describe('ElasticResponse', () => {
|
||||
});
|
||||
|
||||
describe('with two filters agg', () => {
|
||||
var result;
|
||||
let result;
|
||||
|
||||
beforeEach(() => {
|
||||
targets = [
|
||||
|
@ -120,7 +120,7 @@ function checkOppositeSides(yLeft, yRight) {
|
||||
}
|
||||
|
||||
function getRate(yLeft, yRight) {
|
||||
var rateLeft, rateRight, rate;
|
||||
let rateLeft, rateRight, rate;
|
||||
if (checkTwoCross(yLeft, yRight)) {
|
||||
rateLeft = yRight.min ? yLeft.min / yRight.min : 0;
|
||||
rateRight = yRight.max ? yLeft.max / yRight.max : 0;
|
||||
|
@ -11,7 +11,7 @@ export class DataProcessor {
|
||||
}
|
||||
|
||||
// auto detect xaxis mode
|
||||
var firstItem;
|
||||
let firstItem;
|
||||
if (options.dataList && options.dataList.length > 0) {
|
||||
firstItem = options.dataList[0];
|
||||
const autoDetectMode = this.getAutoDetectXAxisMode(firstItem);
|
||||
|
@ -209,7 +209,7 @@ class GraphElement {
|
||||
|
||||
// apply y-axis min/max options
|
||||
const yaxis = plot.getYAxes();
|
||||
for (var i = 0; i < yaxis.length; i++) {
|
||||
for (let i = 0; i < yaxis.length; i++) {
|
||||
const axis = yaxis[i];
|
||||
const panelOptions = this.panel.yaxes[i];
|
||||
axis.options.max = axis.options.max !== null ? axis.options.max : panelOptions.max;
|
||||
@ -231,7 +231,7 @@ class GraphElement {
|
||||
// let's find the smallest one so that bars are correctly rendered.
|
||||
// In addition, only take series which are rendered as bars for this.
|
||||
getMinTimeStepOfSeries(data) {
|
||||
var min = Number.MAX_VALUE;
|
||||
let min = Number.MAX_VALUE;
|
||||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (!data[i].stats.timeStep) {
|
||||
@ -533,7 +533,7 @@ class GraphElement {
|
||||
}
|
||||
|
||||
addXTableAxis(options) {
|
||||
var ticks = _.map(this.data, function(series, seriesIndex) {
|
||||
let ticks = _.map(this.data, function(series, seriesIndex) {
|
||||
return _.map(series.datapoints, function(point, pointIndex) {
|
||||
const tickIndex = seriesIndex * series.datapoints.length + pointIndex;
|
||||
return [tickIndex + 1, point[1]];
|
||||
@ -611,8 +611,8 @@ class GraphElement {
|
||||
axis.max = null;
|
||||
}
|
||||
|
||||
var series, i;
|
||||
var max = axis.max,
|
||||
let series, i;
|
||||
let max = axis.max,
|
||||
min = axis.min;
|
||||
|
||||
for (i = 0; i < data.length; i++) {
|
||||
@ -681,7 +681,7 @@ class GraphElement {
|
||||
generateTicksForLogScaleYAxis(min, max, logBase) {
|
||||
let ticks = [];
|
||||
|
||||
var nextTick;
|
||||
let nextTick;
|
||||
for (nextTick = min; nextTick <= max; nextTick *= logBase) {
|
||||
ticks.push(nextTick);
|
||||
}
|
||||
|
@ -8,13 +8,13 @@ const module = angular.module('grafana.directives');
|
||||
module.directive('graphLegend', function(popoverSrv, $timeout) {
|
||||
return {
|
||||
link: function(scope, elem) {
|
||||
var firstRender = true;
|
||||
let firstRender = true;
|
||||
const ctrl = scope.ctrl;
|
||||
const panel = ctrl.panel;
|
||||
var data;
|
||||
var seriesList;
|
||||
var i;
|
||||
var legendScrollbar;
|
||||
let data;
|
||||
let seriesList;
|
||||
let i;
|
||||
let legendScrollbar;
|
||||
const legendRightDefaultWidth = 10;
|
||||
const legendElem = elem.parent();
|
||||
|
||||
@ -100,7 +100,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
|
||||
if (!panel.legend[statName]) {
|
||||
return '';
|
||||
}
|
||||
var html = '<th class="pointer" data-stat="' + statName + '">' + statName;
|
||||
let html = '<th class="pointer" data-stat="' + statName + '">' + statName;
|
||||
|
||||
if (panel.legend.sort === statName) {
|
||||
const cssClass = panel.legend.sortDesc ? 'fa fa-caret-down' : 'fa fa-caret-up';
|
||||
@ -138,9 +138,9 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
|
||||
|
||||
elem.toggleClass('graph-legend-table', panel.legend.alignAsTable === true);
|
||||
|
||||
var tableHeaderElem;
|
||||
let tableHeaderElem;
|
||||
if (panel.legend.alignAsTable) {
|
||||
var header = '<tr>';
|
||||
let header = '<tr>';
|
||||
header += '<th colspan="2" style="text-align:left"></th>';
|
||||
if (panel.legend.values) {
|
||||
header += getTableHeaderHtml('min');
|
||||
@ -184,7 +184,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var html = '<div class="graph-legend-series';
|
||||
let html = '<div class="graph-legend-series';
|
||||
|
||||
if (series.yaxis === 2) {
|
||||
html += ' graph-legend-series--right-y';
|
||||
|
@ -288,7 +288,7 @@ class GraphCtrl extends MetricsPanelCtrl {
|
||||
}
|
||||
|
||||
toggleAxis(info) {
|
||||
var override = _.find(this.panel.seriesOverrides, { alias: info.alias });
|
||||
let override = _.find(this.panel.seriesOverrides, { alias: info.alias });
|
||||
if (!override) {
|
||||
override = { alias: info.alias };
|
||||
this.panel.seriesOverrides.push(override);
|
||||
|
@ -268,7 +268,7 @@ function pushToXBuckets(buckets, point, bucketNum, seriesName) {
|
||||
}
|
||||
|
||||
function pushToYBuckets(buckets, bucketNum, value, point, bounds) {
|
||||
var count = 1;
|
||||
let count = 1;
|
||||
// Use the 3rd argument as scale/count
|
||||
if (point.length > 3) {
|
||||
count = parseInt(point[2]);
|
||||
|
@ -100,7 +100,7 @@ export class HeatmapRenderer {
|
||||
|
||||
setElementHeight() {
|
||||
try {
|
||||
var height = this.ctrl.height || this.panel.height || this.ctrl.row.height;
|
||||
let height = this.ctrl.height || this.panel.height || this.ctrl.row.height;
|
||||
if (_.isString(height)) {
|
||||
height = parseInt(height.replace('px', ''), 10);
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
}
|
||||
|
||||
const delta = value / 2;
|
||||
var dec = -Math.floor(Math.log(delta) / Math.LN10);
|
||||
let dec = -Math.floor(Math.log(delta) / Math.LN10);
|
||||
|
||||
const magn = Math.pow(10, -dec);
|
||||
const norm = delta / magn; // norm is between 1.0 and 10.0
|
||||
@ -400,7 +400,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
const $timeout = this.$timeout;
|
||||
const panel = ctrl.panel;
|
||||
const templateSrv = this.templateSrv;
|
||||
var data, linkInfo;
|
||||
let data, linkInfo;
|
||||
const $panelContainer = elem.find('.panel-container');
|
||||
elem = elem.find('.singlestat-panel');
|
||||
|
||||
@ -419,24 +419,24 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
}
|
||||
|
||||
function getBigValueHtml() {
|
||||
var body = '<div class="singlestat-panel-value-container">';
|
||||
let body = '<div class="singlestat-panel-value-container">';
|
||||
|
||||
if (panel.prefix) {
|
||||
var prefix = panel.prefix;
|
||||
let prefix = panel.prefix;
|
||||
if (panel.colorPrefix) {
|
||||
prefix = applyColoringThresholds(data.value, panel.prefix);
|
||||
}
|
||||
body += getSpan('singlestat-panel-prefix', panel.prefixFontSize, prefix);
|
||||
}
|
||||
|
||||
var value = data.valueFormatted;
|
||||
let value = data.valueFormatted;
|
||||
if (panel.colorValue) {
|
||||
value = applyColoringThresholds(data.value, value);
|
||||
}
|
||||
body += getSpan('singlestat-panel-value', panel.valueFontSize, value);
|
||||
|
||||
if (panel.postfix) {
|
||||
var postfix = panel.postfix;
|
||||
let postfix = panel.postfix;
|
||||
if (panel.colorPostfix) {
|
||||
postfix = applyColoringThresholds(data.value, panel.postfix);
|
||||
}
|
||||
@ -449,7 +449,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
}
|
||||
|
||||
function getValueText() {
|
||||
var result = panel.prefix ? templateSrv.replace(panel.prefix, data.scopedVars) : '';
|
||||
let result = panel.prefix ? templateSrv.replace(panel.prefix, data.scopedVars) : '';
|
||||
result += data.valueFormatted;
|
||||
result += panel.postfix ? templateSrv.replace(panel.postfix, data.scopedVars) : '';
|
||||
|
||||
@ -480,7 +480,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
|
||||
plotCanvas.css(plotCss);
|
||||
|
||||
const thresholds = [];
|
||||
for (var i = 0; i < data.thresholds.length; i++) {
|
||||
for (let i = 0; i < data.thresholds.length; i++) {
|
||||
thresholds.push({
|
||||
value: data.thresholds[i],
|
||||
color: data.colorMap[i],
|
||||
@ -720,7 +720,7 @@ function getColorForValue(data, value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (var i = data.thresholds.length; i > 0; i--) {
|
||||
for (let i = data.thresholds.length; i > 0; i--) {
|
||||
if (value >= data.thresholds[i - 1]) {
|
||||
return data.colorMap[i];
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ export class ColumnOptionsCtrl {
|
||||
|
||||
const styles = this.panel.styles;
|
||||
const stylesCount = styles.length;
|
||||
var indexToInsert = stylesCount;
|
||||
let indexToInsert = stylesCount;
|
||||
|
||||
// check if last is a catch all rule, then add it before that one
|
||||
if (stylesCount > 0) {
|
||||
|
@ -171,12 +171,12 @@ class TablePanelCtrl extends MetricsPanelCtrl {
|
||||
}
|
||||
|
||||
link(scope, elem, attrs, ctrl: TablePanelCtrl) {
|
||||
var data;
|
||||
let data;
|
||||
const panel = ctrl.panel;
|
||||
var pageCount = 0;
|
||||
let pageCount = 0;
|
||||
|
||||
function getTableHeight() {
|
||||
var panelHeight = ctrl.height;
|
||||
let panelHeight = ctrl.height;
|
||||
|
||||
if (pageCount > 1) {
|
||||
panelHeight -= 26;
|
||||
@ -211,7 +211,7 @@ class TablePanelCtrl extends MetricsPanelCtrl {
|
||||
|
||||
const paginationList = $('<ul></ul>');
|
||||
|
||||
for (var i = startPage; i < endPage; i++) {
|
||||
for (let i = startPage; i < endPage; i++) {
|
||||
const activeClass = i === ctrl.pageIndex ? 'active' : '';
|
||||
const pageLinkElem = $(
|
||||
'<li><a class="table-panel-page-link pointer ' + activeClass + '">' + (i + 1) + '</a></li>'
|
||||
|
@ -47,7 +47,7 @@ export class TableRenderer {
|
||||
if (!style.thresholds) {
|
||||
return null;
|
||||
}
|
||||
for (var i = style.thresholds.length; i > 0; i--) {
|
||||
for (let i = style.thresholds.length; i > 0; i--) {
|
||||
if (value >= style.thresholds[i - 1]) {
|
||||
return style.colors[i];
|
||||
}
|
||||
@ -91,7 +91,7 @@ export class TableRenderer {
|
||||
if (_.isArray(v)) {
|
||||
v = v[0];
|
||||
}
|
||||
var date = moment(v);
|
||||
let date = moment(v);
|
||||
if (this.isUtc) {
|
||||
date = date.utc();
|
||||
}
|
||||
@ -211,9 +211,9 @@ export class TableRenderer {
|
||||
value = this.formatColumnValue(columnIndex, value);
|
||||
|
||||
const column = this.table.columns[columnIndex];
|
||||
var style = '';
|
||||
let style = '';
|
||||
const cellClasses = [];
|
||||
var cellClass = '';
|
||||
let cellClass = '';
|
||||
|
||||
if (this.colorState.cell) {
|
||||
style = ' style="background-color:' + this.colorState.cell + '"';
|
||||
@ -226,7 +226,7 @@ export class TableRenderer {
|
||||
// because of the fixed table headers css only solution
|
||||
// there is an issue if header cell is wider the cell
|
||||
// this hack adds header content to cell (not visible)
|
||||
var columnHtml = '';
|
||||
let columnHtml = '';
|
||||
if (addWidthHack) {
|
||||
columnHtml = '<div class="table-panel-width-hack">' + this.table.columns[columnIndex].title + '</div>';
|
||||
}
|
||||
@ -291,15 +291,15 @@ export class TableRenderer {
|
||||
const pageSize = this.panel.pageSize || 100;
|
||||
const startPos = page * pageSize;
|
||||
const endPos = Math.min(startPos + pageSize, this.table.rows.length);
|
||||
var html = '';
|
||||
let html = '';
|
||||
const rowClasses = [];
|
||||
let rowClass = '';
|
||||
|
||||
for (var y = startPos; y < endPos; y++) {
|
||||
for (let y = startPos; y < endPos; y++) {
|
||||
const row = this.table.rows[y];
|
||||
let cellHtml = '';
|
||||
let rowStyle = '';
|
||||
for (var i = 0; i < this.table.columns.length; i++) {
|
||||
for (let i = 0; i < this.table.columns.length; i++) {
|
||||
cellHtml += this.renderCell(i, y, row[i], y === startPos);
|
||||
}
|
||||
|
||||
@ -322,10 +322,10 @@ export class TableRenderer {
|
||||
render_values() {
|
||||
const rows = [];
|
||||
|
||||
for (var y = 0; y < this.table.rows.length; y++) {
|
||||
for (let y = 0; y < this.table.rows.length; y++) {
|
||||
const row = this.table.rows[y];
|
||||
const new_row = [];
|
||||
for (var i = 0; i < this.table.columns.length; i++) {
|
||||
for (let i = 0; i < this.table.columns.length; i++) {
|
||||
new_row.push(this.formatColumnValue(i, row[i]));
|
||||
}
|
||||
rows.push(new_row);
|
||||
|
@ -13,9 +13,9 @@ transformers['timeseries_to_rows'] = {
|
||||
transform: function(data, panel, model) {
|
||||
model.columns = [{ text: 'Time', type: 'date' }, { text: 'Metric' }, { text: 'Value' }];
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const series = data[i];
|
||||
for (var y = 0; y < series.datapoints.length; y++) {
|
||||
for (let y = 0; y < series.datapoints.length; y++) {
|
||||
const dp = series.datapoints[y];
|
||||
model.rows.push([dp[1], series.target, dp[0]]);
|
||||
}
|
||||
@ -38,7 +38,7 @@ transformers['timeseries_to_columns'] = {
|
||||
const series = data[i];
|
||||
model.columns.push({ text: series.target });
|
||||
|
||||
for (var y = 0; y < series.datapoints.length; y++) {
|
||||
for (let y = 0; y < series.datapoints.length; y++) {
|
||||
const dp = series.datapoints[y];
|
||||
const timeKey = dp[1].toString();
|
||||
|
||||
@ -78,7 +78,7 @@ transformers['timeseries_aggregations'] = {
|
||||
];
|
||||
},
|
||||
transform: function(data, panel, model) {
|
||||
var i, y;
|
||||
let i, y;
|
||||
model.columns.push({ text: 'Metric' });
|
||||
|
||||
for (i = 0; i < panel.columns.length; i++) {
|
||||
@ -118,7 +118,7 @@ transformers['annotations'] = {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < data.annotations.length; i++) {
|
||||
for (let i = 0; i < data.annotations.length; i++) {
|
||||
const evt = data.annotations[i];
|
||||
model.rows.push([evt.time, evt.title, evt.text, evt.tags]);
|
||||
}
|
||||
@ -270,7 +270,7 @@ transformers['json'] = {
|
||||
}
|
||||
|
||||
const names: any = {};
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const series = data[i];
|
||||
if (series.type !== 'docs') {
|
||||
continue;
|
||||
@ -278,7 +278,7 @@ transformers['json'] = {
|
||||
|
||||
// only look at 100 docs
|
||||
const maxDocs = Math.min(series.datapoints.length, 100);
|
||||
for (var y = 0; y < maxDocs; y++) {
|
||||
for (let y = 0; y < maxDocs; y++) {
|
||||
const doc = series.datapoints[y];
|
||||
const flattened = flatten(doc, null);
|
||||
for (const propName in flattened) {
|
||||
@ -292,7 +292,7 @@ transformers['json'] = {
|
||||
});
|
||||
},
|
||||
transform: function(data, panel, model) {
|
||||
var i, y, z;
|
||||
let i, y, z;
|
||||
|
||||
for (const column of panel.columns) {
|
||||
const tableCol: any = { text: column.text };
|
||||
|
Loading…
Reference in New Issue
Block a user