Browse Source

changed var to let in last files (#13087)

Patrick O'Carroll 7 years ago
parent
commit
b494a29e02
45 changed files with 131 additions and 131 deletions
  1. 1 1
      public/app/core/components/form_dropdown/form_dropdown.ts
  2. 6 6
      public/app/core/components/grafana_app.ts
  3. 1 1
      public/app/core/components/layout_selector/layout_selector.ts
  4. 1 1
      public/app/core/components/query_part/query_part_editor.ts
  5. 1 1
      public/app/core/filters/filters.ts
  6. 1 1
      public/app/core/nav_model_srv.ts
  7. 3 3
      public/app/core/specs/datemath.test.ts
  8. 3 3
      public/app/core/specs/table_model.test.ts
  9. 3 3
      public/app/core/specs/time_series.test.ts
  10. 2 2
      public/app/core/utils/css_loader.ts
  11. 1 1
      public/app/features/admin/admin_list_users_ctrl.ts
  12. 5 5
      public/app/features/annotations/annotation_tooltip.ts
  13. 1 1
      public/app/features/dashboard/dashboard_ctrl.ts
  14. 1 1
      public/app/features/dashboard/dashboard_loader_srv.ts
  15. 2 2
      public/app/features/dashboard/settings/settings.ts
  16. 2 2
      public/app/features/dashboard/shareModalCtrl.ts
  17. 3 3
      public/app/features/dashboard/specs/repeat.test.ts
  18. 1 1
      public/app/features/dashboard/timepicker/input_date.ts
  19. 1 1
      public/app/features/dashboard/timepicker/timepicker.ts
  20. 2 2
      public/app/features/dashboard/upload.ts
  21. 1 1
      public/app/features/dashlinks/editor.ts
  22. 1 1
      public/app/features/dashlinks/module.ts
  23. 1 1
      public/app/features/panel/query_troubleshooter.ts
  24. 1 1
      public/app/features/playlist/playlist_edit_ctrl.ts
  25. 1 1
      public/app/features/playlist/specs/playlist_edit_ctrl.test.ts
  26. 2 2
      public/app/features/plugins/datasource_srv.ts
  27. 2 2
      public/app/features/plugins/ds_edit_ctrl.ts
  28. 1 1
      public/app/features/plugins/plugin_component.ts
  29. 2 2
      public/app/features/templating/datasource_variable.ts
  30. 4 4
      public/app/features/templating/query_variable.ts
  31. 6 6
      public/app/features/templating/template_srv.ts
  32. 5 5
      public/app/features/templating/variable_srv.ts
  33. 11 11
      public/app/plugins/datasource/elasticsearch/specs/elastic_response.test.ts
  34. 1 1
      public/app/plugins/panel/graph/align_yaxes.ts
  35. 1 1
      public/app/plugins/panel/graph/data_processor.ts
  36. 6 6
      public/app/plugins/panel/graph/graph.ts
  37. 9 9
      public/app/plugins/panel/graph/legend.ts
  38. 1 1
      public/app/plugins/panel/graph/module.ts
  39. 1 1
      public/app/plugins/panel/heatmap/heatmap_data_converter.ts
  40. 1 1
      public/app/plugins/panel/heatmap/rendering.ts
  41. 9 9
      public/app/plugins/panel/singlestat/module.ts
  42. 1 1
      public/app/plugins/panel/table/column_options.ts
  43. 4 4
      public/app/plugins/panel/table/module.ts
  44. 10 10
      public/app/plugins/panel/table/renderer.ts
  45. 8 8
      public/app/plugins/panel/table/transformers.ts

+ 1 - 1
public/app/core/components/form_dropdown/form_dropdown.ts

@@ -2,7 +2,7 @@ import _ from 'lodash';
 import coreModule from '../../core_module';
 import coreModule from '../../core_module';
 
 
 function typeaheadMatcher(item) {
 function typeaheadMatcher(item) {
-  var str = this.query;
+  let str = this.query;
   if (str === '') {
   if (str === '') {
     return true;
     return true;
   }
   }

+ 6 - 6
public/app/core/components/grafana_app.ts

@@ -50,7 +50,7 @@ export class GrafanaCtrl {
 
 
     $rootScope.onAppEvent = function(name, callback, localScope) {
     $rootScope.onAppEvent = function(name, callback, localScope) {
       const unbind = $rootScope.$on(name, callback);
       const unbind = $rootScope.$on(name, callback);
-      var callerScope = this;
+      let callerScope = this;
       if (callerScope.$id === 1 && !localScope) {
       if (callerScope.$id === 1 && !localScope) {
         console.log('warning rootScope onAppEvent called without localscope');
         console.log('warning rootScope onAppEvent called without localscope');
       }
       }
@@ -75,7 +75,7 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop
     restrict: 'E',
     restrict: 'E',
     controller: GrafanaCtrl,
     controller: GrafanaCtrl,
     link: (scope, elem) => {
     link: (scope, elem) => {
-      var sidemenuOpen;
+      let sidemenuOpen;
       const body = $('body');
       const body = $('body');
 
 
       // see https://github.com/zenorocha/clipboard.js/issues/155
       // see https://github.com/zenorocha/clipboard.js/issues/155
@@ -108,7 +108,7 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop
 
 
       // tooltip removal fix
       // tooltip removal fix
       // manage page classes
       // manage page classes
-      var pageClass;
+      let pageClass;
       scope.$on('$routeChangeSuccess', function(evt, data) {
       scope.$on('$routeChangeSuccess', function(evt, data) {
         if (pageClass) {
         if (pageClass) {
           body.removeClass(pageClass);
           body.removeClass(pageClass);
@@ -151,10 +151,10 @@ export function grafanaAppDirective(playlistSrv, contextSrv, $timeout, $rootScop
       });
       });
 
 
       // handle in active view state class
       // 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;
       const inActiveTimeLimit = 60 * 1000;
-      var sidemenuHidden = false;
+      let sidemenuHidden = false;
 
 
       function checkForInActiveUser() {
       function checkForInActiveUser() {
         if (!activeUser) {
         if (!activeUser) {

+ 1 - 1
public/app/core/components/layout_selector/layout_selector.ts

@@ -52,7 +52,7 @@ export function layoutMode($rootScope) {
     scope: {},
     scope: {},
     link: function(scope, elem) {
     link: function(scope, elem) {
       const layout = store.get('grafana.list.layout.mode') || 'grid';
       const layout = store.get('grafana.list.layout.mode') || 'grid';
-      var className = 'card-list-layout-' + layout;
+      let className = 'card-list-layout-' + layout;
       elem.addClass(className);
       elem.addClass(className);
 
 
       $rootScope.onAppEvent(
       $rootScope.onAppEvent(

+ 1 - 1
public/app/core/components/query_part/query_part_editor.ts

@@ -91,7 +91,7 @@ export function queryPartEditorDirective($compile, templateSrv) {
 
 
         const typeaheadSource = function(query, callback) {
         const typeaheadSource = function(query, callback) {
           if (param.options) {
           if (param.options) {
-            var options = param.options;
+            let options = param.options;
             if (param.type === 'int') {
             if (param.type === 'int') {
               options = _.map(options, function(val) {
               options = _.map(options, function(val) {
                 return val.toString();
                 return val.toString();

+ 1 - 1
public/app/core/filters/filters.ts

@@ -56,7 +56,7 @@ coreModule.filter('noXml', function() {
 /** @ngInject */
 /** @ngInject */
 function interpolateTemplateVars(templateSrv) {
 function interpolateTemplateVars(templateSrv) {
   const filterFunc: any = function(text, scope) {
   const filterFunc: any = function(text, scope) {
-    var scopedVars;
+    let scopedVars;
     if (scope.ctrl) {
     if (scope.ctrl) {
       scopedVars = (scope.ctrl.panel || scope.ctrl.row).scopedVars;
       scopedVars = (scope.ctrl.panel || scope.ctrl.row).scopedVars;
     } else {
     } else {

+ 1 - 1
public/app/core/nav_model_srv.ts

@@ -38,7 +38,7 @@ export class NavModelSrv {
   }
   }
 
 
   getNav(...args) {
   getNav(...args) {
-    var children = this.navItems;
+    let children = this.navItems;
     const nav = new NavModel();
     const nav = new NavModel();
 
 
     for (const id of args) {
     for (const id of args) {

+ 3 - 3
public/app/core/specs/datemath.test.ts

@@ -55,8 +55,8 @@ describe('DateMath', () => {
   });
   });
 
 
   describe('subtraction', () => {
   describe('subtraction', () => {
-    var now;
-    var anchored;
+    let now;
+    let anchored;
 
 
     beforeEach(() => {
     beforeEach(() => {
       clock = sinon.useFakeTimers(unix);
       clock = sinon.useFakeTimers(unix);
@@ -83,7 +83,7 @@ describe('DateMath', () => {
   });
   });
 
 
   describe('rounding', () => {
   describe('rounding', () => {
-    var now;
+    let now;
 
 
     beforeEach(() => {
     beforeEach(() => {
       clock = sinon.useFakeTimers(unix);
       clock = sinon.useFakeTimers(unix);

+ 3 - 3
public/app/core/specs/table_model.test.ts

@@ -26,7 +26,7 @@ describe('when sorting table desc', () => {
 });
 });
 
 
 describe('when sorting table asc', () => {
 describe('when sorting table asc', () => {
-  var table;
+  let table;
   const panel = {
   const panel = {
     sort: { col: 1, desc: false },
     sort: { col: 1, desc: false },
   };
   };
@@ -46,8 +46,8 @@ describe('when sorting table asc', () => {
 });
 });
 
 
 describe('when sorting with nulls', () => {
 describe('when sorting with nulls', () => {
-  var table;
-  var values;
+  let table;
+  let values;
 
 
   beforeEach(() => {
   beforeEach(() => {
     table = new TableModel();
     table = new TableModel();

+ 3 - 3
public/app/core/specs/time_series.test.ts

@@ -174,7 +174,7 @@ describe('TimeSeries', function() {
   });
   });
 
 
   describe('can detect if series contains ms precision', function() {
   describe('can detect if series contains ms precision', function() {
-    var fakedata;
+    let fakedata;
 
 
     beforeEach(function() {
     beforeEach(function() {
       fakedata = testData;
       fakedata = testData;
@@ -194,7 +194,7 @@ describe('TimeSeries', function() {
   });
   });
 
 
   describe('series overrides', function() {
   describe('series overrides', function() {
-    var series;
+    let series;
     beforeEach(function() {
     beforeEach(function() {
       series = new TimeSeries(testData);
       series = new TimeSeries(testData);
     });
     });
@@ -313,7 +313,7 @@ describe('TimeSeries', function() {
   });
   });
 
 
   describe('value formatter', function() {
   describe('value formatter', function() {
-    var series;
+    let series;
     beforeEach(function() {
     beforeEach(function() {
       series = new TimeSeries(testData);
       series = new TimeSeries(testData);
     });
     });

+ 2 - 2
public/app/core/utils/css_loader.ts

@@ -11,7 +11,7 @@ for (let i = 0; i < links.length; i++) {
 const isWebkit = !!window.navigator.userAgent.match(/AppleWebKit\/([^ ;]*)/);
 const isWebkit = !!window.navigator.userAgent.match(/AppleWebKit\/([^ ;]*)/);
 const webkitLoadCheck = function(link, callback) {
 const webkitLoadCheck = function(link, callback) {
   setTimeout(function() {
   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];
       const sheet = document.styleSheets[i];
       if (sheet.href === link.href) {
       if (sheet.href === link.href) {
         return callback();
         return callback();
@@ -68,7 +68,7 @@ export function fetch(load): any {
   }
   }
 
 
   // don't reload styles loaded in the head
   // 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]) {
     if (load.address === linkHrefs[i]) {
       return '';
       return '';
     }
     }

+ 1 - 1
public/app/features/admin/admin_list_users_ctrl.ts

@@ -26,7 +26,7 @@ export default class AdminListUsersCtrl {
         this.showPaging = this.totalPages > 1;
         this.showPaging = this.totalPages > 1;
         this.pages = [];
         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 });
           this.pages.push({ page: i, current: i === this.page });
         }
         }
       });
       });

+ 5 - 5
public/app/features/annotations/annotation_tooltip.ts

@@ -22,12 +22,12 @@ export function annotationTooltipDirective($sanitize, dashboardSrv, contextSrv,
     },
     },
     link: function(scope, element) {
     link: function(scope, element) {
       const event = scope.event;
       const event = scope.event;
-      var title = event.title;
-      var text = event.text;
+      let title = event.title;
+      let text = event.text;
       const dashboard = dashboardSrv.getCurrent();
       const dashboard = dashboardSrv.getCurrent();
 
 
-      var tooltip = '<div class="graph-annotation">';
-      var titleStateClass = '';
+      let tooltip = '<div class="graph-annotation">';
+      let titleStateClass = '';
 
 
       if (event.alertId) {
       if (event.alertId) {
         const stateModel = alertDef.getStateDisplayModel(event.newState);
         const stateModel = alertDef.getStateDisplayModel(event.newState);
@@ -42,7 +42,7 @@ export function annotationTooltipDirective($sanitize, dashboardSrv, contextSrv,
         title = '';
         title = '';
       }
       }
 
 
-      var header = `<div class="graph-annotation__header">`;
+      let header = `<div class="graph-annotation__header">`;
       if (event.login) {
       if (event.login) {
         header += `<div class="graph-annotation__user" bs-tooltip="'Created by ${event.login}'"><img src="${
         header += `<div class="graph-annotation__user" bs-tooltip="'Created by ${event.login}'"><img src="${
           event.avatarUrl
           event.avatarUrl

+ 1 - 1
public/app/features/dashboard/dashboard_ctrl.ts

@@ -144,7 +144,7 @@ export class DashboardCtrl implements PanelContainer {
   removePanel(panel: PanelModel, ask: boolean) {
   removePanel(panel: PanelModel, ask: boolean) {
     // confirm deletion
     // confirm deletion
     if (ask !== false) {
     if (ask !== false) {
-      var text2, confirmText;
+      let text2, confirmText;
 
 
       if (panel.alert) {
       if (panel.alert) {
         text2 = 'Panel includes an alert rule, removing panel will also remove alert rule';
         text2 = 'Panel includes an alert rule, removing panel will also remove alert rule';

+ 1 - 1
public/app/features/dashboard/dashboard_loader_srv.ts

@@ -36,7 +36,7 @@ export class DashboardLoaderSrv {
   }
   }
 
 
   loadDashboard(type, slug, uid) {
   loadDashboard(type, slug, uid) {
-    var promise;
+    let promise;
 
 
     if (type === 'script') {
     if (type === 'script') {
       promise = this._loadScriptedDashboard(slug);
       promise = this._loadScriptedDashboard(slug);

+ 2 - 2
public/app/features/dashboard/settings/settings.ts

@@ -179,8 +179,8 @@ export class SettingsCtrl {
   }
   }
 
 
   deleteDashboard() {
   deleteDashboard() {
-    var confirmText = '';
-    var text2 = this.dashboard.title;
+    let confirmText = '';
+    let text2 = this.dashboard.title;
 
 
     const alerts = _.sumBy(this.dashboard.panels, panel => {
     const alerts = _.sumBy(this.dashboard.panels, panel => {
       return panel.alert ? 1 : 0;
       return panel.alert ? 1 : 0;

+ 2 - 2
public/app/features/dashboard/shareModalCtrl.ts

@@ -35,7 +35,7 @@ export function ShareModalCtrl($scope, $rootScope, $location, $timeout, timeSrv,
   };
   };
 
 
   $scope.buildUrl = function() {
   $scope.buildUrl = function() {
-    var baseUrl = $location.absUrl();
+    let baseUrl = $location.absUrl();
     const queryStart = baseUrl.indexOf('?');
     const queryStart = baseUrl.indexOf('?');
 
 
     if (queryStart !== -1) {
     if (queryStart !== -1) {
@@ -72,7 +72,7 @@ export function ShareModalCtrl($scope, $rootScope, $location, $timeout, timeSrv,
 
 
     $scope.shareUrl = linkSrv.addParamsToUrl(baseUrl, params);
     $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/');
     soloUrl = soloUrl.replace(config.appSubUrl + '/d/', config.appSubUrl + '/d-solo/');
     delete params.fullscreen;
     delete params.fullscreen;
     delete params.edit;
     delete params.edit;

+ 3 - 3
public/app/features/dashboard/specs/repeat.test.ts

@@ -5,7 +5,7 @@ import { expect } from 'test/lib/common';
 jest.mock('app/core/services/context_srv', () => ({}));
 jest.mock('app/core/services/context_srv', () => ({}));
 
 
 describe('given dashboard with panel repeat', function() {
 describe('given dashboard with panel repeat', function() {
-  var dashboard;
+  let dashboard;
 
 
   beforeEach(function() {
   beforeEach(function() {
     const dashboardJSON = {
     const dashboardJSON = {
@@ -56,7 +56,7 @@ describe('given dashboard with panel repeat', function() {
 });
 });
 
 
 describe('given dashboard with panel repeat in horizontal direction', function() {
 describe('given dashboard with panel repeat in horizontal direction', function() {
-  var dashboard;
+  let dashboard;
 
 
   beforeEach(function() {
   beforeEach(function() {
     dashboard = new DashboardModel({
     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() {
 describe('given dashboard with panel repeat in vertical direction', function() {
-  var dashboard;
+  let dashboard;
 
 
   beforeEach(function() {
   beforeEach(function() {
     dashboard = new DashboardModel({
     dashboard = new DashboardModel({

+ 1 - 1
public/app/features/dashboard/timepicker/input_date.ts

@@ -18,7 +18,7 @@ export function inputDateDirective() {
           return text;
           return text;
         }
         }
 
 
-        var parsed;
+        let parsed;
         if ($scope.ctrl.isUtc) {
         if ($scope.ctrl.isUtc) {
           parsed = moment.utc(text, format);
           parsed = moment.utc(text, format);
         } else {
         } else {

+ 1 - 1
public/app/features/dashboard/timepicker/timepicker.ts

@@ -75,7 +75,7 @@ export class TimePickerCtrl {
     const range = this.timeSrv.timeRange();
     const range = this.timeSrv.timeRange();
 
 
     const timespan = (range.to.valueOf() - range.from.valueOf()) / 2;
     const timespan = (range.to.valueOf() - range.from.valueOf()) / 2;
-    var to, from;
+    let to, from;
     if (direction === -1) {
     if (direction === -1) {
       to = range.to.valueOf() - timespan;
       to = range.to.valueOf() - timespan;
       from = range.from.valueOf() - timespan;
       from = range.from.valueOf() - timespan;

+ 2 - 2
public/app/features/dashboard/upload.ts

@@ -21,7 +21,7 @@ function uploadDashboardDirective(timer, alertSrv, $location) {
         const files = evt.target.files; // FileList object
         const files = evt.target.files; // FileList object
         const readerOnload = function() {
         const readerOnload = function() {
           return function(e) {
           return function(e) {
-            var dash;
+            let dash;
             try {
             try {
               dash = JSON.parse(e.target.result);
               dash = JSON.parse(e.target.result);
             } catch (err) {
             } 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();
           const reader = new FileReader();
           reader.onload = readerOnload();
           reader.onload = readerOnload();
           reader.readAsText(f);
           reader.readAsText(f);

+ 1 - 1
public/app/features/dashlinks/editor.ts

@@ -1,7 +1,7 @@
 import angular from 'angular';
 import angular from 'angular';
 import _ from 'lodash';
 import _ from 'lodash';
 
 
-export var iconMap = {
+export let iconMap = {
   'external link': 'fa-external-link',
   'external link': 'fa-external-link',
   dashboard: 'fa-th-large',
   dashboard: 'fa-th-large',
   question: 'fa-question',
   question: 'fa-question',

+ 1 - 1
public/app/features/dashlinks/module.ts

@@ -20,7 +20,7 @@ function dashLink($compile, $sanitize, linkSrv) {
     restrict: 'E',
     restrict: 'E',
     link: function(scope, elem) {
     link: function(scope, elem) {
       const link = scope.link;
       const link = scope.link;
-      var template =
+      let template =
         '<div class="gf-form">' +
         '<div class="gf-form">' +
         '<a class="pointer gf-form-label" data-placement="bottom"' +
         '<a class="pointer gf-form-label" data-placement="bottom"' +
         (link.asDropdown ? ' ng-click="fillDropdown(link)" data-toggle="dropdown"' : '') +
         (link.asDropdown ? ' ng-click="fillDropdown(link)" data-toggle="dropdown"' : '') +

+ 1 - 1
public/app/features/panel/query_troubleshooter.ts

@@ -87,7 +87,7 @@ export class QueryTroubleshooterCtrl {
   }
   }
 
 
   handleMocking(data) {
   handleMocking(data) {
-    var mockedData;
+    let mockedData;
     try {
     try {
       mockedData = JSON.parse(this.mockedResponse);
       mockedData = JSON.parse(this.mockedResponse);
     } catch (err) {
     } catch (err) {

+ 1 - 1
public/app/features/playlist/playlist_edit_ctrl.ts

@@ -88,7 +88,7 @@ export class PlaylistEditCtrl {
   }
   }
 
 
   savePlaylist(playlist, playlistItems) {
   savePlaylist(playlist, playlistItems) {
-    var savePromise;
+    let savePromise;
 
 
     playlist.items = playlistItems;
     playlist.items = playlistItems;
 
 

+ 1 - 1
public/app/features/playlist/specs/playlist_edit_ctrl.test.ts

@@ -2,7 +2,7 @@ import '../playlist_edit_ctrl';
 import { PlaylistEditCtrl } from '../playlist_edit_ctrl';
 import { PlaylistEditCtrl } from '../playlist_edit_ctrl';
 
 
 describe('PlaylistEditCtrl', () => {
 describe('PlaylistEditCtrl', () => {
-  var ctx: any;
+  let ctx: any;
   beforeEach(() => {
   beforeEach(() => {
     const navModelSrv = {
     const navModelSrv = {
       getNav: () => {
       getNav: () => {

+ 2 - 2
public/app/features/plugins/datasource_srv.ts

@@ -136,13 +136,13 @@ export class DatasourceSrv {
 
 
   addDataSourceVariables(list) {
   addDataSourceVariables(list) {
     // look for data source variables
     // 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];
       const variable = this.templateSrv.variables[i];
       if (variable.type !== 'datasource') {
       if (variable.type !== 'datasource') {
         continue;
         continue;
       }
       }
 
 
-      var first = variable.current.value;
+      let first = variable.current.value;
       if (first === 'default') {
       if (first === 'default') {
         first = config.defaultDatasource;
         first = config.defaultDatasource;
       }
       }

+ 2 - 2
public/app/features/plugins/ds_edit_ctrl.ts

@@ -4,7 +4,7 @@ import config from 'app/core/config';
 import { coreModule, appEvents } from 'app/core/core';
 import { coreModule, appEvents } from 'app/core/core';
 import { store } from 'app/stores/store';
 import { store } from 'app/stores/store';
 
 
-var datasourceTypes = [];
+let datasourceTypes = [];
 
 
 const defaults = {
 const defaults = {
   name: '',
   name: '',
@@ -16,7 +16,7 @@ const defaults = {
   secureJsonData: {},
   secureJsonData: {},
 };
 };
 
 
-var datasourceCreated = false;
+let datasourceCreated = false;
 
 
 export class DataSourceEditCtrl {
 export class DataSourceEditCtrl {
   isNew: boolean;
   isNew: boolean;

+ 1 - 1
public/app/features/plugins/plugin_component.ts

@@ -69,7 +69,7 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
     };
     };
 
 
     const panelInfo = config.panels[scope.panel.type];
     const panelInfo = config.panels[scope.panel.type];
-    var panelCtrlPromise = Promise.resolve(UnknownPanelCtrl);
+    let panelCtrlPromise = Promise.resolve(UnknownPanelCtrl);
     if (panelInfo) {
     if (panelInfo) {
       panelCtrlPromise = importPluginModule(panelInfo.module).then(function(panelModule) {
       panelCtrlPromise = importPluginModule(panelInfo.module).then(function(panelModule) {
         return panelModule.PanelCtrl;
         return panelModule.PanelCtrl;

+ 2 - 2
public/app/features/templating/datasource_variable.ts

@@ -43,14 +43,14 @@ export class DatasourceVariable implements Variable {
   updateOptions() {
   updateOptions() {
     const options = [];
     const options = [];
     const sources = this.datasourceSrv.getMetricSources({ skipVariables: true });
     const sources = this.datasourceSrv.getMetricSources({ skipVariables: true });
-    var regex;
+    let regex;
 
 
     if (this.regex) {
     if (this.regex) {
       regex = this.templateSrv.replace(this.regex, null, 'regex');
       regex = this.templateSrv.replace(this.regex, null, 'regex');
       regex = kbn.stringToJsRegex(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];
       const source = sources[i];
       // must match on type
       // must match on type
       if (source.meta.id !== this.query) {
       if (source.meta.id !== this.query) {

+ 4 - 4
public/app/features/templating/query_variable.ts

@@ -91,7 +91,7 @@ export class QueryVariable implements Variable {
     if (this.useTags) {
     if (this.useTags) {
       return this.metricFindQuery(datasource, this.tagsQuery).then(results => {
       return this.metricFindQuery(datasource, this.tagsQuery).then(results => {
         this.tags = [];
         this.tags = [];
-        for (var i = 0; i < results.length; i++) {
+        for (let i = 0; i < results.length; i++) {
           this.tags.push(results[i].text);
           this.tags.push(results[i].text);
         }
         }
         return datasource;
         return datasource;
@@ -142,7 +142,7 @@ export class QueryVariable implements Variable {
   }
   }
 
 
   metricNamesToVariableValues(metricNames) {
   metricNamesToVariableValues(metricNames) {
-    var regex, options, i, matches;
+    let regex, options, i, matches;
     options = [];
     options = [];
 
 
     if (this.regex) {
     if (this.regex) {
@@ -150,9 +150,9 @@ export class QueryVariable implements Variable {
     }
     }
     for (i = 0; i < metricNames.length; i++) {
     for (i = 0; i < metricNames.length; i++) {
       const item = metricNames[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)) {
       if (_.isNumber(value)) {
         value = value.toString();
         value = value.toString();

+ 6 - 6
public/app/features/templating/template_srv.ts

@@ -32,7 +32,7 @@ export class TemplateSrv {
   updateTemplateData() {
   updateTemplateData() {
     this.index = {};
     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];
       const variable = this.variables[i];
 
 
       if (!variable.current || (!variable.current.isNone && !variable.current.value)) {
       if (!variable.current || (!variable.current.isNone && !variable.current.value)) {
@@ -48,9 +48,9 @@ export class TemplateSrv {
   }
   }
 
 
   getAdhocFilters(datasourceName) {
   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];
       const variable = this.variables[i];
       if (variable.type !== 'adhoc') {
       if (variable.type !== 'adhoc') {
         continue;
         continue;
@@ -171,7 +171,7 @@ export class TemplateSrv {
       return variable.allValue;
       return variable.allValue;
     }
     }
     const values = [];
     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);
       values.push(variable.options[i].value);
     }
     }
     return values;
     return values;
@@ -182,7 +182,7 @@ export class TemplateSrv {
       return target;
       return target;
     }
     }
 
 
-    var variable, systemValue, value, fmt;
+    let variable, systemValue, value, fmt;
     this.regex.lastIndex = 0;
     this.regex.lastIndex = 0;
 
 
     return target.replace(this.regex, (match, var1, var2, fmt2, var3, fmt3) => {
     return target.replace(this.regex, (match, var1, var2, fmt2, var3, fmt3) => {
@@ -227,7 +227,7 @@ export class TemplateSrv {
       return target;
       return target;
     }
     }
 
 
-    var variable;
+    let variable;
     this.regex.lastIndex = 0;
     this.regex.lastIndex = 0;
 
 
     return target.replace(this.regex, (match, var1, var2, fmt2, var3) => {
     return target.replace(this.regex, (match, var1, var2, fmt2, var3) => {

+ 5 - 5
public/app/features/templating/variable_srv.ts

@@ -138,7 +138,7 @@ export class VariableSrv {
   }
   }
 
 
   selectOptionsForCurrentValue(variable) {
   selectOptionsForCurrentValue(variable) {
-    var i, y, value, option;
+    let i, y, value, option;
     const selected: any = [];
     const selected: any = [];
 
 
     for (i = 0; i < variable.options.length; i++) {
     for (i = 0; i < variable.options.length; i++) {
@@ -167,7 +167,7 @@ export class VariableSrv {
     }
     }
 
 
     if (_.isArray(variable.current.value)) {
     if (_.isArray(variable.current.value)) {
-      var selected = this.selectOptionsForCurrentValue(variable);
+      let selected = this.selectOptionsForCurrentValue(variable);
 
 
       // if none pick first
       // if none pick first
       if (selected.length === 0) {
       if (selected.length === 0) {
@@ -200,14 +200,14 @@ export class VariableSrv {
   }
   }
 
 
   setOptionFromUrl(variable, urlValue) {
   setOptionFromUrl(variable, urlValue) {
-    var promise = this.$q.when();
+    let promise = this.$q.when();
 
 
     if (variable.refresh) {
     if (variable.refresh) {
       promise = variable.updateOptions();
       promise = variable.updateOptions();
     }
     }
 
 
     return promise.then(() => {
     return promise.then(() => {
-      var option = _.find(variable.options, op => {
+      let option = _.find(variable.options, op => {
         return op.text === urlValue || op.value === urlValue;
         return op.text === urlValue || op.value === urlValue;
       });
       });
 
 
@@ -262,7 +262,7 @@ export class VariableSrv {
   }
   }
 
 
   setAdhocFilter(options) {
   setAdhocFilter(options) {
-    var variable = _.find(this.variables, {
+    let variable = _.find(this.variables, {
       type: 'adhoc',
       type: 'adhoc',
       datasource: options.datasource,
       datasource: options.datasource,
     });
     });

+ 11 - 11
public/app/plugins/datasource/elasticsearch/specs/elastic_response.test.ts

@@ -1,9 +1,9 @@
 import { ElasticResponse } from '../elastic_response';
 import { ElasticResponse } from '../elastic_response';
 
 
 describe('ElasticResponse', () => {
 describe('ElasticResponse', () => {
-  var targets;
-  var response;
-  var result;
+  let targets;
+  let response;
+  let result;
 
 
   describe('simple query and count', () => {
   describe('simple query and count', () => {
     beforeEach(() => {
     beforeEach(() => {
@@ -48,7 +48,7 @@ describe('ElasticResponse', () => {
   });
   });
 
 
   describe('simple query count & avg aggregation', () => {
   describe('simple query count & avg aggregation', () => {
-    var result;
+    let result;
 
 
     beforeEach(() => {
     beforeEach(() => {
       targets = [
       targets = [
@@ -97,7 +97,7 @@ describe('ElasticResponse', () => {
   });
   });
 
 
   describe('single group by query one metric', () => {
   describe('single group by query one metric', () => {
-    var result;
+    let result;
 
 
     beforeEach(() => {
     beforeEach(() => {
       targets = [
       targets = [
@@ -149,7 +149,7 @@ describe('ElasticResponse', () => {
   });
   });
 
 
   describe('single group by query two metrics', () => {
   describe('single group by query two metrics', () => {
-    var result;
+    let result;
 
 
     beforeEach(() => {
     beforeEach(() => {
       targets = [
       targets = [
@@ -209,7 +209,7 @@ describe('ElasticResponse', () => {
   });
   });
 
 
   describe('with percentiles ', () => {
   describe('with percentiles ', () => {
-    var result;
+    let result;
 
 
     beforeEach(() => {
     beforeEach(() => {
       targets = [
       targets = [
@@ -257,7 +257,7 @@ describe('ElasticResponse', () => {
   });
   });
 
 
   describe('with extended_stats', () => {
   describe('with extended_stats', () => {
-    var result;
+    let result;
 
 
     beforeEach(() => {
     beforeEach(() => {
       targets = [
       targets = [
@@ -333,7 +333,7 @@ describe('ElasticResponse', () => {
   });
   });
 
 
   describe('single group by with alias pattern', () => {
   describe('single group by with alias pattern', () => {
-    var result;
+    let result;
 
 
     beforeEach(() => {
     beforeEach(() => {
       targets = [
       targets = [
@@ -394,7 +394,7 @@ describe('ElasticResponse', () => {
   });
   });
 
 
   describe('histogram response', () => {
   describe('histogram response', () => {
-    var result;
+    let result;
 
 
     beforeEach(() => {
     beforeEach(() => {
       targets = [
       targets = [
@@ -426,7 +426,7 @@ describe('ElasticResponse', () => {
   });
   });
 
 
   describe('with two filters agg', () => {
   describe('with two filters agg', () => {
-    var result;
+    let result;
 
 
     beforeEach(() => {
     beforeEach(() => {
       targets = [
       targets = [

+ 1 - 1
public/app/plugins/panel/graph/align_yaxes.ts

@@ -120,7 +120,7 @@ function checkOppositeSides(yLeft, yRight) {
 }
 }
 
 
 function getRate(yLeft, yRight) {
 function getRate(yLeft, yRight) {
-  var rateLeft, rateRight, rate;
+  let rateLeft, rateRight, rate;
   if (checkTwoCross(yLeft, yRight)) {
   if (checkTwoCross(yLeft, yRight)) {
     rateLeft = yRight.min ? yLeft.min / yRight.min : 0;
     rateLeft = yRight.min ? yLeft.min / yRight.min : 0;
     rateRight = yRight.max ? yLeft.max / yRight.max : 0;
     rateRight = yRight.max ? yLeft.max / yRight.max : 0;

+ 1 - 1
public/app/plugins/panel/graph/data_processor.ts

@@ -11,7 +11,7 @@ export class DataProcessor {
     }
     }
 
 
     // auto detect xaxis mode
     // auto detect xaxis mode
-    var firstItem;
+    let firstItem;
     if (options.dataList && options.dataList.length > 0) {
     if (options.dataList && options.dataList.length > 0) {
       firstItem = options.dataList[0];
       firstItem = options.dataList[0];
       const autoDetectMode = this.getAutoDetectXAxisMode(firstItem);
       const autoDetectMode = this.getAutoDetectXAxisMode(firstItem);

+ 6 - 6
public/app/plugins/panel/graph/graph.ts

@@ -209,7 +209,7 @@ class GraphElement {
 
 
     // apply y-axis min/max options
     // apply y-axis min/max options
     const yaxis = plot.getYAxes();
     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 axis = yaxis[i];
       const panelOptions = this.panel.yaxes[i];
       const panelOptions = this.panel.yaxes[i];
       axis.options.max = axis.options.max !== null ? axis.options.max : panelOptions.max;
       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.
   // let's find the smallest one so that bars are correctly rendered.
   // In addition, only take series which are rendered as bars for this.
   // In addition, only take series which are rendered as bars for this.
   getMinTimeStepOfSeries(data) {
   getMinTimeStepOfSeries(data) {
-    var min = Number.MAX_VALUE;
+    let min = Number.MAX_VALUE;
 
 
     for (let i = 0; i < data.length; i++) {
     for (let i = 0; i < data.length; i++) {
       if (!data[i].stats.timeStep) {
       if (!data[i].stats.timeStep) {
@@ -533,7 +533,7 @@ class GraphElement {
   }
   }
 
 
   addXTableAxis(options) {
   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) {
       return _.map(series.datapoints, function(point, pointIndex) {
         const tickIndex = seriesIndex * series.datapoints.length + pointIndex;
         const tickIndex = seriesIndex * series.datapoints.length + pointIndex;
         return [tickIndex + 1, point[1]];
         return [tickIndex + 1, point[1]];
@@ -611,8 +611,8 @@ class GraphElement {
       axis.max = null;
       axis.max = null;
     }
     }
 
 
-    var series, i;
-    var max = axis.max,
+    let series, i;
+    let max = axis.max,
       min = axis.min;
       min = axis.min;
 
 
     for (i = 0; i < data.length; i++) {
     for (i = 0; i < data.length; i++) {
@@ -681,7 +681,7 @@ class GraphElement {
   generateTicksForLogScaleYAxis(min, max, logBase) {
   generateTicksForLogScaleYAxis(min, max, logBase) {
     let ticks = [];
     let ticks = [];
 
 
-    var nextTick;
+    let nextTick;
     for (nextTick = min; nextTick <= max; nextTick *= logBase) {
     for (nextTick = min; nextTick <= max; nextTick *= logBase) {
       ticks.push(nextTick);
       ticks.push(nextTick);
     }
     }

+ 9 - 9
public/app/plugins/panel/graph/legend.ts

@@ -8,13 +8,13 @@ const module = angular.module('grafana.directives');
 module.directive('graphLegend', function(popoverSrv, $timeout) {
 module.directive('graphLegend', function(popoverSrv, $timeout) {
   return {
   return {
     link: function(scope, elem) {
     link: function(scope, elem) {
-      var firstRender = true;
+      let firstRender = true;
       const ctrl = scope.ctrl;
       const ctrl = scope.ctrl;
       const panel = ctrl.panel;
       const panel = ctrl.panel;
-      var data;
-      var seriesList;
-      var i;
-      var legendScrollbar;
+      let data;
+      let seriesList;
+      let i;
+      let legendScrollbar;
       const legendRightDefaultWidth = 10;
       const legendRightDefaultWidth = 10;
       const legendElem = elem.parent();
       const legendElem = elem.parent();
 
 
@@ -100,7 +100,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
         if (!panel.legend[statName]) {
         if (!panel.legend[statName]) {
           return '';
           return '';
         }
         }
-        var html = '<th class="pointer" data-stat="' + statName + '">' + statName;
+        let html = '<th class="pointer" data-stat="' + statName + '">' + statName;
 
 
         if (panel.legend.sort === statName) {
         if (panel.legend.sort === statName) {
           const cssClass = panel.legend.sortDesc ? 'fa fa-caret-down' : 'fa fa-caret-up';
           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);
         elem.toggleClass('graph-legend-table', panel.legend.alignAsTable === true);
 
 
-        var tableHeaderElem;
+        let tableHeaderElem;
         if (panel.legend.alignAsTable) {
         if (panel.legend.alignAsTable) {
-          var header = '<tr>';
+          let header = '<tr>';
           header += '<th colspan="2" style="text-align:left"></th>';
           header += '<th colspan="2" style="text-align:left"></th>';
           if (panel.legend.values) {
           if (panel.legend.values) {
             header += getTableHeaderHtml('min');
             header += getTableHeaderHtml('min');
@@ -184,7 +184,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) {
             continue;
             continue;
           }
           }
 
 
-          var html = '<div class="graph-legend-series';
+          let html = '<div class="graph-legend-series';
 
 
           if (series.yaxis === 2) {
           if (series.yaxis === 2) {
             html += ' graph-legend-series--right-y';
             html += ' graph-legend-series--right-y';

+ 1 - 1
public/app/plugins/panel/graph/module.ts

@@ -288,7 +288,7 @@ class GraphCtrl extends MetricsPanelCtrl {
   }
   }
 
 
   toggleAxis(info) {
   toggleAxis(info) {
-    var override = _.find(this.panel.seriesOverrides, { alias: info.alias });
+    let override = _.find(this.panel.seriesOverrides, { alias: info.alias });
     if (!override) {
     if (!override) {
       override = { alias: info.alias };
       override = { alias: info.alias };
       this.panel.seriesOverrides.push(override);
       this.panel.seriesOverrides.push(override);

+ 1 - 1
public/app/plugins/panel/heatmap/heatmap_data_converter.ts

@@ -268,7 +268,7 @@ function pushToXBuckets(buckets, point, bucketNum, seriesName) {
 }
 }
 
 
 function pushToYBuckets(buckets, bucketNum, value, point, bounds) {
 function pushToYBuckets(buckets, bucketNum, value, point, bounds) {
-  var count = 1;
+  let count = 1;
   // Use the 3rd argument as scale/count
   // Use the 3rd argument as scale/count
   if (point.length > 3) {
   if (point.length > 3) {
     count = parseInt(point[2]);
     count = parseInt(point[2]);

+ 1 - 1
public/app/plugins/panel/heatmap/rendering.ts

@@ -100,7 +100,7 @@ export class HeatmapRenderer {
 
 
   setElementHeight() {
   setElementHeight() {
     try {
     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)) {
       if (_.isString(height)) {
         height = parseInt(height.replace('px', ''), 10);
         height = parseInt(height.replace('px', ''), 10);
       }
       }

+ 9 - 9
public/app/plugins/panel/singlestat/module.ts

@@ -243,7 +243,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
     }
     }
 
 
     const delta = value / 2;
     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 magn = Math.pow(10, -dec);
     const norm = delta / magn; // norm is between 1.0 and 10.0
     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 $timeout = this.$timeout;
     const panel = ctrl.panel;
     const panel = ctrl.panel;
     const templateSrv = this.templateSrv;
     const templateSrv = this.templateSrv;
-    var data, linkInfo;
+    let data, linkInfo;
     const $panelContainer = elem.find('.panel-container');
     const $panelContainer = elem.find('.panel-container');
     elem = elem.find('.singlestat-panel');
     elem = elem.find('.singlestat-panel');
 
 
@@ -419,24 +419,24 @@ class SingleStatCtrl extends MetricsPanelCtrl {
     }
     }
 
 
     function getBigValueHtml() {
     function getBigValueHtml() {
-      var body = '<div class="singlestat-panel-value-container">';
+      let body = '<div class="singlestat-panel-value-container">';
 
 
       if (panel.prefix) {
       if (panel.prefix) {
-        var prefix = panel.prefix;
+        let prefix = panel.prefix;
         if (panel.colorPrefix) {
         if (panel.colorPrefix) {
           prefix = applyColoringThresholds(data.value, panel.prefix);
           prefix = applyColoringThresholds(data.value, panel.prefix);
         }
         }
         body += getSpan('singlestat-panel-prefix', panel.prefixFontSize, prefix);
         body += getSpan('singlestat-panel-prefix', panel.prefixFontSize, prefix);
       }
       }
 
 
-      var value = data.valueFormatted;
+      let value = data.valueFormatted;
       if (panel.colorValue) {
       if (panel.colorValue) {
         value = applyColoringThresholds(data.value, value);
         value = applyColoringThresholds(data.value, value);
       }
       }
       body += getSpan('singlestat-panel-value', panel.valueFontSize, value);
       body += getSpan('singlestat-panel-value', panel.valueFontSize, value);
 
 
       if (panel.postfix) {
       if (panel.postfix) {
-        var postfix = panel.postfix;
+        let postfix = panel.postfix;
         if (panel.colorPostfix) {
         if (panel.colorPostfix) {
           postfix = applyColoringThresholds(data.value, panel.postfix);
           postfix = applyColoringThresholds(data.value, panel.postfix);
         }
         }
@@ -449,7 +449,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
     }
     }
 
 
     function getValueText() {
     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 += data.valueFormatted;
       result += panel.postfix ? templateSrv.replace(panel.postfix, data.scopedVars) : '';
       result += panel.postfix ? templateSrv.replace(panel.postfix, data.scopedVars) : '';
 
 
@@ -480,7 +480,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
       plotCanvas.css(plotCss);
       plotCanvas.css(plotCss);
 
 
       const thresholds = [];
       const thresholds = [];
-      for (var i = 0; i < data.thresholds.length; i++) {
+      for (let i = 0; i < data.thresholds.length; i++) {
         thresholds.push({
         thresholds.push({
           value: data.thresholds[i],
           value: data.thresholds[i],
           color: data.colorMap[i],
           color: data.colorMap[i],
@@ -720,7 +720,7 @@ function getColorForValue(data, value) {
     return null;
     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]) {
     if (value >= data.thresholds[i - 1]) {
       return data.colorMap[i];
       return data.colorMap[i];
     }
     }

+ 1 - 1
public/app/plugins/panel/table/column_options.ts

@@ -81,7 +81,7 @@ export class ColumnOptionsCtrl {
 
 
     const styles = this.panel.styles;
     const styles = this.panel.styles;
     const stylesCount = styles.length;
     const stylesCount = styles.length;
-    var indexToInsert = stylesCount;
+    let indexToInsert = stylesCount;
 
 
     // check if last is a catch all rule, then add it before that one
     // check if last is a catch all rule, then add it before that one
     if (stylesCount > 0) {
     if (stylesCount > 0) {

+ 4 - 4
public/app/plugins/panel/table/module.ts

@@ -171,12 +171,12 @@ class TablePanelCtrl extends MetricsPanelCtrl {
   }
   }
 
 
   link(scope, elem, attrs, ctrl: TablePanelCtrl) {
   link(scope, elem, attrs, ctrl: TablePanelCtrl) {
-    var data;
+    let data;
     const panel = ctrl.panel;
     const panel = ctrl.panel;
-    var pageCount = 0;
+    let pageCount = 0;
 
 
     function getTableHeight() {
     function getTableHeight() {
-      var panelHeight = ctrl.height;
+      let panelHeight = ctrl.height;
 
 
       if (pageCount > 1) {
       if (pageCount > 1) {
         panelHeight -= 26;
         panelHeight -= 26;
@@ -211,7 +211,7 @@ class TablePanelCtrl extends MetricsPanelCtrl {
 
 
       const paginationList = $('<ul></ul>');
       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 activeClass = i === ctrl.pageIndex ? 'active' : '';
         const pageLinkElem = $(
         const pageLinkElem = $(
           '<li><a class="table-panel-page-link pointer ' + activeClass + '">' + (i + 1) + '</a></li>'
           '<li><a class="table-panel-page-link pointer ' + activeClass + '">' + (i + 1) + '</a></li>'

+ 10 - 10
public/app/plugins/panel/table/renderer.ts

@@ -47,7 +47,7 @@ export class TableRenderer {
     if (!style.thresholds) {
     if (!style.thresholds) {
       return null;
       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]) {
       if (value >= style.thresholds[i - 1]) {
         return style.colors[i];
         return style.colors[i];
       }
       }
@@ -91,7 +91,7 @@ export class TableRenderer {
         if (_.isArray(v)) {
         if (_.isArray(v)) {
           v = v[0];
           v = v[0];
         }
         }
-        var date = moment(v);
+        let date = moment(v);
         if (this.isUtc) {
         if (this.isUtc) {
           date = date.utc();
           date = date.utc();
         }
         }
@@ -211,9 +211,9 @@ export class TableRenderer {
     value = this.formatColumnValue(columnIndex, value);
     value = this.formatColumnValue(columnIndex, value);
 
 
     const column = this.table.columns[columnIndex];
     const column = this.table.columns[columnIndex];
-    var style = '';
+    let style = '';
     const cellClasses = [];
     const cellClasses = [];
-    var cellClass = '';
+    let cellClass = '';
 
 
     if (this.colorState.cell) {
     if (this.colorState.cell) {
       style = ' style="background-color:' + 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
     // because of the fixed table headers css only solution
     // there is an issue if header cell is wider the cell
     // there is an issue if header cell is wider the cell
     // this hack adds header content to cell (not visible)
     // this hack adds header content to cell (not visible)
-    var columnHtml = '';
+    let columnHtml = '';
     if (addWidthHack) {
     if (addWidthHack) {
       columnHtml = '<div class="table-panel-width-hack">' + this.table.columns[columnIndex].title + '</div>';
       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 pageSize = this.panel.pageSize || 100;
     const startPos = page * pageSize;
     const startPos = page * pageSize;
     const endPos = Math.min(startPos + pageSize, this.table.rows.length);
     const endPos = Math.min(startPos + pageSize, this.table.rows.length);
-    var html = '';
+    let html = '';
     const rowClasses = [];
     const rowClasses = [];
     let rowClass = '';
     let rowClass = '';
 
 
-    for (var y = startPos; y < endPos; y++) {
+    for (let y = startPos; y < endPos; y++) {
       const row = this.table.rows[y];
       const row = this.table.rows[y];
       let cellHtml = '';
       let cellHtml = '';
       let rowStyle = '';
       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);
         cellHtml += this.renderCell(i, y, row[i], y === startPos);
       }
       }
 
 
@@ -322,10 +322,10 @@ export class TableRenderer {
   render_values() {
   render_values() {
     const rows = [];
     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 row = this.table.rows[y];
       const new_row = [];
       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]));
         new_row.push(this.formatColumnValue(i, row[i]));
       }
       }
       rows.push(new_row);
       rows.push(new_row);

+ 8 - 8
public/app/plugins/panel/table/transformers.ts

@@ -13,9 +13,9 @@ transformers['timeseries_to_rows'] = {
   transform: function(data, panel, model) {
   transform: function(data, panel, model) {
     model.columns = [{ text: 'Time', type: 'date' }, { text: 'Metric' }, { text: 'Value' }];
     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];
       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];
         const dp = series.datapoints[y];
         model.rows.push([dp[1], series.target, dp[0]]);
         model.rows.push([dp[1], series.target, dp[0]]);
       }
       }
@@ -38,7 +38,7 @@ transformers['timeseries_to_columns'] = {
       const series = data[i];
       const series = data[i];
       model.columns.push({ text: series.target });
       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 dp = series.datapoints[y];
         const timeKey = dp[1].toString();
         const timeKey = dp[1].toString();
 
 
@@ -78,7 +78,7 @@ transformers['timeseries_aggregations'] = {
     ];
     ];
   },
   },
   transform: function(data, panel, model) {
   transform: function(data, panel, model) {
-    var i, y;
+    let i, y;
     model.columns.push({ text: 'Metric' });
     model.columns.push({ text: 'Metric' });
 
 
     for (i = 0; i < panel.columns.length; i++) {
     for (i = 0; i < panel.columns.length; i++) {
@@ -118,7 +118,7 @@ transformers['annotations'] = {
       return;
       return;
     }
     }
 
 
-    for (var i = 0; i < data.annotations.length; i++) {
+    for (let i = 0; i < data.annotations.length; i++) {
       const evt = data.annotations[i];
       const evt = data.annotations[i];
       model.rows.push([evt.time, evt.title, evt.text, evt.tags]);
       model.rows.push([evt.time, evt.title, evt.text, evt.tags]);
     }
     }
@@ -270,7 +270,7 @@ transformers['json'] = {
     }
     }
 
 
     const names: any = {};
     const names: any = {};
-    for (var i = 0; i < data.length; i++) {
+    for (let i = 0; i < data.length; i++) {
       const series = data[i];
       const series = data[i];
       if (series.type !== 'docs') {
       if (series.type !== 'docs') {
         continue;
         continue;
@@ -278,7 +278,7 @@ transformers['json'] = {
 
 
       // only look at 100 docs
       // only look at 100 docs
       const maxDocs = Math.min(series.datapoints.length, 100);
       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 doc = series.datapoints[y];
         const flattened = flatten(doc, null);
         const flattened = flatten(doc, null);
         for (const propName in flattened) {
         for (const propName in flattened) {
@@ -292,7 +292,7 @@ transformers['json'] = {
     });
     });
   },
   },
   transform: function(data, panel, model) {
   transform: function(data, panel, model) {
-    var i, y, z;
+    let i, y, z;
 
 
     for (const column of panel.columns) {
     for (const column of panel.columns) {
       const tableCol: any = { text: column.text };
       const tableCol: any = { text: column.text };