diff --git a/src/ui/public/fancy_forms/fancy_forms.js b/src/ui/public/fancy_forms/fancy_forms.js
index 1dd23015894dc..457b1aa01442d 100644
--- a/src/ui/public/fancy_forms/fancy_forms.js
+++ b/src/ui/public/fancy_forms/fancy_forms.js
@@ -12,16 +12,16 @@ uiModules
// directive providers are arrays
$delegate.forEach(function (directive) {
// get metadata about all init fns
- var chain = [directive.controller, DecorativeController].map(function (fn) {
- var deps = $injector.annotate(fn);
+ let chain = [directive.controller, DecorativeController].map(function (fn) {
+ let deps = $injector.annotate(fn);
return { deps: deps, fn: _.isArray(fn) ? _.last(fn) : fn };
});
// replace the controller with one that will setup the actual controller
directive.controller = function stub() {
- var allDeps = _.toArray(arguments);
+ let allDeps = _.toArray(arguments);
return chain.reduce(function (controller, link, i) {
- var deps = allDeps.splice(0, link.deps.length);
+ let deps = allDeps.splice(0, link.deps.length);
return link.fn.apply(controller, deps) || controller;
}, this);
};
diff --git a/src/ui/public/fancy_forms/kbn_form_controller.js b/src/ui/public/fancy_forms/kbn_form_controller.js
index 2fbdbab4ca47e..c4b9f4ef19717 100644
--- a/src/ui/public/fancy_forms/kbn_form_controller.js
+++ b/src/ui/public/fancy_forms/kbn_form_controller.js
@@ -7,7 +7,7 @@ import _ from 'lodash';
* @param {$scope} $scope
*/
function KbnFormController($scope, $element) {
- var self = this;
+ let self = this;
self.errorCount = function (predicate) {
return self.$$invalidModels().length;
@@ -21,14 +21,14 @@ function KbnFormController($scope, $element) {
};
self.describeErrors = function () {
- var count = self.softErrorCount();
+ let count = self.softErrorCount();
return count + ' Error' + (count === 1 ? '' : 's');
};
self.$$invalidModels = function (predicate) {
predicate = _.callback(predicate);
- var invalid = [];
+ let invalid = [];
_.forOwn(self.$error, function collect(models) {
if (!models) return;
@@ -40,7 +40,7 @@ function KbnFormController($scope, $element) {
} else {
if (predicate(model)) {
// prevent dups
- var len = invalid.length;
+ let len = invalid.length;
while (len--) if (invalid[len] === model) return;
invalid.push(model);
diff --git a/src/ui/public/field_editor/field_editor.js b/src/ui/public/field_editor/field_editor.js
index ef4f8c6c0cb81..3b4692eb1120a 100644
--- a/src/ui/public/field_editor/field_editor.js
+++ b/src/ui/public/field_editor/field_editor.js
@@ -11,10 +11,10 @@ import fieldEditorTemplate from 'ui/field_editor/field_editor.html';
uiModules
.get('kibana', ['colorpicker.module'])
.directive('fieldEditor', function (Private, $sce) {
- var fieldFormats = Private(RegistryFieldFormatsProvider);
- var Field = Private(IndexPatternsFieldProvider);
- var scriptingInfo = $sce.trustAsHtml(require('ui/field_editor/scripting_info.html'));
- var scriptingWarning = $sce.trustAsHtml(require('ui/field_editor/scripting_warning.html'));
+ let fieldFormats = Private(RegistryFieldFormatsProvider);
+ let Field = Private(IndexPatternsFieldProvider);
+ let scriptingInfo = $sce.trustAsHtml(require('ui/field_editor/scripting_info.html'));
+ let scriptingWarning = $sce.trustAsHtml(require('ui/field_editor/scripting_warning.html'));
return {
restrict: 'E',
@@ -25,8 +25,8 @@ uiModules
},
controllerAs: 'editor',
controller: function ($scope, Notifier, kbnUrl) {
- var self = this;
- var notify = new Notifier({ location: 'Field Editor' });
+ let self = this;
+ let notify = new Notifier({ location: 'Field Editor' });
self.scriptingInfo = scriptingInfo;
self.scriptingWarning = scriptingWarning;
@@ -43,9 +43,9 @@ uiModules
self.cancel = redirectAway;
self.save = function () {
- var indexPattern = self.indexPattern;
- var fields = indexPattern.fields;
- var field = self.field.toActualField();
+ let indexPattern = self.indexPattern;
+ let fields = indexPattern.fields;
+ let field = self.field.toActualField();
fields.remove({ name: field.name });
fields.push(field);
@@ -64,8 +64,8 @@ uiModules
};
self.delete = function () {
- var indexPattern = self.indexPattern;
- var field = self.field;
+ let indexPattern = self.indexPattern;
+ let field = self.field;
indexPattern.fields.remove({ name: field.name });
return indexPattern.save()
@@ -76,9 +76,9 @@ uiModules
};
$scope.$watch('editor.selectedFormatId', function (cur, prev) {
- var format = self.field.format;
- var changedFormat = cur !== prev;
- var missingFormat = cur && (!format || format.type.id !== cur);
+ let format = self.field.format;
+ let changedFormat = cur !== prev;
+ let missingFormat = cur && (!format || format.type.id !== cur);
if (!changedFormat || !missingFormat) return;
@@ -87,15 +87,15 @@ uiModules
});
$scope.$watch('editor.formatParams', function () {
- var FieldFormat = getFieldFormatType();
+ let FieldFormat = getFieldFormatType();
self.field.format = new FieldFormat(self.formatParams);
}, true);
// copy the defined properties of the field to a plain object
// which is mutable, and capture the changed seperately.
function shadowCopy(field) {
- var changes = {};
- var shadowProps = {
+ let changes = {};
+ let shadowProps = {
toActualField: {
// bring the shadow copy out of the shadows
value: function toActualField() {
@@ -105,7 +105,7 @@ uiModules
};
Object.getOwnPropertyNames(field).forEach(function (prop) {
- var desc = Object.getOwnPropertyDescriptor(field, prop);
+ let desc = Object.getOwnPropertyDescriptor(field, prop);
shadowProps[prop] = {
enumerable: desc.enumerable,
get: function () {
@@ -130,7 +130,7 @@ uiModules
}
function initDefaultFormat() {
- var def = Object.create(fieldFormats.getDefaultType(self.field.type));
+ let def = Object.create(fieldFormats.getDefaultType(self.field.type));
// explicitly set to undefined to prevent inheritting the prototypes id
def.id = undefined;
diff --git a/src/ui/public/field_format_editor/field_format_editor.js b/src/ui/public/field_format_editor/field_format_editor.js
index cea2b725122e3..ee60560543c21 100644
--- a/src/ui/public/field_format_editor/field_format_editor.js
+++ b/src/ui/public/field_format_editor/field_format_editor.js
@@ -13,7 +13,7 @@ uiModules
},
controllerAs: 'editor',
controller: function ($scope) {
- var self = this;
+ let self = this;
// bind the scope values to the controller, down with $scope.values
$scope.editor = this;
@@ -40,7 +40,7 @@ uiModules
* @return {undefined}
*/
$scope.$watch('editor.field.format.type', function (FieldFormat) {
- var opts = FieldFormat && FieldFormat.editor;
+ let opts = FieldFormat && FieldFormat.editor;
if (!opts) {
delete self.$$pseudoDirective;
@@ -67,14 +67,14 @@ uiModules
},
link: function ($scope, $el) {
- var scopesToTeardown = [];
+ let scopesToTeardown = [];
function setupScope(opts) {
if (typeof opts !== 'object') {
return scopesToTeardown[scopesToTeardown.push($scope.$new()) - 1];
}
- var isolate = scopesToTeardown[scopesToTeardown.push($scope.$new(true)) - 1];
+ let isolate = scopesToTeardown[scopesToTeardown.push($scope.$new(true)) - 1];
_.forOwn(opts, function (from, to) {
isolate.$bind(to, from, $scope);
});
@@ -88,21 +88,21 @@ uiModules
if (!directive) return $el.hide();
else $el.show();
- var askedForChild = !!directive.scope;
- var reuseScope = !askedForChild && !directive.controller;
+ let askedForChild = !!directive.scope;
+ let reuseScope = !askedForChild && !directive.controller;
- var $formatEditor = $('
').html(directive.template);
- var $formatEditorScope = reuseScope ? $scope : setupScope(directive.scope);
+ let $formatEditor = $('
').html(directive.template);
+ let $formatEditorScope = reuseScope ? $scope : setupScope(directive.scope);
if (directive.controller) {
// bind the controller to the injected element
- var cntrlAs = (directive.controllerAs ? ' as ' + directive.controllerAs : '');
+ let cntrlAs = (directive.controllerAs ? ' as ' + directive.controllerAs : '');
$formatEditorScope.Controller = directive.controller;
$formatEditor.attr('ng-controller', 'Controller' + cntrlAs);
}
- var attrs = {};
- var linkFns = directive.compile && directive.compile($el, attrs);
+ let attrs = {};
+ let linkFns = directive.compile && directive.compile($el, attrs);
if (!linkFns || _.isFunction(linkFns)) {
linkFns = {
pre: _.noop,
diff --git a/src/ui/public/field_format_editor/pattern/pattern.js b/src/ui/public/field_format_editor/pattern/pattern.js
index 6ab0067653807..b13610f8c84f6 100644
--- a/src/ui/public/field_format_editor/pattern/pattern.js
+++ b/src/ui/public/field_format_editor/pattern/pattern.js
@@ -11,7 +11,7 @@ uiModules
require: ['ngModel', '^fieldEditor'],
scope: true,
link: function ($scope, $el, attrs, cntrls) {
- var ngModelCntrl = cntrls[0];
+ let ngModelCntrl = cntrls[0];
$scope.$bind('inputs', attrs.inputs);
$scope.$bind('placeholder', attrs.placeholder);
diff --git a/src/ui/public/field_format_editor/samples/samples.js b/src/ui/public/field_format_editor/samples/samples.js
index a752087b85b2e..d391af37d1556 100644
--- a/src/ui/public/field_format_editor/samples/samples.js
+++ b/src/ui/public/field_format_editor/samples/samples.js
@@ -11,7 +11,7 @@ uiModules
require: ['?^ngModel', '^fieldEditor'],
scope: true,
link: function ($scope, $el, attrs, cntrls) {
- var ngModelCntrl = cntrls[0];
+ let ngModelCntrl = cntrls[0];
$scope.samples = null;
$scope.$bind('inputs', attrs.inputs);
@@ -21,14 +21,14 @@ uiModules
'[]inputs'
], function () {
$scope.samples = null;
- var field = $scope.editor.field;
+ let field = $scope.editor.field;
if (!field || !field.format) {
return;
}
Promise.try(function () {
- var converter = field.format.getConverterFor('html');
+ let converter = field.format.getConverterFor('html');
$scope.samples = _.map($scope.inputs, function (input) {
return [input, $sce.trustAsHtml(converter(input))];
});
diff --git a/src/ui/public/filter_bar/filter_bar.js b/src/ui/public/filter_bar/filter_bar.js
index d50a33d3b08e4..d16b64332c0e9 100644
--- a/src/ui/public/filter_bar/filter_bar.js
+++ b/src/ui/public/filter_bar/filter_bar.js
@@ -11,17 +11,17 @@ import FilterBarLibFilterOutTimeBasedFilterProvider from 'ui/filter_bar/lib/filt
import FilterBarLibChangeTimeFilterProvider from 'ui/filter_bar/lib/change_time_filter';
import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter';
import uiModules from 'ui/modules';
-var module = uiModules.get('kibana');
+let module = uiModules.get('kibana');
module.directive('filterBar', function (Private, Promise, getAppState) {
- var mapAndFlattenFilters = Private(FilterBarLibMapAndFlattenFiltersProvider);
- var mapFlattenAndWrapFilters = Private(FilterBarLibMapFlattenAndWrapFiltersProvider);
- var extractTimeFilter = Private(FilterBarLibExtractTimeFilterProvider);
- var filterOutTimeBasedFilter = Private(FilterBarLibFilterOutTimeBasedFilterProvider);
- var changeTimeFilter = Private(FilterBarLibChangeTimeFilterProvider);
- var queryFilter = Private(FilterBarQueryFilterProvider);
- var privateFilterFieldRegex = /(^\$|meta)/;
+ let mapAndFlattenFilters = Private(FilterBarLibMapAndFlattenFiltersProvider);
+ let mapFlattenAndWrapFilters = Private(FilterBarLibMapFlattenAndWrapFiltersProvider);
+ let extractTimeFilter = Private(FilterBarLibExtractTimeFilterProvider);
+ let filterOutTimeBasedFilter = Private(FilterBarLibFilterOutTimeBasedFilterProvider);
+ let changeTimeFilter = Private(FilterBarLibChangeTimeFilterProvider);
+ let queryFilter = Private(FilterBarQueryFilterProvider);
+ let privateFilterFieldRegex = /(^\$|meta)/;
return {
restrict: 'E',
@@ -48,7 +48,7 @@ module.directive('filterBar', function (Private, Promise, getAppState) {
$scope.aceLoaded = function (editor) {
editor.$blockScrolling = Infinity;
- var session = editor.getSession();
+ let session = editor.getSession();
session.setTabSize(2);
session.setUseSoftTabs(true);
};
@@ -141,7 +141,7 @@ module.directive('filterBar', function (Private, Promise, getAppState) {
}
function updateFilters() {
- var filters = queryFilter.getFilters();
+ let filters = queryFilter.getFilters();
mapAndFlattenFilters(filters).then(function (results) {
// used to display the current filters in the state
$scope.filters = _.sortBy(results, function (filter) {
diff --git a/src/ui/public/filter_bar/filter_bar_click_handler.js b/src/ui/public/filter_bar/filter_bar_click_handler.js
index d5396b593e21b..25c7ae1a3b1bf 100644
--- a/src/ui/public/filter_bar/filter_bar_click_handler.js
+++ b/src/ui/public/filter_bar/filter_bar_click_handler.js
@@ -6,7 +6,7 @@ import findByParam from 'ui/utils/find_by_param';
export default function (Notifier) {
return function ($state) {
return function (event, simulate) {
- var notify = new Notifier({
+ let notify = new Notifier({
location: 'Filter bar'
});
let aggConfigResult;
@@ -23,18 +23,18 @@ export default function (Notifier) {
}
if (aggConfigResult) {
- var isLegendLabel = !!event.point.values;
- var aggBuckets = _.filter(aggConfigResult.getPath(), { type: 'bucket' });
+ let isLegendLabel = !!event.point.values;
+ let aggBuckets = _.filter(aggConfigResult.getPath(), { type: 'bucket' });
// For legend clicks, use the last bucket in the path
if (isLegendLabel) {
// series data has multiple values, use aggConfig on the first
// hierarchical data values is an object with the addConfig
- var aggConfig = findByParam(event.point.values, 'aggConfig');
+ let aggConfig = findByParam(event.point.values, 'aggConfig');
aggBuckets = aggBuckets.filter((result) => result.aggConfig && result.aggConfig === aggConfig);
}
- var filters = _(aggBuckets)
+ let filters = _(aggBuckets)
.map(function (result) {
try {
return result.createFilter();
diff --git a/src/ui/public/filter_bar/lib/change_time_filter.js b/src/ui/public/filter_bar/lib/change_time_filter.js
index 166f6a274516d..47e991eabe7be 100644
--- a/src/ui/public/filter_bar/lib/change_time_filter.js
+++ b/src/ui/public/filter_bar/lib/change_time_filter.js
@@ -2,8 +2,8 @@ import moment from 'moment';
import _ from 'lodash';
export default function changeTimeFilterProvider(timefilter) {
return function (filter) {
- var key = _.keys(filter.range)[0];
- var values = filter.range[key];
+ let key = _.keys(filter.range)[0];
+ let values = filter.range[key];
timefilter.time.from = moment(values.gt || values.gte);
timefilter.time.to = moment(values.lt || values.lte);
timefilter.time.mode = 'absolute';
diff --git a/src/ui/public/filter_bar/lib/compare_filters.js b/src/ui/public/filter_bar/lib/compare_filters.js
index a9edc75c9a04a..2cfa19e6d5345 100644
--- a/src/ui/public/filter_bar/lib/compare_filters.js
+++ b/src/ui/public/filter_bar/lib/compare_filters.js
@@ -24,7 +24,7 @@ export default function (first, second, comparatorOptions) {
};
function mapFilter(filter) {
- var cleaned = _.omit(filter, excludedAttributes);
+ let cleaned = _.omit(filter, excludedAttributes);
if (comparators.negate) cleaned.negate = filter.meta && !!filter.meta.negate;
if (comparators.disabled) cleaned.disabled = filter.meta && !!filter.meta.disabled;
return cleaned;
diff --git a/src/ui/public/filter_bar/lib/extract_time_filter.js b/src/ui/public/filter_bar/lib/extract_time_filter.js
index b3e431451df4c..c13b96a4ffa25 100644
--- a/src/ui/public/filter_bar/lib/extract_time_filter.js
+++ b/src/ui/public/filter_bar/lib/extract_time_filter.js
@@ -3,12 +3,12 @@ export default function extractTimeFilterProvider(courier, Promise) {
return Promise.method(function (filters) {
// Assume all the index patterns are the same since they will be added
// from the same visualization.
- var id = _.get(filters, '[0].meta.index');
+ let id = _.get(filters, '[0].meta.index');
if (id == null) return;
return courier.indexPatterns.get(id).then(function (indexPattern) {
- var filter = _.find(filters, function (obj) {
- var key = _.keys(obj.range)[0];
+ let filter = _.find(filters, function (obj) {
+ let key = _.keys(obj.range)[0];
return key === indexPattern.timeFieldName;
});
if (filter && filter.range) {
diff --git a/src/ui/public/filter_bar/lib/filter_out_time_based_filter.js b/src/ui/public/filter_bar/lib/filter_out_time_based_filter.js
index 489ecd8b2a2f3..bd033b15fd8d5 100644
--- a/src/ui/public/filter_bar/lib/filter_out_time_based_filter.js
+++ b/src/ui/public/filter_bar/lib/filter_out_time_based_filter.js
@@ -1,7 +1,7 @@
import _ from 'lodash';
export default function filterOutTimeBaseFilter(courier, Promise) {
return Promise.method(function (filters) {
- var id = _.get(filters, '[0].meta.index');
+ let id = _.get(filters, '[0].meta.index');
if (id == null) return;
return courier.indexPatterns.get(id).then(function (indexPattern) {
diff --git a/src/ui/public/filter_bar/lib/generate_mapping_chain.js b/src/ui/public/filter_bar/lib/generate_mapping_chain.js
index 9e0a32f9a9756..e857804a37775 100644
--- a/src/ui/public/filter_bar/lib/generate_mapping_chain.js
+++ b/src/ui/public/filter_bar/lib/generate_mapping_chain.js
@@ -1,7 +1,7 @@
import _ from 'lodash';
export default function generateMappingChainProvider(Promise) {
- var noop = function () {
+ let noop = function () {
return Promise.reject(new Error('No mappings have been found for filter.'));
};
diff --git a/src/ui/public/filter_bar/lib/map_and_flatten_filters.js b/src/ui/public/filter_bar/lib/map_and_flatten_filters.js
index f8d2820cd0454..f48706eb68f88 100644
--- a/src/ui/public/filter_bar/lib/map_and_flatten_filters.js
+++ b/src/ui/public/filter_bar/lib/map_and_flatten_filters.js
@@ -1,7 +1,7 @@
import _ from 'lodash';
import FilterBarLibMapFilterProvider from 'ui/filter_bar/lib/map_filter';
export default function mapAndFlattenFiltersProvider(Private, Promise) {
- var mapFilter = Private(FilterBarLibMapFilterProvider);
+ let mapFilter = Private(FilterBarLibMapFilterProvider);
return function (filters) {
return _(filters)
.flatten()
diff --git a/src/ui/public/filter_bar/lib/map_default.js b/src/ui/public/filter_bar/lib/map_default.js
index 18d68489073ea..e9f53ed21710e 100644
--- a/src/ui/public/filter_bar/lib/map_default.js
+++ b/src/ui/public/filter_bar/lib/map_default.js
@@ -2,15 +2,15 @@ import angular from 'angular';
import _ from 'lodash';
export default function mapDefaultProvider(Promise) {
- var metaProperty = /(^\$|meta)/;
+ let metaProperty = /(^\$|meta)/;
return function (filter) {
- var key = _.find(_.keys(filter), function (key) {
+ let key = _.find(_.keys(filter), function (key) {
return !key.match(metaProperty);
});
if (key) {
- var value = angular.toJson(filter[key]);
+ let value = angular.toJson(filter[key]);
return Promise.resolve({ key: key, value: value });
}
return Promise.reject(filter);
diff --git a/src/ui/public/filter_bar/lib/map_filter.js b/src/ui/public/filter_bar/lib/map_filter.js
index 79291f97b8442..7b80d2176a8d1 100644
--- a/src/ui/public/filter_bar/lib/map_filter.js
+++ b/src/ui/public/filter_bar/lib/map_filter.js
@@ -11,7 +11,7 @@ import MapScriptProvider from './map_script';
import MapDefaultProvider from './map_default';
export default function mapFilterProvider(Promise, Private) {
- var generateMappingChain = Private(GenerateMappingChainProvider);
+ let generateMappingChain = Private(GenerateMappingChainProvider);
/** Mappers **/
@@ -29,7 +29,7 @@ export default function mapFilterProvider(Promise, Private) {
// To create a new mapper you just need to create a function
// that either handles the mapping operation or not
// and add it here. ProTip: These are executed in order listed
- var mappers = [
+ let mappers = [
Private(MapMatchAllProvider),
Private(MapTermsProvider),
Private(MapRangeProvider),
@@ -41,14 +41,14 @@ export default function mapFilterProvider(Promise, Private) {
Private(MapDefaultProvider)
];
- var noop = function () {
+ let noop = function () {
return Promise.reject(new Error('No mappings have been found for filter.'));
};
// Create a chain of responsibility by reducing all the
// mappers down into one function.
- var mapFn = _.reduceRight(mappers, function (memo, map) {
- var filterChainFn = generateMappingChain(map);
+ let mapFn = _.reduceRight(mappers, function (memo, map) {
+ let filterChainFn = generateMappingChain(map);
return filterChainFn(memo);
}, noop);
diff --git a/src/ui/public/filter_bar/lib/map_flatten_and_wrap_filters.js b/src/ui/public/filter_bar/lib/map_flatten_and_wrap_filters.js
index da726135aba64..f86b5a6e566b1 100644
--- a/src/ui/public/filter_bar/lib/map_flatten_and_wrap_filters.js
+++ b/src/ui/public/filter_bar/lib/map_flatten_and_wrap_filters.js
@@ -1,7 +1,7 @@
import _ from 'lodash';
import FilterBarLibMapAndFlattenFiltersProvider from 'ui/filter_bar/lib/map_and_flatten_filters';
export default function mapFlattenAndWrapFilters(Private) {
- var mapAndFlattenFilters = Private(FilterBarLibMapAndFlattenFiltersProvider);
+ let mapAndFlattenFilters = Private(FilterBarLibMapAndFlattenFiltersProvider);
return function (filters) {
return mapAndFlattenFilters(filters).then(function (filters) {
return _.map(filters, function (filter) {
diff --git a/src/ui/public/filter_bar/lib/map_range.js b/src/ui/public/filter_bar/lib/map_range.js
index 12a3cd96a2c64..5e710b0dd4560 100644
--- a/src/ui/public/filter_bar/lib/map_range.js
+++ b/src/ui/public/filter_bar/lib/map_range.js
@@ -7,14 +7,14 @@ export default function mapRangeProvider(Promise, courier) {
.indexPatterns
.get(filter.meta.index)
.then(function (indexPattern) {
- var key = Object.keys(filter.range)[0];
- var convert = indexPattern.fields.byName[key].format.getConverterFor('text');
- var range = filter.range[key];
+ let key = Object.keys(filter.range)[0];
+ let convert = indexPattern.fields.byName[key].format.getConverterFor('text');
+ let range = filter.range[key];
- var left = has(range, 'gte') ? range.gte : range.gt;
+ let left = has(range, 'gte') ? range.gte : range.gt;
if (left == null) left = -Infinity;
- var right = has(range, 'lte') ? range.lte : range.lt;
+ let right = has(range, 'lte') ? range.lte : range.lt;
if (right == null) right = Infinity;
return {
diff --git a/src/ui/public/filter_bar/lib/only_disabled.js b/src/ui/public/filter_bar/lib/only_disabled.js
index 002a0ff304793..8bb7cbf23ee91 100644
--- a/src/ui/public/filter_bar/lib/only_disabled.js
+++ b/src/ui/public/filter_bar/lib/only_disabled.js
@@ -1,6 +1,6 @@
import _ from 'lodash';
-var pluckDisabled = function (filter) {
+let pluckDisabled = function (filter) {
return _.get(filter, 'meta.disabled');
};
diff --git a/src/ui/public/filter_bar/lib/only_state_changed.js b/src/ui/public/filter_bar/lib/only_state_changed.js
index 2b3a7ad9723bd..8fe0cceec830a 100644
--- a/src/ui/public/filter_bar/lib/only_state_changed.js
+++ b/src/ui/public/filter_bar/lib/only_state_changed.js
@@ -1,6 +1,6 @@
import _ from 'lodash';
import compareFilters from 'ui/filter_bar/lib/compare_filters';
-var compareOptions = { disabled: true, negate: true };
+let compareOptions = { disabled: true, negate: true };
/**
* Checks to see if only disabled filters have been changed
@@ -8,7 +8,7 @@ var compareOptions = { disabled: true, negate: true };
*/
export default function (newFilters, oldFilters) {
return _.every(newFilters, function (newFilter, i) {
- var match = _.find(oldFilters, function (oldFilter) {
+ let match = _.find(oldFilters, function (oldFilter) {
return compareFilters(newFilter, oldFilter, compareOptions);
});
return !!match;
diff --git a/src/ui/public/filter_bar/lib/uniq_filters.js b/src/ui/public/filter_bar/lib/uniq_filters.js
index 988f921af7b37..cdaa896b55a09 100644
--- a/src/ui/public/filter_bar/lib/uniq_filters.js
+++ b/src/ui/public/filter_bar/lib/uniq_filters.js
@@ -7,7 +7,7 @@ import dedupFilters from 'ui/filter_bar/lib/dedup_filters';
* @returns {object} The original filters array with duplicates removed
*/
export default function (filters, comparatorOptions) {
- var results = [];
+ let results = [];
_.each(filters, function (filter) {
results = _.union(results, dedupFilters(results, [filter], comparatorOptions));
});
diff --git a/src/ui/public/filter_bar/push_filter.js b/src/ui/public/filter_bar/push_filter.js
index 3b75d263af5fe..6375791b05826 100644
--- a/src/ui/public/filter_bar/push_filter.js
+++ b/src/ui/public/filter_bar/push_filter.js
@@ -7,8 +7,8 @@ export default function () {
// Hierarchical and tabular data set their aggConfigResult parameter
// differently because of how the point is rewritten between the two. So
// we need to check if the point.orig is set, if not use try the point.aggConfigResult
- var filters = _.clone($state.filters || []);
- var pendingFilter = { meta: { negate: negate, index: index }};
+ let filters = _.clone($state.filters || []);
+ let pendingFilter = { meta: { negate: negate, index: index }};
_.extend(pendingFilter, filter);
filters.push(pendingFilter);
$state.filters = filters;
diff --git a/src/ui/public/filter_bar/query_filter.js b/src/ui/public/filter_bar/query_filter.js
index 501de4a26f18e..7647586b0c44f 100644
--- a/src/ui/public/filter_bar/query_filter.js
+++ b/src/ui/public/filter_bar/query_filter.js
@@ -8,21 +8,21 @@ import EventsProvider from 'ui/events';
import FilterBarLibMapAndFlattenFiltersProvider from 'ui/filter_bar/lib/map_and_flatten_filters';
export default function (Private, $rootScope, getAppState, globalState, config) {
- var EventEmitter = Private(EventsProvider);
- var mapAndFlattenFilters = Private(FilterBarLibMapAndFlattenFiltersProvider);
+ let EventEmitter = Private(EventsProvider);
+ let mapAndFlattenFilters = Private(FilterBarLibMapAndFlattenFiltersProvider);
- var queryFilter = new EventEmitter();
+ let queryFilter = new EventEmitter();
queryFilter.getFilters = function () {
- var compareOptions = { disabled: true, negate: true };
- var appFilters = queryFilter.getAppFilters();
- var globalFilters = queryFilter.getGlobalFilters();
+ let compareOptions = { disabled: true, negate: true };
+ let appFilters = queryFilter.getAppFilters();
+ let globalFilters = queryFilter.getGlobalFilters();
return uniqFilters(globalFilters.concat(appFilters), compareOptions);
};
queryFilter.getAppFilters = function () {
- var appState = getAppState();
+ let appState = getAppState();
if (!appState || !appState.filters) return [];
// Work around for https://github.com/elastic/kibana/issues/5896
@@ -49,7 +49,7 @@ export default function (Private, $rootScope, getAppState, globalState, config)
queryFilter.addFilters = function (filters, global) {
if (global === undefined) {
- var configDefault = config.get('filters:pinnedByDefault');
+ let configDefault = config.get('filters:pinnedByDefault');
if (configDefault === false || configDefault === true) {
global = configDefault;
@@ -57,8 +57,8 @@ export default function (Private, $rootScope, getAppState, globalState, config)
}
// Determine the state for the new filter (whether to pass the filter through other apps or not)
- var appState = getAppState();
- var filterState = (global) ? globalState : appState;
+ let appState = getAppState();
+ let filterState = (global) ? globalState : appState;
if (!_.isArray(filters)) {
filters = [filters];
@@ -79,8 +79,8 @@ export default function (Private, $rootScope, getAppState, globalState, config)
* @param {object} matchFilter The filter to remove
*/
queryFilter.removeFilter = function (matchFilter) {
- var appState = getAppState();
- var filter = _.omit(matchFilter, ['$$hashKey']);
+ let appState = getAppState();
+ let filter = _.omit(matchFilter, ['$$hashKey']);
let state;
let index;
@@ -108,11 +108,11 @@ export default function (Private, $rootScope, getAppState, globalState, config)
* @returns {object} Promise that resolves to the new filter on a successful merge
*/
queryFilter.updateFilter = function (filter) {
- var mergedFilter = _.assign({}, filter.source, filter.model);
+ let mergedFilter = _.assign({}, filter.source, filter.model);
mergedFilter.meta.alias = filter.alias;
//If the filter type is changed we want to discard the old type
//when merging changes back in
- var filterTypeReplaced = filter.model[filter.type] !== mergedFilter[filter.type];
+ let filterTypeReplaced = filter.model[filter.type] !== mergedFilter[filter.type];
if (filterTypeReplaced) {
delete mergedFilter[filter.type];
}
@@ -124,7 +124,7 @@ export default function (Private, $rootScope, getAppState, globalState, config)
* Removes all filters
*/
queryFilter.removeAll = function () {
- var appState = getAppState();
+ let appState = getAppState();
appState.filters = [];
globalState.filters = [];
};
@@ -137,7 +137,7 @@ export default function (Private, $rootScope, getAppState, globalState, config)
*/
queryFilter.toggleFilter = function (filter, force) {
// Toggle the disabled flag
- var disabled = _.isUndefined(force) ? !filter.meta.disabled : !!force;
+ let disabled = _.isUndefined(force) ? !filter.meta.disabled : !!force;
filter.meta.disabled = disabled;
return filter;
};
@@ -182,20 +182,20 @@ export default function (Private, $rootScope, getAppState, globalState, config)
* @returns {object} updated filter
*/
queryFilter.pinFilter = function (filter, force) {
- var appState = getAppState();
+ let appState = getAppState();
if (!appState) return filter;
// ensure that both states have a filters property
if (!_.isArray(globalState.filters)) globalState.filters = [];
if (!_.isArray(appState.filters)) appState.filters = [];
- var appIndex = _.indexOf(appState.filters, filter);
+ let appIndex = _.indexOf(appState.filters, filter);
if (appIndex !== -1 && force !== false) {
appState.filters.splice(appIndex, 1);
globalState.filters.push(filter);
} else {
- var globalIndex = _.indexOf(globalState.filters, filter);
+ let globalIndex = _.indexOf(globalState.filters, filter);
if (globalIndex === -1 || force === true) return filter;
@@ -226,7 +226,7 @@ export default function (Private, $rootScope, getAppState, globalState, config)
* Rids filter list of null values and replaces state if any nulls are found
*/
function validateStateFilters(state) {
- var compacted = _.compact(state.filters);
+ let compacted = _.compact(state.filters);
if (state.filters.length !== compacted.length) {
state.filters = compacted;
state.replace();
@@ -240,7 +240,7 @@ export default function (Private, $rootScope, getAppState, globalState, config)
* @returns {object} Resulting filter list, app and global combined
*/
function saveState() {
- var appState = getAppState();
+ let appState = getAppState();
if (appState) appState.save();
globalState.save();
}
@@ -256,9 +256,9 @@ export default function (Private, $rootScope, getAppState, globalState, config)
// helper to run a function on all filters in all states
function executeOnFilters(fn) {
- var appState = getAppState();
- var globalFilters = [];
- var appFilters = [];
+ let appState = getAppState();
+ let globalFilters = [];
+ let appFilters = [];
if (globalState.filters) globalFilters = globalState.filters;
if (appState && appState.filters) appFilters = appState.filters;
@@ -268,13 +268,13 @@ export default function (Private, $rootScope, getAppState, globalState, config)
function mergeStateFilters(gFilters, aFilters, compareOptions) {
// ensure we don't mutate the filters passed in
- var globalFilters = gFilters ? _.cloneDeep(gFilters) : [];
- var appFilters = aFilters ? _.cloneDeep(aFilters) : [];
+ let globalFilters = gFilters ? _.cloneDeep(gFilters) : [];
+ let appFilters = aFilters ? _.cloneDeep(aFilters) : [];
compareOptions = _.defaults(compareOptions || {}, { disabled: true });
// existing globalFilters should be mutated by appFilters
_.each(appFilters, function (filter, i) {
- var match = _.find(globalFilters, function (globalFilter) {
+ let match = _.find(globalFilters, function (globalFilter) {
return compareFilters(globalFilter, filter, compareOptions);
});
@@ -306,7 +306,7 @@ export default function (Private, $rootScope, getAppState, globalState, config)
function initAppStateWatchers() {
// multi watch on the app and global states
- var stateWatchers = [{
+ let stateWatchers = [{
fn: $rootScope.$watch,
deep: true,
get: queryFilter.getGlobalFilters
@@ -321,18 +321,18 @@ export default function (Private, $rootScope, getAppState, globalState, config)
// prevent execution on watcher instantiation
if (_.isEqual(next, prev)) return;
- var doUpdate = false;
- var doFetch = false;
+ let doUpdate = false;
+ let doFetch = false;
// reconcile filter in global and app states
- var filters = mergeStateFilters(next[0], next[1]);
- var globalFilters = filters[0];
- var appFilters = filters[1];
- var appState = getAppState();
+ let filters = mergeStateFilters(next[0], next[1]);
+ let globalFilters = filters[0];
+ let appFilters = filters[1];
+ let appState = getAppState();
// save the state, as it may have updated
- var globalChanged = !_.isEqual(next[0], globalFilters);
- var appChanged = !_.isEqual(next[1], appFilters);
+ let globalChanged = !_.isEqual(next[0], globalFilters);
+ let appChanged = !_.isEqual(next[1], appFilters);
// the filters were changed, apply to state (re-triggers this watcher)
if (globalChanged || appChanged) {
@@ -355,12 +355,12 @@ export default function (Private, $rootScope, getAppState, globalState, config)
// iterate over each state type, checking for changes
function getActions() {
- var newFilters = [];
- var oldFilters = [];
+ let newFilters = [];
+ let oldFilters = [];
stateWatchers.forEach(function (watcher, i) {
- var nextVal = next[i];
- var prevVal = prev[i];
+ let nextVal = next[i];
+ let prevVal = prev[i];
newFilters = newFilters.concat(nextVal);
oldFilters = oldFilters.concat(prevVal);
diff --git a/src/ui/public/filter_manager/filter_manager.js b/src/ui/public/filter_manager/filter_manager.js
index 9f4584fdb91aa..e6c93fbf8a311 100644
--- a/src/ui/public/filter_manager/filter_manager.js
+++ b/src/ui/public/filter_manager/filter_manager.js
@@ -2,21 +2,21 @@ import _ from 'lodash';
import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter';
// Adds a filter to a passed state
export default function (Private) {
- var queryFilter = Private(FilterBarQueryFilterProvider);
- var filterManager = {};
+ let queryFilter = Private(FilterBarQueryFilterProvider);
+ let filterManager = {};
filterManager.add = function (field, values, operation, index) {
values = _.isArray(values) ? values : [values];
- var fieldName = _.isObject(field) ? field.name : field;
- var filters = _.flatten([queryFilter.getAppFilters()]);
- var newFilters = [];
+ let fieldName = _.isObject(field) ? field.name : field;
+ let filters = _.flatten([queryFilter.getAppFilters()]);
+ let newFilters = [];
- var negate = (operation === '-');
+ let negate = (operation === '-');
// TODO: On array fields, negating does not negate the combination, rather all terms
_.each(values, function (value) {
let filter;
- var existing = _.find(filters, function (filter) {
+ let existing = _.find(filters, function (filter) {
if (!filter) return;
if (fieldName === '_exists_' && filter.exists) {
diff --git a/src/ui/public/filter_manager/lib/phrase.js b/src/ui/public/filter_manager/lib/phrase.js
index 2fcd3cb18c053..9cbde5b2ca0b2 100644
--- a/src/ui/public/filter_manager/lib/phrase.js
+++ b/src/ui/public/filter_manager/lib/phrase.js
@@ -1,6 +1,6 @@
import _ from 'lodash';
export default function buildPhraseFilter(field, value, indexPattern) {
- var filter = { meta: { index: indexPattern.id} };
+ let filter = { meta: { index: indexPattern.id} };
if (field.scripted) {
filter.script = {
diff --git a/src/ui/public/filters/_prop_filter.js b/src/ui/public/filters/_prop_filter.js
index fca3db02af928..19d817df80662 100644
--- a/src/ui/public/filters/_prop_filter.js
+++ b/src/ui/public/filters/_prop_filter.js
@@ -23,9 +23,9 @@ function propFilter(prop) {
if (!_.isArray(filters)) filters = filters.split(',');
if (_.contains(filters, '*')) return list;
- var options = filters.reduce(function (options, filter) {
- var type = 'include';
- var value = filter;
+ let options = filters.reduce(function (options, filter) {
+ let type = 'include';
+ let value = filter;
if (filter.charAt(0) === '!') {
type = 'exclude';
@@ -38,12 +38,12 @@ function propFilter(prop) {
}, {});
return list.filter(function (item) {
- var value = item[prop];
+ let value = item[prop];
- var excluded = options.exclude && _.contains(options.exclude, value);
+ let excluded = options.exclude && _.contains(options.exclude, value);
if (excluded) return false;
- var included = !options.include || _.contains(options.include, value);
+ let included = !options.include || _.contains(options.include, value);
if (included) return true;
return false;
diff --git a/src/ui/public/filters/comma_list.js b/src/ui/public/filters/comma_list.js
index 12acb8daa6602..febe90384585f 100644
--- a/src/ui/public/filters/comma_list.js
+++ b/src/ui/public/filters/comma_list.js
@@ -13,12 +13,12 @@ uiModules
* @return {String}
*/
return function (input, inclusive) {
- var list = _.commaSeperatedList(input);
+ let list = _.commaSeperatedList(input);
if (list.length < 2) {
return list.join('');
}
- var conj = inclusive ? ' and ' : ' or ';
+ let conj = inclusive ? ' and ' : ' or ';
return list.slice(0, -1).join(', ') + conj + _.last(list);
};
diff --git a/src/ui/public/filters/match_any.js b/src/ui/public/filters/match_any.js
index e9659b5c109be..5d7ff8329091c 100644
--- a/src/ui/public/filters/match_any.js
+++ b/src/ui/public/filters/match_any.js
@@ -13,7 +13,7 @@ uiModules
}
return _.filter(items, function (item) {
- for (var i = 0; i < rules.length; i++) {
+ for (let i = 0; i < rules.length; i++) {
if (_.some([item], rules[i])) {
return true;
}
diff --git a/src/ui/public/filters/moment.js b/src/ui/public/filters/moment.js
index c6bdc61decde8..9209709a395d2 100644
--- a/src/ui/public/filters/moment.js
+++ b/src/ui/public/filters/moment.js
@@ -6,7 +6,7 @@ uiModules
.get('kibana')
.filter('moment', function (config) {
return function (datetime) {
- var format = config.get('dateFormat');
+ let format = config.get('dateFormat');
if (moment.isMoment(datetime)) return datetime.format(format);
if (_.isDate(datetime)) return moment(datetime).format(format);
return datetime;
diff --git a/src/ui/public/filters/rison.js b/src/ui/public/filters/rison.js
index 9b5c5433ff4ad..f88a05c2e19d8 100644
--- a/src/ui/public/filters/rison.js
+++ b/src/ui/public/filters/rison.js
@@ -1,6 +1,6 @@
import rison from 'ui/utils/rison';
import uiModules from 'ui/modules';
-var module = uiModules.get('kibana');
+let module = uiModules.get('kibana');
module.filter('rison', function () {
return function (str) {
diff --git a/src/ui/public/filters/trust_as_html.js b/src/ui/public/filters/trust_as_html.js
index 046f30de6cbf8..e622294557d33 100644
--- a/src/ui/public/filters/trust_as_html.js
+++ b/src/ui/public/filters/trust_as_html.js
@@ -1,6 +1,6 @@
import angular from 'angular';
import uiModules from 'ui/modules';
-var module = uiModules.get('kibana');
+let module = uiModules.get('kibana');
// Simple filter to allow using ng-bind-html without explicitly calling $sce.trustAsHtml in a controller
// (See http://goo.gl/mpj9o2)
diff --git a/src/ui/public/filters/unique.js b/src/ui/public/filters/unique.js
index 15948bbda7bea..643ae819f591d 100644
--- a/src/ui/public/filters/unique.js
+++ b/src/ui/public/filters/unique.js
@@ -6,7 +6,7 @@ uiModules
.get('kibana')
.filter('unique', function () {
return function (arr) {
- var list = _.unique(arr);
+ let list = _.unique(arr);
return list;
};
});
diff --git a/src/ui/public/highlight/highlight.js b/src/ui/public/highlight/highlight.js
index a7660f1f3a801..f51a3ae2bfb52 100644
--- a/src/ui/public/highlight/highlight.js
+++ b/src/ui/public/highlight/highlight.js
@@ -3,7 +3,7 @@ import _ from 'lodash';
import angular from 'angular';
import uiModules from 'ui/modules';
-var module = uiModules.get('kibana');
+let module = uiModules.get('kibana');
module.filter('highlight', function (highlightTags) {
return function (formatted, highlight) {
@@ -13,12 +13,12 @@ module.filter('highlight', function (highlightTags) {
section = _.escape(section);
// Strip out the highlight tags to compare against the formatted string
- var untagged = section
+ let untagged = section
.split(highlightTags.pre).join('')
.split(highlightTags.post).join('');
// Replace all highlight tags with proper html tags
- var tagged = section
+ let tagged = section
.split(highlightTags.pre).join('')
.split(highlightTags.post).join('');
diff --git a/src/ui/public/highlight/highlight_tags.js b/src/ui/public/highlight/highlight_tags.js
index f47a4d696bc86..350357ec35b59 100644
--- a/src/ui/public/highlight/highlight_tags.js
+++ b/src/ui/public/highlight/highlight_tags.js
@@ -1,5 +1,5 @@
import uiModules from 'ui/modules';
-var module = uiModules.get('kibana');
+let module = uiModules.get('kibana');
// By default, ElasticSearch surrounds matched values in . This is not ideal because it is possible that
// the value could contain in the value. We define these custom tags that we would never expect to see
diff --git a/src/ui/public/index_patterns/_cast_mapping_type.js b/src/ui/public/index_patterns/_cast_mapping_type.js
index 1453fa88b7259..760a67255a194 100644
--- a/src/ui/public/index_patterns/_cast_mapping_type.js
+++ b/src/ui/public/index_patterns/_cast_mapping_type.js
@@ -34,7 +34,7 @@ export default function CastMappingTypeFn() {
function castMappingType(name) {
if (!name) return 'unknown';
- var match = castMappingType.types.byName[name];
+ let match = castMappingType.types.byName[name];
return match ? match.type : 'string';
}
diff --git a/src/ui/public/index_patterns/_ensure_some.js b/src/ui/public/index_patterns/_ensure_some.js
index 60e0f643809a5..ec97f3874926c 100644
--- a/src/ui/public/index_patterns/_ensure_some.js
+++ b/src/ui/public/index_patterns/_ensure_some.js
@@ -1,6 +1,6 @@
import errors from 'ui/errors';
export default function EnsureSomeIndexPatternsFn(Private, Notifier, $location, kbnUrl) {
- var notify = new Notifier();
+ let notify = new Notifier();
return function ensureSomeIndexPatterns() {
return function promiseHandler(patterns) {
diff --git a/src/ui/public/index_patterns/_field.js b/src/ui/public/index_patterns/_field.js
index d20b23625dff3..a0c4e6a0cba98 100644
--- a/src/ui/public/index_patterns/_field.js
+++ b/src/ui/public/index_patterns/_field.js
@@ -3,10 +3,10 @@ import IndexPatternsFieldFormatFieldFormatProvider from 'ui/index_patterns/_fiel
import IndexPatternsFieldTypesProvider from 'ui/index_patterns/_field_types';
import RegistryFieldFormatsProvider from 'ui/registry/field_formats';
export default function FieldObjectProvider(Private, shortDotsFilter, $rootScope, Notifier) {
- var notify = new Notifier({ location: 'IndexPattern Field' });
- var FieldFormat = Private(IndexPatternsFieldFormatFieldFormatProvider);
- var fieldTypes = Private(IndexPatternsFieldTypesProvider);
- var fieldFormats = Private(RegistryFieldFormatsProvider);
+ let notify = new Notifier({ location: 'IndexPattern Field' });
+ let FieldFormat = Private(IndexPatternsFieldFormatFieldFormatProvider);
+ let fieldTypes = Private(IndexPatternsFieldTypesProvider);
+ let fieldFormats = Private(RegistryFieldFormatsProvider);
function Field(indexPattern, spec) {
// unwrap old instances of Field
@@ -15,14 +15,14 @@ export default function FieldObjectProvider(Private, shortDotsFilter, $rootScope
// constuct this object using ObjDefine class, which
// extends the Field.prototype but gets it's properties
// defined using the logic below
- var obj = new ObjDefine(spec, Field.prototype);
+ let obj = new ObjDefine(spec, Field.prototype);
if (spec.name === '_source') {
spec.type = '_source';
}
// find the type for this field, fallback to unknown type
- var type = fieldTypes.byName[spec.type];
+ let type = fieldTypes.byName[spec.type];
if (spec.type && !type) {
notify.error(
'Unknown field type "' + spec.type + '"' +
@@ -33,15 +33,15 @@ export default function FieldObjectProvider(Private, shortDotsFilter, $rootScope
if (!type) type = fieldTypes.byName.unknown;
- var format = spec.format;
+ let format = spec.format;
if (!format || !(format instanceof FieldFormat)) {
format = indexPattern.fieldFormatMap[spec.name] || fieldFormats.getDefaultInstance(spec.type);
}
- var indexed = !!spec.indexed;
- var scripted = !!spec.scripted;
- var sortable = spec.name === '_score' || ((indexed || scripted) && type.sortable);
- var filterable = spec.name === '_id' || scripted || (indexed && type.filterable);
+ let indexed = !!spec.indexed;
+ let scripted = !!spec.scripted;
+ let sortable = spec.name === '_score' || ((indexed || scripted) && type.sortable);
+ let filterable = spec.name === '_id' || scripted || (indexed && type.filterable);
obj.fact('name');
obj.fact('type');
diff --git a/src/ui/public/index_patterns/_field_format/content_types.js b/src/ui/public/index_patterns/_field_format/content_types.js
index a49f1d3ad6742..ed82f0210c1f0 100644
--- a/src/ui/public/index_patterns/_field_format/content_types.js
+++ b/src/ui/public/index_patterns/_field_format/content_types.js
@@ -3,7 +3,7 @@ import angular from 'angular';
import 'ui/highlight';
export default function contentTypesProvider(highlightFilter) {
- var types = {
+ let types = {
html: function (format, convert) {
return function recurse(value, field, hit) {
if (value == null) {
@@ -14,10 +14,10 @@ export default function contentTypesProvider(highlightFilter) {
return convert.call(format, value, field, hit);
}
- var subVals = value.map(function (v) {
+ let subVals = value.map(function (v) {
return recurse(v, field, hit);
});
- var useMultiLine = subVals.some(function (sub) {
+ let useMultiLine = subVals.some(function (sub) {
return sub.indexOf('\n') > -1;
});
@@ -42,7 +42,7 @@ export default function contentTypesProvider(highlightFilter) {
}
function fallbackHtml(value, field, hit) {
- var formatted = _.escape(this.convert(value, 'text'));
+ let formatted = _.escape(this.convert(value, 'text'));
if (!hit || !hit.highlight || !hit.highlight[field.name]) {
return formatted;
@@ -52,8 +52,8 @@ export default function contentTypesProvider(highlightFilter) {
}
function setup(format) {
- var src = format._convert || {};
- var converters = format._convert = {};
+ let src = format._convert || {};
+ let converters = format._convert = {};
converters.text = types.text(format, src.text || fallbackText);
converters.html = types.html(format, src.html || fallbackHtml);
diff --git a/src/ui/public/index_patterns/_field_format/field_format.js b/src/ui/public/index_patterns/_field_format/field_format.js
index cca0fb1ef4741..53b48c69985bd 100644
--- a/src/ui/public/index_patterns/_field_format/field_format.js
+++ b/src/ui/public/index_patterns/_field_format/field_format.js
@@ -1,10 +1,10 @@
import _ from 'lodash';
import IndexPatternsFieldFormatContentTypesProvider from 'ui/index_patterns/_field_format/content_types';
export default function FieldFormatClassProvider(config, $rootScope, Private) {
- var contentTypes = Private(IndexPatternsFieldFormatContentTypesProvider);
+ let contentTypes = Private(IndexPatternsFieldFormatContentTypesProvider);
function FieldFormat(params) {
- var self = this;
+ let self = this;
// give the constructor a more appropriate name
self.type = self.constructor;
@@ -59,7 +59,7 @@ export default function FieldFormatClassProvider(config, $rootScope, Private) {
* @return {any}
*/
FieldFormat.prototype.param = function (name) {
- var val = this._params[name];
+ let val = this._params[name];
if (val || val === false || val === 0) {
// truthy, false, or 0 are fine
// '', NaN, null, undefined, etc are not
@@ -84,10 +84,10 @@ export default function FieldFormatClassProvider(config, $rootScope, Private) {
* @return {object}
*/
FieldFormat.prototype.toJSON = function () {
- var type = this.type;
- var defaults = this._paramDefaults;
+ let type = this.type;
+ let defaults = this._paramDefaults;
- var params = _.transform(this._params, function (uniqParams, val, param) {
+ let params = _.transform(this._params, function (uniqParams, val, param) {
if (val !== defaults[param]) {
uniqParams[param] = val;
}
diff --git a/src/ui/public/index_patterns/_field_list.js b/src/ui/public/index_patterns/_field_list.js
index a55c27ad504ca..438159f334de6 100644
--- a/src/ui/public/index_patterns/_field_list.js
+++ b/src/ui/public/index_patterns/_field_list.js
@@ -2,7 +2,7 @@ import IndexedArray from 'ui/indexed_array';
import _ from 'lodash';
import IndexPatternsFieldProvider from 'ui/index_patterns/_field';
export default function FieldListProvider(Private) {
- var Field = Private(IndexPatternsFieldProvider);
+ let Field = Private(IndexPatternsFieldProvider);
_.class(FieldList).inherits(IndexedArray);
function FieldList(indexPattern, specs) {
diff --git a/src/ui/public/index_patterns/_flatten_hit.js b/src/ui/public/index_patterns/_flatten_hit.js
index 322d30234e585..9a09422c58c23 100644
--- a/src/ui/public/index_patterns/_flatten_hit.js
+++ b/src/ui/public/index_patterns/_flatten_hit.js
@@ -3,16 +3,16 @@ import _ from 'lodash';
// returns a flattened version
export default function FlattenHitProvider(config, $rootScope) {
- var metaFields = config.get('metaFields');
+ let metaFields = config.get('metaFields');
$rootScope.$on('change:config.metaFields', function () {
metaFields = config.get('metaFields');
});
function flattenHit(indexPattern, hit) {
- var flat = {};
+ let flat = {};
// recursively merge _source
- var fields = indexPattern.fields.byName;
+ let fields = indexPattern.fields.byName;
(function flatten(obj, keyPrefix) {
keyPrefix = keyPrefix ? keyPrefix + '.' : '';
_.forOwn(obj, function (val, key) {
@@ -20,8 +20,8 @@ export default function FlattenHitProvider(config, $rootScope) {
if (flat[key] !== void 0) return;
- var hasValidMapping = (fields[key] && fields[key].type !== 'conflict');
- var isValue = !_.isPlainObject(val);
+ let hasValidMapping = (fields[key] && fields[key].type !== 'conflict');
+ let isValue = !_.isPlainObject(val);
if (hasValidMapping || isValue) {
flat[key] = val;
diff --git a/src/ui/public/index_patterns/_format_hit.js b/src/ui/public/index_patterns/_format_hit.js
index b2bdbfde6faa4..d188952f33532 100644
--- a/src/ui/public/index_patterns/_format_hit.js
+++ b/src/ui/public/index_patterns/_format_hit.js
@@ -5,7 +5,7 @@ import _ from 'lodash';
export default function (indexPattern, defaultFormat) {
function convert(hit, val, fieldName) {
- var field = indexPattern.fields.byName[fieldName];
+ let field = indexPattern.fields.byName[fieldName];
if (!field) return defaultFormat.convert(val, 'html');
return field.format.getConverterFor('html')(val, field, hit);
}
@@ -15,12 +15,12 @@ export default function (indexPattern, defaultFormat) {
// use and update the partial cache, but don't rewrite it. _source is stored in partials
// but not $$_formatted
- var partials = hit.$$_partialFormatted || (hit.$$_partialFormatted = {});
- var cache = hit.$$_formatted = {};
+ let partials = hit.$$_partialFormatted || (hit.$$_partialFormatted = {});
+ let cache = hit.$$_formatted = {};
_.forOwn(indexPattern.flattenHit(hit), function (val, fieldName) {
// sync the formatted and partial cache
- var formatted = partials[fieldName] == null ? convert(hit, val, fieldName) : partials[fieldName];
+ let formatted = partials[fieldName] == null ? convert(hit, val, fieldName) : partials[fieldName];
cache[fieldName] = partials[fieldName] = formatted;
});
@@ -28,7 +28,7 @@ export default function (indexPattern, defaultFormat) {
}
formatHit.formatField = function (hit, fieldName) {
- var partials = hit.$$_partialFormatted;
+ let partials = hit.$$_partialFormatted;
if (partials && partials[fieldName] != null) {
return partials[fieldName];
}
@@ -37,7 +37,7 @@ export default function (indexPattern, defaultFormat) {
partials = hit.$$_partialFormatted = {};
}
- var val = fieldName === '_source' ? hit._source : indexPattern.flattenHit(hit)[fieldName];
+ let val = fieldName === '_source' ? hit._source : indexPattern.flattenHit(hit)[fieldName];
return partials[fieldName] = convert(hit, val, fieldName);
};
diff --git a/src/ui/public/index_patterns/_get_computed_fields.js b/src/ui/public/index_patterns/_get_computed_fields.js
index a7ce11bd044ac..f56f9af492a2d 100644
--- a/src/ui/public/index_patterns/_get_computed_fields.js
+++ b/src/ui/public/index_patterns/_get_computed_fields.js
@@ -2,9 +2,9 @@ import _ from 'lodash';
// Takes a hit, merges it with any stored/scripted fields, and with the metaFields
// returns a flattened version
export default function () {
- var self = this;
- var scriptFields = {};
- var fielddataFields = [];
+ let self = this;
+ let scriptFields = {};
+ let fielddataFields = [];
fielddataFields = _.pluck(self.fields.byType.date, 'name');
diff --git a/src/ui/public/index_patterns/_get_ids.js b/src/ui/public/index_patterns/_get_ids.js
index a02d338f95d10..3f8ce6a716e16 100644
--- a/src/ui/public/index_patterns/_get_ids.js
+++ b/src/ui/public/index_patterns/_get_ids.js
@@ -5,7 +5,7 @@ export default function GetIndexPatternIdsFn(es, kbnIndex) {
// didn't incorportate with the indexPattern cache to prevent id collisions.
let cachedPromise;
- var getIds = function () {
+ let getIds = function () {
if (cachedPromise) {
// retrun a clone of the cached response
return cachedPromise.then(function (cachedResp) {
diff --git a/src/ui/public/index_patterns/_index_pattern.js b/src/ui/public/index_patterns/_index_pattern.js
index 5cf219dbc67d1..4a724afc8c1d1 100644
--- a/src/ui/public/index_patterns/_index_pattern.js
+++ b/src/ui/public/index_patterns/_index_pattern.js
@@ -15,23 +15,23 @@ import IndexPatternsCalculateIndicesProvider from 'ui/index_patterns/_calculate_
import IndexPatternsPatternCacheProvider from 'ui/index_patterns/_pattern_cache';
export default function IndexPatternFactory(Private, timefilter, Notifier, config, kbnIndex, Promise, $rootScope, safeConfirm) {
- var fieldformats = Private(RegistryFieldFormatsProvider);
- var getIds = Private(IndexPatternsGetIdsProvider);
- var mapper = Private(IndexPatternsMapperProvider);
- var intervals = Private(IndexPatternsIntervalsProvider);
- var DocSource = Private(DocSourceProvider);
- var mappingSetup = Private(UtilsMappingSetupProvider);
- var FieldList = Private(IndexPatternsFieldListProvider);
+ let fieldformats = Private(RegistryFieldFormatsProvider);
+ let getIds = Private(IndexPatternsGetIdsProvider);
+ let mapper = Private(IndexPatternsMapperProvider);
+ let intervals = Private(IndexPatternsIntervalsProvider);
+ let DocSource = Private(DocSourceProvider);
+ let mappingSetup = Private(UtilsMappingSetupProvider);
+ let FieldList = Private(IndexPatternsFieldListProvider);
- var flattenHit = Private(IndexPatternsFlattenHitProvider);
- var calculateIndices = Private(IndexPatternsCalculateIndicesProvider);
- var patternCache = Private(IndexPatternsPatternCacheProvider);
+ let flattenHit = Private(IndexPatternsFlattenHitProvider);
+ let calculateIndices = Private(IndexPatternsCalculateIndicesProvider);
+ let patternCache = Private(IndexPatternsPatternCacheProvider);
- var type = 'index-pattern';
+ let type = 'index-pattern';
- var notify = new Notifier();
+ let notify = new Notifier();
- var mapping = mappingSetup.expandShorthand({
+ let mapping = mappingSetup.expandShorthand({
title: 'string',
timeFieldName: 'string',
notExpandable: 'boolean',
@@ -42,8 +42,8 @@ export default function IndexPatternFactory(Private, timefilter, Notifier, confi
_serialize: function (map) {
if (map == null) return;
- var count = 0;
- var serialized = _.transform(map, function (flat, format, field) {
+ let count = 0;
+ let serialized = _.transform(map, function (flat, format, field) {
if (!format) return;
count++;
flat[field] = format;
@@ -54,7 +54,7 @@ export default function IndexPatternFactory(Private, timefilter, Notifier, confi
_deserialize: function (map) {
if (map == null) return {};
return _.mapValues(angular.fromJson(map), function (mapping) {
- var FieldFormat = fieldformats.byId[mapping.id];
+ let FieldFormat = fieldformats.byId[mapping.id];
return FieldFormat && new FieldFormat(mapping.params);
});
}
@@ -62,11 +62,11 @@ export default function IndexPatternFactory(Private, timefilter, Notifier, confi
});
function IndexPattern(id) {
- var self = this;
+ let self = this;
setId(id);
- var docSource = new DocSource();
+ let docSource = new DocSource();
self.init = function () {
// tell the docSource where to find the doc
@@ -134,7 +134,7 @@ export default function IndexPatternFactory(Private, timefilter, Notifier, confi
self.addScriptedField = function (name, script, type, lang) {
type = type || 'string';
- var scriptFields = _.pluck(self.getScriptedFields(), 'name');
+ let scriptFields = _.pluck(self.getScriptedFields(), 'name');
if (_.contains(scriptFields, name)) {
throw new errors.DuplicateField(name);
@@ -152,7 +152,7 @@ export default function IndexPatternFactory(Private, timefilter, Notifier, confi
};
self.removeScriptedField = function (name) {
- var fieldIndex = _.findIndex(self.fields, {
+ let fieldIndex = _.findIndex(self.fields, {
name: name,
scripted: true
});
@@ -165,10 +165,10 @@ export default function IndexPatternFactory(Private, timefilter, Notifier, confi
self.popularizeField = function (fieldName, unit) {
if (unit == null) unit = 1;
- var field = _.get(self, ['fields', 'byName', fieldName]);
+ let field = _.get(self, ['fields', 'byName', fieldName]);
if (!field) return;
- var count = Math.max((field.count || 0) + unit, 0);
+ let count = Math.max((field.count || 0) + unit, 0);
if (field.count !== count) {
field.count = count;
self.save();
@@ -200,7 +200,7 @@ export default function IndexPatternFactory(Private, timefilter, Notifier, confi
};
self.toDetailedIndexList = Promise.method(function (start, stop, sortDirection) {
- var interval = self.getInterval();
+ let interval = self.getInterval();
if (interval) {
return intervals.toIndexList(self.id, interval, start, stop, sortDirection);
@@ -230,7 +230,7 @@ export default function IndexPatternFactory(Private, timefilter, Notifier, confi
};
self.prepBody = function () {
- var body = {};
+ let body = {};
// serialize json fields
_.forOwn(mapping, function (fieldMapping, fieldName) {
@@ -254,12 +254,12 @@ export default function IndexPatternFactory(Private, timefilter, Notifier, confi
}
self.create = function () {
- var body = self.prepBody();
+ let body = self.prepBody();
return docSource.doCreate(body)
.then(setId)
.catch(function (err) {
if (_.get(err, 'origError.status') === 409) {
- var confirmMessage = 'Are you sure you want to overwrite this?';
+ let confirmMessage = 'Are you sure you want to overwrite this?';
return safeConfirm(confirmMessage).then(
function () {
@@ -280,7 +280,7 @@ export default function IndexPatternFactory(Private, timefilter, Notifier, confi
};
self.save = function () {
- var body = self.prepBody();
+ let body = self.prepBody();
return docSource.doIndex(body).then(setId);
};
diff --git a/src/ui/public/index_patterns/_intervals.js b/src/ui/public/index_patterns/_intervals.js
index a58a4dccb2668..89617306db719 100644
--- a/src/ui/public/index_patterns/_intervals.js
+++ b/src/ui/public/index_patterns/_intervals.js
@@ -3,7 +3,7 @@ import moment from 'moment';
import IndexedArray from 'ui/indexed_array';
export default function IndexNameIntervalsService(timefilter) {
- var intervals = new IndexedArray({
+ let intervals = new IndexedArray({
index: ['name'],
initialSet: [
{
@@ -40,10 +40,10 @@ export default function IndexNameIntervalsService(timefilter) {
// setup the range that the list will span, return two moment objects that
// are in proper order. a and b can be numbers to specify to go before or after now (respectively)
// a certain number of times, based on the interval
- var range = [[a, 'min', 'startOf'], [b, 'max', 'startOf']].map(function (v) {
- var val = v[0];
- var bound = v[1];
- var extend = v[2];
+ let range = [[a, 'min', 'startOf'], [b, 'max', 'startOf']].map(function (v) {
+ let val = v[0];
+ let bound = v[1];
+ let extend = v[2];
// grab a bound from the time filter
if (val == null) {
@@ -64,12 +64,12 @@ export default function IndexNameIntervalsService(timefilter) {
if (!interval) throw new Error('Interval must be one of ' + _.pluck(intervals, 'name'));
}
- var indexList = [];
- var start = range.shift();
+ let indexList = [];
+ let start = range.shift();
// turn stop into milliseconds to that it's not constantly converted by the while condition
- var stop = range.shift().valueOf();
+ let stop = range.shift().valueOf();
- var add = sortDirection === 'desc' ? 'unshift' : 'push';
+ let add = sortDirection === 'desc' ? 'unshift' : 'push';
while (start <= stop) {
const index = start.format(format);
diff --git a/src/ui/public/index_patterns/_local_cache.js b/src/ui/public/index_patterns/_local_cache.js
index b00a34aeb17dc..64ec26847600a 100644
--- a/src/ui/public/index_patterns/_local_cache.js
+++ b/src/ui/public/index_patterns/_local_cache.js
@@ -4,17 +4,17 @@ import angular from 'angular';
export default function LocalCacheFactory() {
function LocalCache(opts) {
opts = opts || {};
- var _id = opts.id || function (o) { return '' + o; };
- var _cache = {};
+ let _id = opts.id || function (o) { return '' + o; };
+ let _cache = {};
this.get = function (obj) {
- var id = _id(obj);
+ let id = _id(obj);
return _cache[id] ? JSON.parse(_cache[id]) : null;
};
this.set = function (obj, val) {
- var id = _id(obj);
- var clean = !_cache.hasOwnProperty(id);
+ let id = _id(obj);
+ let clean = !_cache.hasOwnProperty(id);
_cache[id] = angular.toJson(val);
return clean;
};
@@ -25,7 +25,7 @@ export default function LocalCacheFactory() {
return;
}
- var id = _id(obj);
+ let id = _id(obj);
delete _cache[id];
};
}
diff --git a/src/ui/public/index_patterns/_map_field.js b/src/ui/public/index_patterns/_map_field.js
index 9bcb59aeff118..b4d3a4aa42f78 100644
--- a/src/ui/public/index_patterns/_map_field.js
+++ b/src/ui/public/index_patterns/_map_field.js
@@ -1,7 +1,7 @@
import _ from 'lodash';
import IndexPatternsCastMappingTypeProvider from 'ui/index_patterns/_cast_mapping_type';
export default function MapFieldFn(Private, config) {
- var castMappingType = Private(IndexPatternsCastMappingTypeProvider);
+ let castMappingType = Private(IndexPatternsCastMappingTypeProvider);
/**
* Accepts a field object and its name, and tries to give it a mapping
@@ -10,11 +10,11 @@ export default function MapFieldFn(Private, config) {
* @return {Object} - the resulting field after overrides and tweaking
*/
return function mapField(field, name) {
- var keys = Object.keys(field.mapping);
+ let keys = Object.keys(field.mapping);
if (keys.length === 0 || (name[0] === '_') && !_.contains(config.get('metaFields'), name)) return;
// Override the mapping, even if elasticsearch says otherwise
- var mappingOverrides = {
+ let mappingOverrides = {
_source: { type: '_source' },
_index: { type: 'string' },
_type: { type: 'string' },
@@ -29,7 +29,7 @@ export default function MapFieldFn(Private, config) {
}
};
- var mapping = _.cloneDeep(field.mapping[keys.shift()]);
+ let mapping = _.cloneDeep(field.mapping[keys.shift()]);
if (!mapping.index || mapping.index === 'no') {
// elasticsearch responds with false sometimes and 'no' others
diff --git a/src/ui/public/index_patterns/_mapper.js b/src/ui/public/index_patterns/_mapper.js
index 16bdce7d4958b..0ee8984327749 100644
--- a/src/ui/public/index_patterns/_mapper.js
+++ b/src/ui/public/index_patterns/_mapper.js
@@ -7,19 +7,19 @@ import IndexPatternsPatternToWildcardProvider from 'ui/index_patterns/_pattern_t
import IndexPatternsLocalCacheProvider from 'ui/index_patterns/_local_cache';
export default function MapperService(Private, Promise, es, config, kbnIndex) {
- var transformMappingIntoFields = Private(IndexPatternsTransformMappingIntoFieldsProvider);
- var intervals = Private(IndexPatternsIntervalsProvider);
- var patternToWildcard = Private(IndexPatternsPatternToWildcardProvider);
+ let transformMappingIntoFields = Private(IndexPatternsTransformMappingIntoFieldsProvider);
+ let intervals = Private(IndexPatternsIntervalsProvider);
+ let patternToWildcard = Private(IndexPatternsPatternToWildcardProvider);
- var LocalCache = Private(IndexPatternsLocalCacheProvider);
+ let LocalCache = Private(IndexPatternsLocalCacheProvider);
function Mapper() {
// Save a reference to mapper
- var self = this;
+ let self = this;
// proper-ish cache, keeps a clean copy of the object, only returns copies of it's copy
- var fieldCache = self.cache = new LocalCache();
+ let fieldCache = self.cache = new LocalCache();
/**
* Gets an object containing all fields with their mappings
@@ -29,9 +29,9 @@ export default function MapperService(Private, Promise, es, config, kbnIndex) {
* @async
*/
self.getFieldsForIndexPattern = function (indexPattern, skipIndexPatternCache) {
- var id = indexPattern.id;
+ let id = indexPattern.id;
- var cache = fieldCache.get(id);
+ let cache = fieldCache.get(id);
if (cache) return Promise.resolve(cache);
if (!skipIndexPatternCache) {
@@ -49,7 +49,7 @@ export default function MapperService(Private, Promise, es, config, kbnIndex) {
});
}
- var promise = Promise.resolve(id);
+ let promise = Promise.resolve(id);
if (indexPattern.intervalName) {
promise = self.getIndicesForIndexPattern(indexPattern)
.then(function (existing) {
@@ -80,8 +80,8 @@ export default function MapperService(Private, Promise, es, config, kbnIndex) {
index: patternToWildcard(indexPattern.id)
})
.then(function (resp) {
- // var all = Object.keys(resp).sort();
- var all = _(resp)
+ // let all = Object.keys(resp).sort();
+ let all = _(resp)
.map(function (index, key) {
if (index.aliases) {
return [Object.keys(index.aliases), key];
@@ -94,8 +94,8 @@ export default function MapperService(Private, Promise, es, config, kbnIndex) {
.uniq(true)
.value();
- var matches = all.filter(function (existingIndex) {
- var parsed = moment(existingIndex, indexPattern.id);
+ let matches = all.filter(function (existingIndex) {
+ let parsed = moment(existingIndex, indexPattern.id);
return existingIndex === parsed.format(indexPattern.id);
});
diff --git a/src/ui/public/index_patterns/_pattern_cache.js b/src/ui/public/index_patterns/_pattern_cache.js
index 5b6e205e316c3..e9f57f5188e0a 100644
--- a/src/ui/public/index_patterns/_pattern_cache.js
+++ b/src/ui/public/index_patterns/_pattern_cache.js
@@ -1,9 +1,9 @@
import _ from 'lodash';
export default function PatternCache() {
- var vals = {};
+ let vals = {};
- var validId = function (id) {
+ let validId = function (id) {
return typeof id !== 'object';
};
diff --git a/src/ui/public/index_patterns/_pattern_to_wildcard.js b/src/ui/public/index_patterns/_pattern_to_wildcard.js
index e9029fb78343c..447af376c807d 100644
--- a/src/ui/public/index_patterns/_pattern_to_wildcard.js
+++ b/src/ui/public/index_patterns/_pattern_to_wildcard.js
@@ -1,11 +1,11 @@
export default function PatternToWildcardFn() {
return function (format) {
- var wildcard = '';
- var inEscape = false;
- var inPattern = false;
+ let wildcard = '';
+ let inEscape = false;
+ let inPattern = false;
- for (var i = 0; i < format.length; i++) {
- var ch = format.charAt(i);
+ for (let i = 0; i < format.length; i++) {
+ let ch = format.charAt(i);
switch (ch) {
case '[':
inPattern = false;
diff --git a/src/ui/public/index_patterns/_transform_mapping_into_fields.js b/src/ui/public/index_patterns/_transform_mapping_into_fields.js
index 17c175bd348c6..059101e76695e 100644
--- a/src/ui/public/index_patterns/_transform_mapping_into_fields.js
+++ b/src/ui/public/index_patterns/_transform_mapping_into_fields.js
@@ -1,7 +1,7 @@
import _ from 'lodash';
import IndexPatternsMapFieldProvider from 'ui/index_patterns/_map_field';
export default function transformMappingIntoFields(Private, kbnIndex, config) {
- var mapField = Private(IndexPatternsMapFieldProvider);
+ let mapField = Private(IndexPatternsMapFieldProvider);
/**
@@ -14,15 +14,15 @@ export default function transformMappingIntoFields(Private, kbnIndex, config) {
* use-cases
*/
return function (response) {
- var fields = {};
+ let fields = {};
_.each(response, function (index, indexName) {
if (indexName === kbnIndex) return;
_.each(index.mappings, function (mappings) {
_.each(mappings, function (field, name) {
- var keys = Object.keys(field.mapping);
+ let keys = Object.keys(field.mapping);
if (keys.length === 0 || (name[0] === '_') && !_.contains(config.get('metaFields'), name)) return;
- var mapping = mapField(field, name);
+ let mapping = mapField(field, name);
if (fields[name]) {
if (fields[name].type !== mapping.type) {
@@ -39,7 +39,7 @@ export default function transformMappingIntoFields(Private, kbnIndex, config) {
config.get('metaFields').forEach(function (meta) {
if (fields[meta]) return;
- var field = { mapping: {} };
+ let field = { mapping: {} };
field.mapping[meta] = {};
fields[meta] = mapField(field, meta);
});
diff --git a/src/ui/public/index_patterns/index_patterns.js b/src/ui/public/index_patterns/index_patterns.js
index 7d8e709d03b10..18ea1b7c95cfd 100644
--- a/src/ui/public/index_patterns/index_patterns.js
+++ b/src/ui/public/index_patterns/index_patterns.js
@@ -9,20 +9,20 @@ import IndexPatternsMapperProvider from 'ui/index_patterns/_mapper';
import IndexPatternsPatternToWildcardProvider from 'ui/index_patterns/_pattern_to_wildcard';
import RegistryFieldFormatsProvider from 'ui/registry/field_formats';
import uiModules from 'ui/modules';
-var module = uiModules.get('kibana/index_patterns');
+let module = uiModules.get('kibana/index_patterns');
function IndexPatternsProvider(es, Notifier, Private, Promise, kbnIndex) {
- var self = this;
+ let self = this;
- var IndexPattern = Private(IndexPatternsIndexPatternProvider);
- var patternCache = Private(IndexPatternsPatternCacheProvider);
+ let IndexPattern = Private(IndexPatternsIndexPatternProvider);
+ let patternCache = Private(IndexPatternsPatternCacheProvider);
- var notify = new Notifier({ location: 'IndexPatterns Service'});
+ let notify = new Notifier({ location: 'IndexPatterns Service'});
self.get = function (id) {
if (!id) return self.make();
- var cache = patternCache.get(id);
+ let cache = patternCache.get(id);
return cache || patternCache.set(id, self.make(id));
};
diff --git a/src/ui/public/indexed_array/indexed_array.js b/src/ui/public/indexed_array/indexed_array.js
index aa042fd3312fc..3c7f81fcb52db 100644
--- a/src/ui/public/indexed_array/indexed_array.js
+++ b/src/ui/public/indexed_array/indexed_array.js
@@ -2,12 +2,12 @@ import _ from 'lodash';
import inflector from 'ui/indexed_array/inflector';
-var pathGetter = _(_.get).rearg(1, 0).ary(2);
-var inflectIndex = inflector('by');
-var inflectOrder = inflector('in', 'Order');
+let pathGetter = _(_.get).rearg(1, 0).ary(2);
+let inflectIndex = inflector('by');
+let inflectOrder = inflector('in', 'Order');
-var CLEAR_CACHE = {};
-var OPT_NAMES = IndexedArray.OPT_NAMES = ['index', 'group', 'order', 'initialSet', 'immutable'];
+let CLEAR_CACHE = {};
+let OPT_NAMES = IndexedArray.OPT_NAMES = ['index', 'group', 'order', 'initialSet', 'immutable'];
/**
* Generic extension of Array class, which will index (and reindex) the
@@ -69,11 +69,11 @@ IndexedArray.prototype._setupIndices = function (props, inflect, op) {
// shortcut for empty props
if (!props || props.length === 0) return;
- var self = this;
+ let self = this;
return props.map(function (prop) {
- var from = pathGetter.partial(prop).value();
- var to = inflect(prop);
+ let from = pathGetter.partial(prop).value();
+ let to = inflect(prop);
let cache;
Object.defineProperty(self, to, {
@@ -105,7 +105,7 @@ IndexedArray.prototype._setupIndices = function (props, inflect, op) {
* @return {undefined}
*/
IndexedArray.prototype._clearIndices = function () {
- var self = this;
+ let self = this;
self._indexNames.forEach(function (name) {
self[name] = CLEAR_CACHE;
});
@@ -120,7 +120,7 @@ IndexedArray.prototype._clearIndices = function () {
* @return {[type]} [description]
*/
'pop push shift splice unshift reverse'.split(' ').forEach(function (method) {
- var orig = Array.prototype[method];
+ let orig = Array.prototype[method];
IndexedArray.prototype[method] = function (/* args... */) {
// call the original method with this context
@@ -141,7 +141,7 @@ IndexedArray.prototype._clearIndices = function () {
* @return {array} - the removed data
*/
IndexedArray.prototype.remove = function (predicate, context) {
- var out = _.remove(this, predicate, context);
+ let out = _.remove(this, predicate, context);
_.remove(this.raw, predicate, context);
this._clearIndices();
return out;
diff --git a/src/ui/public/indexed_array/inflector.js b/src/ui/public/indexed_array/inflector.js
index 17cebbbc6d1b5..f879cbdf8965e 100644
--- a/src/ui/public/indexed_array/inflector.js
+++ b/src/ui/public/indexed_array/inflector.js
@@ -8,7 +8,7 @@ function startsWith(str, test) {
}
function endsWith(str, test) {
- var tooShort = str.length < test.length;
+ let tooShort = str.length < test.length;
if (tooShort) return;
return str.substr(str.length - test.length).toLowerCase() === test.toLowerCase();
diff --git a/src/ui/public/jquery/find_test_subject.js b/src/ui/public/jquery/find_test_subject.js
index cc1e6e10a9e7d..935bb67a14558 100644
--- a/src/ui/public/jquery/find_test_subject.js
+++ b/src/ui/public/jquery/find_test_subject.js
@@ -7,28 +7,28 @@ module.exports = function bindToJquery($) {
*
* ```js
* // this
- * var $button = $('[data-test-subj~="saveButton"]');
+ * let $button = $('[data-test-subj~="saveButton"]');
*
* // becomes this
- * var $button = $.findTestSubject('saveButton');
+ * let $button = $.findTestSubject('saveButton');
* ```
*
* Supports multiple subjects
* ```js
* // find any saveButton or cancelButton
- * var $buttons = $.findTestSubject('saveButton', 'cancelButton');
+ * let $buttons = $.findTestSubject('saveButton', 'cancelButton');
* ```
*
* Supports subject "selectors"
* ```js
* // find any saveButton inside a savedObjectForm
- * var $button = $.findTestSubject('savedObjectForm saveButton');
+ * let $button = $.findTestSubject('savedObjectForm saveButton');
* ```
*
* Supports selecting compound subjects
* ```js
* // find any smallButton that is also a saveButton inside a savedObjectForm
- * var $input = $.findTestSubject('savedObjectForm smallButton&saveButton');
+ * let $input = $.findTestSubject('savedObjectForm smallButton&saveButton');
* ```
*
* @return {jQueryCollection}
@@ -44,8 +44,8 @@ module.exports = function bindToJquery($) {
$.fn.findTestSubject = findTestSubject;
function findTestSubject(...subjectSelectors) {
- var $els = $();
- var $context = this;
+ let $els = $();
+ let $context = this;
subjectSelectors.forEach(function (selector) {
$els = $els.add($context.find(testSubjSelector(selector)));
diff --git a/src/ui/public/notify/directives.js b/src/ui/public/notify/directives.js
index 8582b0bf81712..b6d97e5a3d03d 100644
--- a/src/ui/public/notify/directives.js
+++ b/src/ui/public/notify/directives.js
@@ -3,7 +3,7 @@ import uiModules from 'ui/modules';
import toasterTemplate from 'ui/notify/partials/toaster.html';
import 'ui/notify/notify.less';
-var notify = uiModules.get('kibana/notify');
+let notify = uiModules.get('kibana/notify');
notify.directive('kbnNotifications', function () {
return {
diff --git a/src/ui/public/notify/errors.js b/src/ui/public/notify/errors.js
index fb74b7450be3e..68a040466124f 100644
--- a/src/ui/public/notify/errors.js
+++ b/src/ui/public/notify/errors.js
@@ -1,8 +1,8 @@
import _ from 'lodash';
-var errors = {};
+let errors = {};
-var canStack = (function () {
- var err = new Error();
+let canStack = (function () {
+ let err = new Error();
return !!err.stack;
}());
diff --git a/src/ui/public/notify/lib/_format_es_msg.js b/src/ui/public/notify/lib/_format_es_msg.js
index 1148da4064765..ac8c6b043a625 100644
--- a/src/ui/public/notify/lib/_format_es_msg.js
+++ b/src/ui/public/notify/lib/_format_es_msg.js
@@ -6,11 +6,11 @@ import _ from 'lodash';
* @returns {string}
*/
export default function formatESMsg(err) {
- var rootCause = _.get(err, 'resp.error.root_cause');
+ let rootCause = _.get(err, 'resp.error.root_cause');
if (!rootCause) {
return; //undefined
}
- var result = _.pluck(rootCause, 'reason').join('\n');
+ let result = _.pluck(rootCause, 'reason').join('\n');
return result;
};
diff --git a/src/ui/public/notify/lib/_format_msg.js b/src/ui/public/notify/lib/_format_msg.js
index 15f0260c5b7df..448c4fa4b2c8c 100644
--- a/src/ui/public/notify/lib/_format_msg.js
+++ b/src/ui/public/notify/lib/_format_msg.js
@@ -1,6 +1,6 @@
import _ from 'lodash';
import formatESMsg from 'ui/notify/lib/_format_es_msg';
-var has = _.has;
+let has = _.has;
/**
* Formats the error message from an error object, extended elasticsearch
@@ -10,12 +10,12 @@ var has = _.has;
* @returns {string}
*/
function formatMsg(err, from) {
- var rtn = '';
+ let rtn = '';
if (from) {
rtn += from + ': ';
}
- var esMsg = formatESMsg(err);
+ let esMsg = formatESMsg(err);
if (typeof err === 'string') {
rtn += err;
diff --git a/src/ui/public/notify/notifier.js b/src/ui/public/notify/notifier.js
index e72740d189455..a498f4ebbff09 100644
--- a/src/ui/public/notify/notifier.js
+++ b/src/ui/public/notify/notifier.js
@@ -5,17 +5,17 @@ import formatMsg from 'ui/notify/lib/_format_msg';
import fatalSplashScreen from 'ui/notify/partials/fatal_splash_screen.html';
/* eslint no-console: 0 */
-var notifs = [];
-var version = metadata.version;
-var buildNum = metadata.buildNum;
-var consoleGroups = ('group' in window.console) && ('groupCollapsed' in window.console) && ('groupEnd' in window.console);
+let notifs = [];
+let version = metadata.version;
+let buildNum = metadata.buildNum;
+let consoleGroups = ('group' in window.console) && ('groupCollapsed' in window.console) && ('groupEnd' in window.console);
-var log = _.bindKey(console, 'log');
+let log = _.bindKey(console, 'log');
// used to identify the first call to fatal, set to false there
-var firstFatal = true;
+let firstFatal = true;
-var fatalToastTemplate = (function lazyTemplate(tmpl) {
+let fatalToastTemplate = (function lazyTemplate(tmpl) {
let compiled;
return function (vars) {
return (compiled || (compiled = _.template(tmpl)))(vars);
@@ -32,7 +32,7 @@ function now() {
function closeNotif(notif, cb = _.noop, key) {
return function () {
// this === notif
- var i = notifs.indexOf(notif);
+ let i = notifs.indexOf(notif);
if (i !== -1) notifs.splice(i, 1);
cancelTimer(notif);
@@ -59,7 +59,7 @@ function timerCanceler(notif, cb = _.noop, key) {
* intervals and clears the notif once the notif _lifetime_ has been reached.
*/
function startNotifTimer(notif, cb) {
- var interval = 1000;
+ let interval = 1000;
if (notif.lifetime === Infinity) return;
@@ -99,7 +99,7 @@ function add(notif, cb) {
return notif.timerId ? true : false;
};
- var dup = _.find(notifs, function (item) {
+ let dup = _.find(notifs, function (item) {
return item.content === notif.content && item.lifetime === notif.lifetime;
});
@@ -120,7 +120,7 @@ function add(notif, cb) {
}
function formatInfo() {
- var info = [];
+ let info = [];
if (!_.isUndefined(version)) {
info.push(`Version: ${version}`);
@@ -145,7 +145,7 @@ function formatStack(err) {
* Functionality to check that
*/
function Notifier(opts) {
- var self = this;
+ let self = this;
opts = opts || {};
// label type thing to say where notifications came from
@@ -200,7 +200,7 @@ Notifier.prototype.lifecycle = createGroupLogger('lifecycle', {
* @return {function} - the wrapped function
*/
Notifier.prototype.timed = function (name, fn) {
- var self = this;
+ let self = this;
if (typeof name === 'function') {
fn = name;
@@ -208,8 +208,8 @@ Notifier.prototype.timed = function (name, fn) {
}
return function WrappedNotifierFunction() {
- var cntx = this;
- var args = arguments;
+ let cntx = this;
+ let args = arguments;
return self.event(name, function () {
return fn.apply(cntx, args);
@@ -245,13 +245,13 @@ Notifier.prototype._showFatal = function (err) {
});
}
- var html = fatalToastTemplate({
+ let html = fatalToastTemplate({
info: formatInfo(),
msg: formatMsg(err, this.from),
stack: formatStack(err)
});
- var $container = $('#fatal-splash-screen');
+ let $container = $('#fatal-splash-screen');
if (!$container.size()) {
$(document.body)
@@ -320,7 +320,7 @@ if (log === _.noop) {
Notifier.prototype.log = _.noop;
} else {
Notifier.prototype.log = function () {
- var args = [].slice.apply(arguments);
+ let args = [].slice.apply(arguments);
if (this.from) args.unshift(this.from + ':');
log.apply(null, args);
};
@@ -329,15 +329,15 @@ if (log === _.noop) {
// general functionality used by .event() and .lifecycle()
function createGroupLogger(type, opts) {
// Track the groups managed by this logger
- var groups = window[type + 'Groups'] = {};
+ let groups = window[type + 'Groups'] = {};
return function logger(name, success) {
let status; // status of the timer
let exec; // function to execute and wrap
let ret; // return value
- var complete = function (val) { logger(name, true); return val; };
- var failure = function (err) { logger(name, false); throw err; };
+ let complete = function (val) { logger(name, true); return val; };
+ let failure = function (err) { logger(name, false); throw err; };
if (typeof success === 'function' || success === void 0) {
// start
@@ -353,7 +353,7 @@ function createGroupLogger(type, opts) {
}
else {
groups[name] = now() - (groups[name] || 0);
- var time = ' in ' + groups[name].toFixed(2) + 'ms';
+ let time = ' in ' + groups[name].toFixed(2) + 'ms';
// end
if (success) {
diff --git a/src/ui/public/notify/notify.js b/src/ui/public/notify/notify.js
index b26eecd8ba7e8..159cac233946d 100644
--- a/src/ui/public/notify/notify.js
+++ b/src/ui/public/notify/notify.js
@@ -6,8 +6,8 @@ import Notifier from 'ui/notify/notifier';
import 'ui/notify/directives';
import chrome from 'ui/chrome';
import { kbnIndex } from 'ui/metadata';
-var module = modules.get('kibana/notify');
-var rootNotifier = new Notifier();
+let module = modules.get('kibana/notify');
+let rootNotifier = new Notifier();
module.factory('createNotifier', function () {
return function (opts) {
@@ -32,7 +32,7 @@ module.run(function ($interval) {
if (!!kbnIndex) {
require('ui/config');
module.run(function ($rootScope, config) {
- var configInitListener = $rootScope.$on('init:config', function () {
+ let configInitListener = $rootScope.$on('init:config', function () {
applyConfig();
configInitListener();
});
diff --git a/src/ui/public/number_list/number_list.js b/src/ui/public/number_list/number_list.js
index 1528dea37cfe7..9c18da1f3058f 100644
--- a/src/ui/public/number_list/number_list.js
+++ b/src/ui/public/number_list/number_list.js
@@ -13,7 +13,7 @@ uiModules
controllerAs: 'numberListCntr',
require: 'ngModel',
controller: function ($scope, $attrs, $parse) {
- var self = this;
+ let self = this;
// Called from the pre-link function once we have the controllers
self.init = function (modelCntr) {
@@ -25,7 +25,7 @@ uiModules
self.getUnitName = _.partial($parse($attrs.unit), $scope);
- var defaultRange = self.range = parseRange('[0,Infinity)');
+ let defaultRange = self.range = parseRange('[0,Infinity)');
$scope.$watch(function () {
return $attrs.range;
@@ -48,7 +48,7 @@ uiModules
* @return {undefined}
*/
self.remove = function (index) {
- var list = self.getList();
+ let list = self.getList();
if (!list) return;
list.splice(index, 1);
@@ -59,7 +59,7 @@ uiModules
* @return {undefined}
*/
self.add = function () {
- var list = self.getList();
+ let list = self.getList();
if (!list) return;
list.push(_.last(list) + 1);
diff --git a/src/ui/public/number_list/number_list_input.js b/src/ui/public/number_list/number_list_input.js
index de0b47350c8f9..7fbf1b935e02f 100644
--- a/src/ui/public/number_list/number_list_input.js
+++ b/src/ui/public/number_list/number_list_input.js
@@ -3,11 +3,11 @@ import _ from 'lodash';
import keyMap from 'ui/utils/key_map';
import uiModules from 'ui/modules';
-var INVALID = {}; // invalid flag
-var FLOATABLE = /^[\d\.e\-\+]+$/i;
+let INVALID = {}; // invalid flag
+let FLOATABLE = /^[\d\.e\-\+]+$/i;
-var VALIDATION_ERROR = 'numberListRangeAndOrder';
-var DIRECTIVE_ATTR = 'kbn-number-list-input';
+let VALIDATION_ERROR = 'numberListRangeAndOrder';
+let DIRECTIVE_ATTR = 'kbn-number-list-input';
uiModules
.get('kibana')
@@ -16,13 +16,13 @@ uiModules
restrict: 'A',
require: ['ngModel', '^kbnNumberList'],
link: function ($scope, $el, attrs, controllers) {
- var ngModelCntr = controllers[0];
- var numberListCntr = controllers[1];
+ let ngModelCntr = controllers[0];
+ let numberListCntr = controllers[1];
- var $setModel = $parse(attrs.ngModel).assign;
- var $repeater = $el.closest('[ng-repeat]');
+ let $setModel = $parse(attrs.ngModel).assign;
+ let $repeater = $el.closest('[ng-repeat]');
- var handlers = {
+ let handlers = {
up: change(add, 1),
'shift-up': change(addTenth, 1),
@@ -54,14 +54,14 @@ uiModules
function go(dir) {
return function () {
- var $to = $get(dir);
+ let $to = $get(dir);
if ($to.size()) $to.focus();
else return false;
};
}
function idKey(event) {
- var id = [];
+ let id = [];
if (event.ctrlKey) id.push('ctrl');
if (event.shiftKey) id.push('shift');
if (event.metaKey) id.push('meta');
@@ -75,8 +75,8 @@ uiModules
}
function addTenth(n, val, str) {
- var int = Math.floor(val);
- var dec = parseInt(str.split('.')[1] || 0, 10);
+ let int = Math.floor(val);
+ let dec = parseInt(str.split('.')[1] || 0, 10);
dec = dec + parseInt(n, 10);
if (dec < 0 || dec > 9) {
@@ -93,11 +93,11 @@ uiModules
function change(using, mod) {
return function () {
- var str = String(ngModelCntr.$viewValue);
- var val = parse(str);
+ let str = String(ngModelCntr.$viewValue);
+ let val = parse(str);
if (val === INVALID) return;
- var next = using(mod, val, str);
+ let next = using(mod, val, str);
if (next === INVALID) return;
$el.val(next);
@@ -106,7 +106,7 @@ uiModules
}
function onKeydown(event) {
- var handler = handlers[idKey(event)];
+ let handler = handlers[idKey(event)];
if (!handler) return;
if (handler(event) !== false) {
@@ -122,7 +122,7 @@ uiModules
});
function parse(viewValue) {
- var num = viewValue;
+ let num = viewValue;
if (typeof num !== 'number' || isNaN(num)) {
// parse non-numbers
@@ -133,13 +133,13 @@ uiModules
if (isNaN(num)) return INVALID;
}
- var range = numberListCntr.range;
+ let range = numberListCntr.range;
if (!range.within(num)) return INVALID;
if ($scope.$index > 0) {
- var i = $scope.$index - 1;
- var list = numberListCntr.getList();
- var prev = list[i];
+ let i = $scope.$index - 1;
+ let list = numberListCntr.getList();
+ let prev = list[i];
if (num <= prev) return INVALID;
}
@@ -155,14 +155,14 @@ uiModules
}
}
], function () {
- var valid = parse(ngModelCntr.$viewValue) !== INVALID;
+ let valid = parse(ngModelCntr.$viewValue) !== INVALID;
ngModelCntr.$setValidity(VALIDATION_ERROR, valid);
});
function validate(then) {
return function (input) {
- var value = parse(input);
- var valid = value !== INVALID;
+ let value = parse(input);
+ let valid = value !== INVALID;
value = valid ? value : input;
ngModelCntr.$setValidity(VALIDATION_ERROR, valid);
then && then(input, value);