diff --git a/src/ui/public/ConfigTemplate.js b/src/ui/public/ConfigTemplate.js index 3b8307ab8481a..13026f55de5d3 100644 --- a/src/ui/public/ConfigTemplate.js +++ b/src/ui/public/ConfigTemplate.js @@ -1,16 +1,16 @@ define(function (require) { - var _ = require('lodash'); + const _ = require('lodash'); function ConfigTemplate(templates) { - var template = this; + const template = this; template.current = null; template.toggle = _.partial(update, null); template.open = _.partial(update, true); template.close = _.partial(update, false); function update(newState, name) { - var toUpdate = templates[name]; - var curState = template.is(name); + const toUpdate = templates[name]; + const curState = template.is(name); if (newState == null) newState = !curState; if (newState) { diff --git a/src/ui/public/bound_to_config_obj.js b/src/ui/public/bound_to_config_obj.js index a16487835a6c1..9ca2e6b00f615 100644 --- a/src/ui/public/bound_to_config_obj.js +++ b/src/ui/public/bound_to_config_obj.js @@ -1,6 +1,6 @@ define(function (require) { return function BoundToConfigObjProvider($rootScope, config) { - var _ = require('lodash'); + const _ = require('lodash'); /** * Create an object with properties that may be bound to config values. @@ -17,7 +17,7 @@ define(function (require) { * @return {Object} */ function BoundToConfigObj(input) { - var self = this; + const self = this; _.forOwn(input, function (val, prop) { if (!_.isString(val) || val.charAt(0) !== '=') { @@ -25,7 +25,7 @@ define(function (require) { return; } - var configKey = val.substr(1); + const configKey = val.substr(1); update(); $rootScope.$on('init:config', update); diff --git a/src/ui/public/compile_recursive_directive.js b/src/ui/public/compile_recursive_directive.js index 9d9a52037951d..0de7bfa3c5f40 100644 --- a/src/ui/public/compile_recursive_directive.js +++ b/src/ui/public/compile_recursive_directive.js @@ -1,5 +1,5 @@ define(function (require) { - var _ = require('lodash'); + const _ = require('lodash'); /** * Angular can't render directives that render themselves recursively: @@ -25,7 +25,7 @@ define(function (require) { } // Break the recursion loop by removing the contents - var contents = element.contents().remove(); + const contents = element.contents().remove(); let compiledContents; return { pre: (link && link.pre) ? link.pre : null, diff --git a/src/ui/public/elastic_textarea.js b/src/ui/public/elastic_textarea.js index 8ae6372b09c2e..e0be2b95566ae 100644 --- a/src/ui/public/elastic_textarea.js +++ b/src/ui/public/elastic_textarea.js @@ -1,7 +1,7 @@ define(function (require) { - var _ = require('lodash'); - var NL_RE = /\n/g; - var events = 'keydown keypress keyup change'; + const _ = require('lodash'); + const NL_RE = /\n/g; + const events = 'keydown keypress keyup change'; require('ui/modules').get('kibana') .directive('elasticTextarea', function () { diff --git a/src/ui/public/errors.js b/src/ui/public/errors.js index ab7cb6c125552..98efdc613e0c2 100644 --- a/src/ui/public/errors.js +++ b/src/ui/public/errors.js @@ -1,13 +1,13 @@ define(function (require) { - var _ = require('lodash'); - var angular = require('angular'); + const _ = require('lodash'); + const angular = require('angular'); - var canStack = (function () { - var err = new Error(); + const canStack = (function () { + const err = new Error(); return !!err.stack; }()); - var errors = {}; + const errors = {}; // abstract error class function KbnError(msg, constructor) { @@ -120,7 +120,7 @@ define(function (require) { * @param {String} field - the fields which contains the conflict */ errors.RestrictedMapping = function RestrictedMapping(field, index) { - var msg = field + ' is a restricted field name'; + let msg = field + ' is a restricted field name'; if (index) msg += ', found it while attempting to fetch mapping for index pattern: ' + index; KbnError.call(this, msg, errors.RestrictedMapping); @@ -166,7 +166,7 @@ define(function (require) { errors.SavedObjectNotFound = function SavedObjectNotFound(type, id) { this.savedObjectType = type; this.savedObjectId = id; - var idMsg = id ? ' (id: ' + id + ')' : ''; + const idMsg = id ? ' (id: ' + id + ')' : ''; KbnError.call(this, 'Could not locate that ' + type + idMsg, errors.SavedObjectNotFound); diff --git a/src/ui/public/es.js b/src/ui/public/es.js index 43fa5fdecec40..bb561c0974178 100644 --- a/src/ui/public/es.js +++ b/src/ui/public/es.js @@ -1,6 +1,6 @@ define(function (require) { require('elasticsearch-browser/elasticsearch.angular.js'); - var _ = require('lodash'); + const _ = require('lodash'); let es; // share the client amoungst all apps require('ui/modules') diff --git a/src/ui/public/events.js b/src/ui/public/events.js index b0c91470d4ce7..bb9b287adf961 100644 --- a/src/ui/public/events.js +++ b/src/ui/public/events.js @@ -1,10 +1,10 @@ define(function (require) { - var _ = require('lodash'); - var Notifier = require('ui/notify/notifier'); + const _ = require('lodash'); + const Notifier = require('ui/notify/notifier'); return function EventsProvider(Private, Promise) { - var SimpleEmitter = require('ui/utils/SimpleEmitter'); - var notify = new Notifier({ location: 'EventEmitter' }); + const SimpleEmitter = require('ui/utils/SimpleEmitter'); + const notify = new Notifier({ location: 'EventEmitter' }); _.class(Events).inherits(SimpleEmitter); function Events() { @@ -24,7 +24,7 @@ define(function (require) { this._listeners[name] = []; } - var listener = { + const listener = { handler: handler }; this._listeners[name].push(listener); @@ -76,8 +76,8 @@ define(function (require) { * @returns {Promise} */ Events.prototype.emit = function (name) { - var self = this; - var args = _.rest(arguments); + const self = this; + const args = _.rest(arguments); if (!self._listeners[name]) { return self._emitChain; diff --git a/src/ui/public/fixedScroll.js b/src/ui/public/fixedScroll.js index d8381b818eadf..9892ebc6d28d6 100644 --- a/src/ui/public/fixedScroll.js +++ b/src/ui/public/fixedScroll.js @@ -1,8 +1,8 @@ define(function (require) { - var $ = require('jquery'); - var _ = require('lodash'); + const $ = require('jquery'); + const _ = require('lodash'); - var SCROLLER_HEIGHT = 20; + const SCROLLER_HEIGHT = 20; require('ui/modules') .get('kibana') @@ -10,15 +10,15 @@ define(function (require) { return { restrict: 'A', link: function ($scope, $el) { - var $window = $(window); - var $scroller = $('
').height(SCROLLER_HEIGHT); + let $window = $(window); + let $scroller = $('
').height(SCROLLER_HEIGHT); /** * Remove the listeners bound in listen() * @type {function} */ - var unlisten = _.noop; + let unlisten = _.noop; /** * Listen for scroll events on the $scroller and the $el, sets unlisten() @@ -74,15 +74,15 @@ define(function (require) { function setup() { cleanUp(); - var containerWidth = $el.width(); - var contentWidth = $el.prop('scrollWidth'); - var containerHorizOverflow = contentWidth - containerWidth; + const containerWidth = $el.width(); + const contentWidth = $el.prop('scrollWidth'); + const containerHorizOverflow = contentWidth - containerWidth; - var elTop = $el.offset().top - $window.scrollTop(); - var elBottom = elTop + $el.height(); - var windowVertOverflow = elBottom - $window.height(); + const elTop = $el.offset().top - $window.scrollTop(); + const elBottom = elTop + $el.height(); + const windowVertOverflow = elBottom - $window.height(); - var requireScroller = containerHorizOverflow > 0 && windowVertOverflow > 0; + const requireScroller = containerHorizOverflow > 0 && windowVertOverflow > 0; if (!requireScroller) return; // push the content away from the scroller diff --git a/src/ui/public/modules.js b/src/ui/public/modules.js index 286b6cd6a20a3..939cddc4843d5 100644 --- a/src/ui/public/modules.js +++ b/src/ui/public/modules.js @@ -1,8 +1,8 @@ define(function (require) { - var angular = require('angular'); - var existingModules = {}; - var _ = require('lodash'); - var links = []; + const angular = require('angular'); + const existingModules = {}; + const _ = require('lodash'); + const links = []; function link(module) { // as modules are defined they will be set as requirements for this app @@ -13,7 +13,7 @@ define(function (require) { } function get(moduleName, requires) { - var module = existingModules[moduleName]; + let module = existingModules[moduleName]; if (module === void 0) { // create the module @@ -36,13 +36,13 @@ define(function (require) { } function close(moduleName) { - var module = existingModules[moduleName]; + const module = existingModules[moduleName]; // already closed if (!module) return; // if the module is currently linked, unlink it - var i = links.indexOf(module); + const i = links.indexOf(module); if (i > -1) links.splice(i, 1); // remove from linked modules list of required modules diff --git a/src/ui/public/validateDateInterval.js b/src/ui/public/validateDateInterval.js index 2adf577c288e4..9a7eec48ef896 100644 --- a/src/ui/public/validateDateInterval.js +++ b/src/ui/public/validateDateInterval.js @@ -1,5 +1,5 @@ define(function (require) { - var parseInterval = require('ui/utils/parse_interval'); + const parseInterval = require('ui/utils/parse_interval'); require('ui/modules') .get('kibana')