mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[internal] Replace var with let in ui/public P-T
This change was applied to any .js files under directories beginning with `p` through `t` in src/ui/public. There are no `o` directories. This was an automatic replacement from var to let for any variable declaration that doubles as the initial assignment. Ultimately we want most of these to be converted to const, but this commit is so large that it warrants breaking each step of automation up into its own commit. For example: `var foo = 'bar';` becomes `let foo = 'var';` This was accomplished by replacing: find: `var ([a-zA-Z_$][0-9a-zA-Z_$]*)(\s+)=` replace: `let $1$2=`
This commit is contained in:
parent
68d46d430d
commit
1cddaab2c4
50 changed files with 291 additions and 291 deletions
|
@ -4,7 +4,7 @@ import paginatedTableTemplate from 'ui/paginated_table/paginated_table.html';
|
|||
uiModules
|
||||
.get('kibana')
|
||||
.directive('paginatedTable', function ($filter) {
|
||||
var orderBy = $filter('orderBy');
|
||||
let orderBy = $filter('orderBy');
|
||||
|
||||
return {
|
||||
restrict: 'E',
|
||||
|
@ -19,14 +19,14 @@ uiModules
|
|||
},
|
||||
controllerAs: 'paginatedTable',
|
||||
controller: function ($scope) {
|
||||
var self = this;
|
||||
let self = this;
|
||||
self.sort = {
|
||||
columnIndex: null,
|
||||
direction: null
|
||||
};
|
||||
|
||||
self.sortColumn = function (colIndex) {
|
||||
var col = $scope.columns[colIndex];
|
||||
let col = $scope.columns[colIndex];
|
||||
|
||||
if (!col) return;
|
||||
if (col.sortable === false) return;
|
||||
|
@ -36,7 +36,7 @@ uiModules
|
|||
if (self.sort.columnIndex !== colIndex) {
|
||||
sortDirection = 'asc';
|
||||
} else {
|
||||
var directions = {
|
||||
let directions = {
|
||||
null: 'asc',
|
||||
'asc': 'desc',
|
||||
'desc': null
|
||||
|
@ -56,7 +56,7 @@ uiModules
|
|||
} else {
|
||||
// use generic sort handler
|
||||
self.sort.getter = function (row) {
|
||||
var value = row[index];
|
||||
let value = row[index];
|
||||
if (value && value.value != null) value = value.value;
|
||||
if (typeof value === 'boolean') value = value ? 0 : 1;
|
||||
return value;
|
||||
|
@ -75,7 +75,7 @@ uiModules
|
|||
return;
|
||||
}
|
||||
|
||||
var sort = self.sort;
|
||||
let sort = self.sort;
|
||||
if (sort.direction == null) {
|
||||
$scope.sortedRows = $scope.rows.slice(0);
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import _ from 'lodash';
|
||||
import DecorateQueryProvider from 'ui/courier/data_source/_decorate_query';
|
||||
export default function GetQueryFromUser(es, Private) {
|
||||
var decorateQuery = Private(DecorateQueryProvider);
|
||||
let decorateQuery = Private(DecorateQueryProvider);
|
||||
|
||||
/**
|
||||
* Take text from the user and make it into a query object
|
||||
|
@ -13,7 +13,7 @@ export default function GetQueryFromUser(es, Private) {
|
|||
return decorateQuery({query_string: {query: text}});
|
||||
}
|
||||
|
||||
var matchAll = getQueryStringQuery('*');
|
||||
let matchAll = getQueryStringQuery('*');
|
||||
|
||||
// If we get an empty object, treat it as a *
|
||||
if (_.isObject(text)) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import uiModules from 'ui/modules';
|
|||
uiModules
|
||||
.get('kibana')
|
||||
.directive('parseQuery', function (Private) {
|
||||
var fromUser = Private(ParseQueryLibFromUserProvider);
|
||||
let fromUser = Private(ParseQueryLibFromUserProvider);
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
|
@ -13,7 +13,7 @@ uiModules
|
|||
'ngModel': '='
|
||||
},
|
||||
link: function ($scope, elem, attr, ngModel) {
|
||||
var init = function () {
|
||||
let init = function () {
|
||||
$scope.ngModel = fromUser($scope.ngModel);
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import SimpleEmitter from 'ui/utils/simple_emitter';
|
|||
import EventsProvider from 'ui/events';
|
||||
|
||||
export default function (Private) {
|
||||
var Events = Private(EventsProvider);
|
||||
let Events = Private(EventsProvider);
|
||||
|
||||
function validateParent(parent, path) {
|
||||
if (path.length <= 0) {
|
||||
|
@ -17,7 +17,7 @@ export default function (Private) {
|
|||
}
|
||||
|
||||
function validateValue(value) {
|
||||
var msg = 'State value must be a plain object';
|
||||
let msg = 'State value must be a plain object';
|
||||
if (!value) return;
|
||||
if (!_.isPlainObject(value)) throw new errors.PersistedStateError(msg);
|
||||
}
|
||||
|
@ -73,21 +73,21 @@ export default function (Private) {
|
|||
};
|
||||
|
||||
PersistedState.prototype.set = function (key, value) {
|
||||
var params = prepSetParams(key, value, this._path);
|
||||
var val = this._set(params.key, params.value);
|
||||
let params = prepSetParams(key, value, this._path);
|
||||
let val = this._set(params.key, params.value);
|
||||
this.emit('set');
|
||||
return val;
|
||||
};
|
||||
|
||||
PersistedState.prototype.setSilent = function (key, value) {
|
||||
var params = prepSetParams(key, value, this._path);
|
||||
let params = prepSetParams(key, value, this._path);
|
||||
return this._set(params.key, params.value, true);
|
||||
};
|
||||
|
||||
PersistedState.prototype.reset = function (path) {
|
||||
var keyPath = this._getIndex(path);
|
||||
var origValue = _.get(this._defaultState, keyPath);
|
||||
var currentValue = _.get(this._mergedState, keyPath);
|
||||
let keyPath = this._getIndex(path);
|
||||
let origValue = _.get(this._defaultState, keyPath);
|
||||
let currentValue = _.get(this._mergedState, keyPath);
|
||||
|
||||
if (_.isUndefined(origValue)) {
|
||||
this._cleanPath(path, this._mergedState);
|
||||
|
@ -108,7 +108,7 @@ export default function (Private) {
|
|||
};
|
||||
|
||||
PersistedState.prototype.removeChild = function (path) {
|
||||
var origValue = _.get(this._defaultState, this._getIndex(path));
|
||||
let origValue = _.get(this._defaultState, this._getIndex(path));
|
||||
|
||||
if (_.isUndefined(origValue)) {
|
||||
this.reset(path);
|
||||
|
@ -139,19 +139,19 @@ export default function (Private) {
|
|||
};
|
||||
|
||||
PersistedState.prototype._getPartialIndex = function (key) {
|
||||
var keyPath = this._getIndex(key);
|
||||
let keyPath = this._getIndex(key);
|
||||
return keyPath.slice(this._path.length);
|
||||
};
|
||||
|
||||
PersistedState.prototype._cleanPath = function (path, stateTree) {
|
||||
var partialPath = this._getPartialIndex(path);
|
||||
var remove = true;
|
||||
let partialPath = this._getPartialIndex(path);
|
||||
let remove = true;
|
||||
|
||||
// recursively delete value tree, when no other keys exist
|
||||
while (partialPath.length > 0) {
|
||||
var lastKey = partialPath.splice(partialPath.length - 1, 1)[0];
|
||||
var statePath = this._path.concat(partialPath);
|
||||
var stateVal = statePath.length > 0 ? _.get(stateTree, statePath) : stateTree;
|
||||
let lastKey = partialPath.splice(partialPath.length - 1, 1)[0];
|
||||
let statePath = this._path.concat(partialPath);
|
||||
let stateVal = statePath.length > 0 ? _.get(stateTree, statePath) : stateTree;
|
||||
|
||||
// if stateVal isn't an object, do nothing
|
||||
if (!_.isPlainObject(stateVal)) return;
|
||||
|
@ -162,13 +162,13 @@ export default function (Private) {
|
|||
};
|
||||
|
||||
PersistedState.prototype._getDefault = function () {
|
||||
var def = (this._hasPath()) ? undefined : {};
|
||||
let def = (this._hasPath()) ? undefined : {};
|
||||
return (this._parent ? this.get() : def);
|
||||
};
|
||||
|
||||
PersistedState.prototype._setPath = function (path) {
|
||||
var isString = _.isString(path);
|
||||
var isArray = _.isArray(path);
|
||||
let isString = _.isString(path);
|
||||
let isArray = _.isArray(path);
|
||||
|
||||
if (!isString && !isArray) return [];
|
||||
return (isString) ? [this._getIndex(path)] : path;
|
||||
|
@ -196,11 +196,11 @@ export default function (Private) {
|
|||
};
|
||||
|
||||
PersistedState.prototype._set = function (key, value, silent, initialChildState) {
|
||||
var self = this;
|
||||
var stateChanged = false;
|
||||
var initialState = !this._initialized;
|
||||
var keyPath = this._getIndex(key);
|
||||
var hasKeyPath = keyPath.length > 0;
|
||||
let self = this;
|
||||
let stateChanged = false;
|
||||
let initialState = !this._initialized;
|
||||
let keyPath = this._getIndex(key);
|
||||
let hasKeyPath = keyPath.length > 0;
|
||||
|
||||
// if this is the initial state value, save value as the default
|
||||
if (initialState) {
|
||||
|
@ -226,7 +226,7 @@ export default function (Private) {
|
|||
}
|
||||
} else {
|
||||
// check for changes at path, emit an event when different
|
||||
var curVal = hasKeyPath ? this.get(keyPath) : this._mergedState;
|
||||
let curVal = hasKeyPath ? this.get(keyPath) : this._mergedState;
|
||||
stateChanged = !_.isEqual(curVal, value);
|
||||
|
||||
if (!initialChildState) {
|
||||
|
@ -243,11 +243,11 @@ export default function (Private) {
|
|||
}
|
||||
|
||||
// update the merged state value
|
||||
var targetObj = this._mergedState || _.cloneDeep(this._defaultState);
|
||||
var sourceObj = _.merge({}, this._defaultChildState, this._changedState);
|
||||
let targetObj = this._mergedState || _.cloneDeep(this._defaultState);
|
||||
let sourceObj = _.merge({}, this._defaultChildState, this._changedState);
|
||||
|
||||
// handler arguments are (targetValue, sourceValue, key, target, source)
|
||||
var mergeMethod = function (targetValue, sourceValue, mergeKey) {
|
||||
let mergeMethod = function (targetValue, sourceValue, mergeKey) {
|
||||
// if not initial state, skip default merge method (ie. return value, see note below)
|
||||
if (!initialState && !initialChildState && _.isEqual(keyPath, self._getIndex(mergeKey))) {
|
||||
// use the sourceValue or fall back to targetValue
|
||||
|
|
|
@ -23,10 +23,10 @@ import uiModules from 'ui/modules';
|
|||
* ```js
|
||||
* define(function (require) {
|
||||
* return function ServerHealthProvider(Private, Promise) {
|
||||
* var ping = Private(require('ui/ping'));
|
||||
* let ping = Private(require('ui/ping'));
|
||||
* return {
|
||||
* check: Promise.method(function () {
|
||||
* var attempts = 0;
|
||||
* let attempts = 0;
|
||||
* return (function attempt() {
|
||||
* attempts += 1;
|
||||
* return ping.ping()
|
||||
|
@ -87,7 +87,7 @@ import uiModules from 'ui/modules';
|
|||
*/
|
||||
|
||||
|
||||
var nextId = _.partial(_.uniqueId, 'privateProvider#');
|
||||
let nextId = _.partial(_.uniqueId, 'privateProvider#');
|
||||
|
||||
function name(fn) {
|
||||
return fn.name || fn.toString().split('\n').shift();
|
||||
|
@ -95,11 +95,11 @@ function name(fn) {
|
|||
|
||||
uiModules.get('kibana')
|
||||
.provider('Private', function () {
|
||||
var provider = this;
|
||||
let provider = this;
|
||||
|
||||
// one cache/swaps per Provider
|
||||
var cache = {};
|
||||
var swaps = {};
|
||||
let cache = {};
|
||||
let swaps = {};
|
||||
|
||||
// return the uniq id for this function
|
||||
function identify(fn) {
|
||||
|
@ -117,15 +117,15 @@ uiModules.get('kibana')
|
|||
};
|
||||
|
||||
provider.swap = function (fn, prov) {
|
||||
var id = identify(fn);
|
||||
let id = identify(fn);
|
||||
swaps[id] = prov;
|
||||
};
|
||||
|
||||
provider.$get = ['$injector', function PrivateFactory($injector) {
|
||||
|
||||
// prevent circular deps by tracking where we came from
|
||||
var privPath = [];
|
||||
var pathToString = function () {
|
||||
let privPath = [];
|
||||
let pathToString = function () {
|
||||
return privPath.map(name).join(' -> ');
|
||||
};
|
||||
|
||||
|
@ -140,8 +140,8 @@ uiModules.get('kibana')
|
|||
|
||||
privPath.push(prov);
|
||||
|
||||
var context = {};
|
||||
var instance = $injector.invoke(prov, context, locals);
|
||||
let context = {};
|
||||
let instance = $injector.invoke(prov, context, locals);
|
||||
if (!_.isObject(instance)) instance = context;
|
||||
|
||||
privPath.pop();
|
||||
|
@ -167,7 +167,7 @@ uiModules.get('kibana')
|
|||
|
||||
// main api, get the appropriate instance for a provider
|
||||
function Private(prov) {
|
||||
var id = identify(prov);
|
||||
let id = identify(prov);
|
||||
let $delegateId;
|
||||
let $delegateProv;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import _ from 'lodash';
|
||||
import uiModules from 'ui/modules';
|
||||
|
||||
var module = uiModules.get('kibana');
|
||||
let module = uiModules.get('kibana');
|
||||
|
||||
// Provides a tiny subset of the excelent API from
|
||||
// bluebird, reimplemented using the $q service
|
||||
|
@ -9,7 +9,7 @@ module.service('Promise', function ($q, $timeout) {
|
|||
function Promise(fn) {
|
||||
if (typeof this === 'undefined') throw new Error('Promise constructor must be called with "new"');
|
||||
|
||||
var defer = $q.defer();
|
||||
let defer = $q.defer();
|
||||
try {
|
||||
fn(defer.resolve, defer.reject);
|
||||
} catch (e) {
|
||||
|
@ -20,12 +20,12 @@ module.service('Promise', function ($q, $timeout) {
|
|||
|
||||
Promise.all = Promise.props = $q.all;
|
||||
Promise.resolve = function (val) {
|
||||
var defer = $q.defer();
|
||||
let defer = $q.defer();
|
||||
defer.resolve(val);
|
||||
return defer.promise;
|
||||
};
|
||||
Promise.reject = function (reason) {
|
||||
var defer = $q.defer();
|
||||
let defer = $q.defer();
|
||||
defer.reject(reason);
|
||||
return defer.promise;
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ module.service('Promise', function ($q, $timeout) {
|
|||
};
|
||||
Promise.method = function (fn) {
|
||||
return function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
return Promise.try(fn, args, this);
|
||||
};
|
||||
};
|
||||
|
@ -64,7 +64,7 @@ module.service('Promise', function ($q, $timeout) {
|
|||
return obj && typeof obj.then === 'function';
|
||||
};
|
||||
Promise.halt = _.once(function () {
|
||||
var promise = new Promise();
|
||||
let promise = new Promise();
|
||||
promise.then = _.constant(promise);
|
||||
promise.catch = _.constant(promise);
|
||||
return promise;
|
||||
|
@ -155,7 +155,7 @@ module.factory('PromiseEmitter', function (Promise) {
|
|||
* @return {Promise}
|
||||
*/
|
||||
function PromiseEmitter(fn, handler) {
|
||||
var prom = new Promise(fn);
|
||||
let prom = new Promise(fn);
|
||||
|
||||
if (!handler) return prom;
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@ import _ from 'lodash';
|
|||
import EventsProvider from 'ui/events';
|
||||
export default function ReflowWatcherService(Private, $rootScope, $http) {
|
||||
|
||||
var EventEmitter = Private(EventsProvider);
|
||||
var $body = $(document.body);
|
||||
var $window = $(window);
|
||||
let EventEmitter = Private(EventsProvider);
|
||||
let $body = $(document.body);
|
||||
let $window = $(window);
|
||||
|
||||
var MOUSE_EVENTS = 'mouseup';
|
||||
var WINDOW_EVENTS = 'resize';
|
||||
let MOUSE_EVENTS = 'mouseup';
|
||||
let WINDOW_EVENTS = 'resize';
|
||||
|
||||
_.class(ReflowWatcher).inherits(EventEmitter);
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import _ from 'lodash';
|
||||
import IndexedArray from 'ui/indexed_array';
|
||||
import RegistryVisTypesProvider from 'ui/registry/vis_types';
|
||||
var notPropsOptNames = IndexedArray.OPT_NAMES.concat('constructor');
|
||||
let notPropsOptNames = IndexedArray.OPT_NAMES.concat('constructor');
|
||||
|
||||
/**
|
||||
* Create a registry, which is just a Private module provider.
|
||||
|
@ -16,7 +16,7 @@ var notPropsOptNames = IndexedArray.OPT_NAMES.concat('constructor');
|
|||
*
|
||||
* + register a module
|
||||
* ```js
|
||||
* var registry = require('ui/registry/vis_types');
|
||||
* let registry = require('ui/registry/vis_types');
|
||||
* registry.add(function InjectablePrivateModule($http, Promise) {
|
||||
* ...
|
||||
* })
|
||||
|
@ -24,7 +24,7 @@ var notPropsOptNames = IndexedArray.OPT_NAMES.concat('constructor');
|
|||
*
|
||||
* + get all registered modules
|
||||
* ```js
|
||||
* var visTypes = Private(RegistryVisTypesProvider);
|
||||
* let visTypes = Private(RegistryVisTypesProvider);
|
||||
* ```
|
||||
*
|
||||
*
|
||||
|
@ -49,10 +49,10 @@ var notPropsOptNames = IndexedArray.OPT_NAMES.concat('constructor');
|
|||
export default function createRegistry(spec) {
|
||||
spec = spec || {};
|
||||
|
||||
var constructor = _.has(spec, 'constructor') && spec.constructor;
|
||||
var iaOpts = _.defaults(_.pick(spec, IndexedArray.OPT_NAMES), { index: ['name'] });
|
||||
var props = _.omit(spec, notPropsOptNames);
|
||||
var providers = [];
|
||||
let constructor = _.has(spec, 'constructor') && spec.constructor;
|
||||
let iaOpts = _.defaults(_.pick(spec, IndexedArray.OPT_NAMES), { index: ['name'] });
|
||||
let props = _.omit(spec, notPropsOptNames);
|
||||
let providers = [];
|
||||
|
||||
/**
|
||||
* This is the Private module that will be instanciated by
|
||||
|
@ -62,10 +62,10 @@ export default function createRegistry(spec) {
|
|||
* that were registered, the registry spec
|
||||
* defines how things will be indexed.
|
||||
*/
|
||||
var registry = function (Private, $injector) {
|
||||
let registry = function (Private, $injector) {
|
||||
// index all of the modules
|
||||
iaOpts.initialSet = providers.map(Private);
|
||||
var modules = new IndexedArray(iaOpts);
|
||||
let modules = new IndexedArray(iaOpts);
|
||||
|
||||
// mixin other props
|
||||
_.assign(modules, props);
|
||||
|
|
|
@ -7,7 +7,7 @@ export default uiRegistry({
|
|||
group: ['fieldType'],
|
||||
|
||||
constructor: function (config, $rootScope) {
|
||||
var self = this;
|
||||
let self = this;
|
||||
let defaultMap;
|
||||
|
||||
function init() {
|
||||
|
@ -56,7 +56,7 @@ export default uiRegistry({
|
|||
* @return {FieldFormat}
|
||||
*/
|
||||
self.getInstance = _.memoize(function (formatId) {
|
||||
var FieldFormat = self.byId[formatId];
|
||||
let FieldFormat = self.byId[formatId];
|
||||
return new FieldFormat();
|
||||
});
|
||||
|
||||
|
@ -67,8 +67,8 @@ export default uiRegistry({
|
|||
* @return {FieldFormat}
|
||||
*/
|
||||
self.getDefaultInstance = _.memoize(function (fieldType) {
|
||||
var conf = self.getDefaultConfig(fieldType);
|
||||
var FieldFormat = self.byId[conf.id];
|
||||
let conf = self.getDefaultConfig(fieldType);
|
||||
let FieldFormat = self.byId[conf.id];
|
||||
return new FieldFormat(conf.params);
|
||||
});
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@ import wrapRouteWithPrep from './wrap_route_with_prep';
|
|||
import RouteSetupManager from './route_setup_manager';
|
||||
|
||||
function RouteManager() {
|
||||
var self = this;
|
||||
var setup = new RouteSetupManager();
|
||||
var when = [];
|
||||
var defaults = [];
|
||||
let self = this;
|
||||
let setup = new RouteSetupManager();
|
||||
let when = [];
|
||||
let defaults = [];
|
||||
let otherwise;
|
||||
|
||||
self.config = function ($routeProvider) {
|
||||
when.forEach(function (args) {
|
||||
var path = args[0];
|
||||
var route = args[1] || {};
|
||||
let path = args[0];
|
||||
let route = args[1] || {};
|
||||
|
||||
// merge in any defaults
|
||||
defaults.forEach(function (args) {
|
||||
|
|
|
@ -66,7 +66,7 @@ module.exports = class RouteSetupManager {
|
|||
)
|
||||
.then(() => {
|
||||
// wait for the queue to fill up, then do all the work
|
||||
var defer = Promise.defer();
|
||||
let defer = Promise.defer();
|
||||
userWork.resolveWhenFull(defer);
|
||||
|
||||
return defer.promise.then(() => Promise.all(userWork.doWork()));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import RouteManager from './route_manager';
|
||||
import 'angular-route/angular-route';
|
||||
import uiModules from 'ui/modules';
|
||||
var defaultRouteManager = new RouteManager();
|
||||
let defaultRouteManager = new RouteManager();
|
||||
|
||||
module.exports = {
|
||||
...defaultRouteManager,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import _ from 'lodash';
|
||||
|
||||
function WorkQueue() {
|
||||
var q = this;
|
||||
let q = this;
|
||||
|
||||
var work = [];
|
||||
var fullDefers = [];
|
||||
let work = [];
|
||||
let fullDefers = [];
|
||||
|
||||
q.limit = 0;
|
||||
Object.defineProperty(q, 'length', {
|
||||
|
@ -13,13 +13,13 @@ function WorkQueue() {
|
|||
}
|
||||
});
|
||||
|
||||
var resolve = function (defers) {
|
||||
let resolve = function (defers) {
|
||||
return defers.splice(0).map(function (defer) {
|
||||
return defer.resolve();
|
||||
});
|
||||
};
|
||||
|
||||
var checkIfFull = function () {
|
||||
let checkIfFull = function () {
|
||||
if (work.length >= q.limit && fullDefers.length) {
|
||||
resolve(fullDefers);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ function WorkQueue() {
|
|||
};
|
||||
|
||||
q.doWork = function () {
|
||||
var resps = resolve(work);
|
||||
let resps = resolve(work);
|
||||
checkIfFull();
|
||||
return resps;
|
||||
};
|
||||
|
|
|
@ -7,11 +7,11 @@ import errors from 'ui/errors';
|
|||
function wrapRouteWithPrep(route, setup) {
|
||||
if (!route.resolve && route.redirectTo) return;
|
||||
|
||||
var userWork = new WorkQueue();
|
||||
let userWork = new WorkQueue();
|
||||
// the point at which we will consider the queue "full"
|
||||
userWork.limit = _.keys(route.resolve).length;
|
||||
|
||||
var resolve = {
|
||||
let resolve = {
|
||||
__prep__: function ($injector) {
|
||||
return $injector.invoke(setup.doWork, setup, { userWork });
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ function wrapRouteWithPrep(route, setup) {
|
|||
// prep is complete
|
||||
_.forOwn(route.resolve || {}, function (expr, name) {
|
||||
resolve[name] = function ($injector, Promise) {
|
||||
var defer = Promise.defer();
|
||||
let defer = Promise.defer();
|
||||
userWork.push(defer);
|
||||
return defer.promise.then(function () {
|
||||
return $injector[angular.isString(expr) ? 'get' : 'invoke'](expr);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import _ from 'lodash';
|
||||
|
||||
var err = new Error();
|
||||
let err = new Error();
|
||||
try { setByAssignment(err, 'john'); } catch (e) {} // eslint-disable-line
|
||||
|
||||
// err.stack is not always writeable, so we
|
||||
|
@ -13,7 +13,7 @@ if (err.stack === 'john') module.exports = setByAssignment;
|
|||
else module.exports = setByShadowing;
|
||||
|
||||
function setByShadowing(err, stack) {
|
||||
var props = _.mapValues(err, function (val) {
|
||||
let props = _.mapValues(err, function (val) {
|
||||
return {
|
||||
enumerable: true,
|
||||
value: val
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import _ from 'lodash';
|
||||
|
||||
var opts = [
|
||||
let opts = [
|
||||
/@((?:[!#$&-;=?-\[\]_a-z~]|%[0-9a-f]{2})+\.js)\:(\d+)(?:\:(\d+)|())/ig,
|
||||
/(?: \(|at )((?:[!#$&-;=?-\[\]_a-z~]|%[0-9a-f]{2})+\.js)\:(\d+)(?:\:(\d+)|())/ig
|
||||
];
|
||||
|
@ -8,7 +8,7 @@ var opts = [
|
|||
let sample;
|
||||
try { throw new Error('msg'); } catch (e) { sample = e.stack; }
|
||||
|
||||
var format = _.find(opts, function (format) {
|
||||
let format = _.find(opts, function (format) {
|
||||
return format.test(sample);
|
||||
});
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ StackTraceMapper.prototype.init = function (mapUrls) {
|
|||
StackTraceMapper.prototype.mapError = function (err) {
|
||||
if (!stackLineFormat || !err.stack) return err;
|
||||
|
||||
var stack = err.stack.replace(stackLineFormat, this.mapLine);
|
||||
let stack = err.stack.replace(stackLineFormat, this.mapLine);
|
||||
return setErrorStack(err, stack);
|
||||
};
|
||||
|
||||
|
@ -39,10 +39,10 @@ StackTraceMapper.prototype.getMapFor = function (url) {
|
|||
StackTraceMapper.prototype.loadMaps = function (mapUrls) {
|
||||
mapUrls = _.clone(mapUrls || {});
|
||||
|
||||
var maps = this.maps;
|
||||
let maps = this.maps;
|
||||
|
||||
$('script[src][src-map]').each(function () {
|
||||
var $el = $(this);
|
||||
let $el = $(this);
|
||||
mapUrls[$el.attr('src')] = $el.attr('src-map');
|
||||
});
|
||||
|
||||
|
|
|
@ -3,17 +3,17 @@ import _ from 'lodash';
|
|||
module.exports = function (map, match, filename, line, col) {
|
||||
if (!map) return match;
|
||||
|
||||
var position = {
|
||||
let position = {
|
||||
line: parseFloat(line) || 0,
|
||||
column: parseFloat(col) || 0
|
||||
};
|
||||
|
||||
var srcPosition = map.smc.originalPositionFor(position);
|
||||
let srcPosition = map.smc.originalPositionFor(position);
|
||||
if (!srcPosition || !srcPosition.source) return match;
|
||||
|
||||
var srcFilename = srcPosition.source;
|
||||
var srcLine = srcPosition.line;
|
||||
var srcCol = srcPosition.column;
|
||||
let srcFilename = srcPosition.source;
|
||||
let srcLine = srcPosition.line;
|
||||
let srcCol = srcPosition.column;
|
||||
|
||||
if (srcCol === 0 && position.column) {
|
||||
// TODO: teach sourcemaps correct column
|
||||
|
@ -26,10 +26,10 @@ module.exports = function (map, match, filename, line, col) {
|
|||
// fold the components into the original match, so that supporting
|
||||
// characters (parens, periods, etc) from the format are kept, and so
|
||||
// we don't accidentally replace the wrong part we use splitting and consumption
|
||||
var resp = '';
|
||||
var remainingResp = match;
|
||||
var fold = function (replace, replacement) {
|
||||
var wrappingContent = remainingResp.split(replace);
|
||||
let resp = '';
|
||||
let remainingResp = match;
|
||||
let fold = function (replace, replacement) {
|
||||
let wrappingContent = remainingResp.split(replace);
|
||||
resp += wrappingContent.shift() + replacement;
|
||||
remainingResp = wrappingContent.join(replace);
|
||||
};
|
||||
|
|
|
@ -7,8 +7,8 @@ import rison from 'ui/utils/rison';
|
|||
export default function ($location) {
|
||||
// feed in some of the private state from globalState
|
||||
return function (globalState, updateListeners, app) {
|
||||
var getAppStash = function (search) {
|
||||
var appStash = search._a && rison.decode(search._a);
|
||||
let getAppStash = function (search) {
|
||||
let appStash = search._a && rison.decode(search._a);
|
||||
if (app.current) {
|
||||
// Apply the defaults to appStash
|
||||
appStash = _.defaults(appStash || {}, app.defaults);
|
||||
|
@ -16,20 +16,20 @@ export default function ($location) {
|
|||
return appStash;
|
||||
};
|
||||
|
||||
var diffTrans = function (trans) {
|
||||
var obj = trans[0];
|
||||
var update = trans[1];
|
||||
let diffTrans = function (trans) {
|
||||
let obj = trans[0];
|
||||
let update = trans[1];
|
||||
|
||||
var diff = {};
|
||||
let diff = {};
|
||||
|
||||
// the keys that are currently set on obj, excluding methods
|
||||
var objKeys = Object.keys(obj).filter(function (key) {
|
||||
let objKeys = Object.keys(obj).filter(function (key) {
|
||||
return typeof obj[key] !== 'function';
|
||||
});
|
||||
|
||||
if (update) {
|
||||
// the keys obj should have after applying the update
|
||||
var updateKeys = diff.keys = Object.keys(update).filter(function (key) {
|
||||
let updateKeys = diff.keys = Object.keys(update).filter(function (key) {
|
||||
return typeof update[key] !== 'function';
|
||||
});
|
||||
|
||||
|
@ -52,8 +52,8 @@ export default function ($location) {
|
|||
return diff;
|
||||
};
|
||||
|
||||
var notify = function (trans, diff) {
|
||||
var listeners = null;
|
||||
let notify = function (trans, diff) {
|
||||
let listeners = null;
|
||||
|
||||
if (trans[0] === app.current) {
|
||||
listeners = app.listeners;
|
||||
|
@ -66,11 +66,11 @@ export default function ($location) {
|
|||
});
|
||||
};
|
||||
|
||||
var applyDiff = function (trans, diff) {
|
||||
let applyDiff = function (trans, diff) {
|
||||
if (!diff.all.length) return;
|
||||
|
||||
var obj = trans[0];
|
||||
var update = trans[1];
|
||||
let obj = trans[0];
|
||||
let update = trans[1];
|
||||
|
||||
diff.remove.forEach(function (key) {
|
||||
delete obj[key];
|
||||
|
@ -81,13 +81,13 @@ export default function ($location) {
|
|||
});
|
||||
};
|
||||
|
||||
var syncTrans = function (trans, forceNotify) {
|
||||
let syncTrans = function (trans, forceNotify) {
|
||||
// obj that will be modified by update(trans[1])
|
||||
// if it is empty, we can skip it all
|
||||
var skipWrite = !trans[0];
|
||||
let skipWrite = !trans[0];
|
||||
trans[0] = trans[0] || {};
|
||||
|
||||
var diff = diffTrans(trans);
|
||||
let diff = diffTrans(trans);
|
||||
if (!skipWrite && (forceNotify || diff.all.length)) {
|
||||
applyDiff(trans, diff);
|
||||
notify(trans, diff);
|
||||
|
@ -98,17 +98,17 @@ export default function ($location) {
|
|||
return {
|
||||
// sync by pushing to the url
|
||||
push: function (forceNotify) {
|
||||
var search = $location.search();
|
||||
let search = $location.search();
|
||||
|
||||
var appStash = getAppStash(search) || {};
|
||||
var globalStash = search._g ? rison.decode(search._g) : {};
|
||||
let appStash = getAppStash(search) || {};
|
||||
let globalStash = search._g ? rison.decode(search._g) : {};
|
||||
|
||||
var res = _.mapValues({
|
||||
let res = _.mapValues({
|
||||
app: [appStash, app.current],
|
||||
global: [globalStash, globalState]
|
||||
}, function (trans, key) {
|
||||
var diff = syncTrans(trans, forceNotify);
|
||||
var urlKey = '_' + key.charAt(0);
|
||||
let diff = syncTrans(trans, forceNotify);
|
||||
let urlKey = '_' + key.charAt(0);
|
||||
if (diff.keys.length === 0) {
|
||||
delete search[urlKey];
|
||||
} else {
|
||||
|
@ -122,10 +122,10 @@ export default function ($location) {
|
|||
},
|
||||
// sync by pulling from the url
|
||||
pull: function (forceNotify) {
|
||||
var search = $location.search();
|
||||
let search = $location.search();
|
||||
|
||||
var appStash = getAppStash(search);
|
||||
var globalStash = search._g && rison.decode(search._g);
|
||||
let appStash = getAppStash(search);
|
||||
let globalStash = search._g && rison.decode(search._g);
|
||||
|
||||
return _.mapValues({
|
||||
app: [app.current, appStash],
|
||||
|
|
|
@ -2,11 +2,11 @@ import _ from 'lodash';
|
|||
import modules from 'ui/modules';
|
||||
import StateManagementStateProvider from 'ui/state_management/state';
|
||||
import PersistedStatePersistedStateProvider from 'ui/persisted_state/persisted_state';
|
||||
var urlParam = '_a';
|
||||
let urlParam = '_a';
|
||||
|
||||
function AppStateProvider(Private, $rootScope, getAppState) {
|
||||
var State = Private(StateManagementStateProvider);
|
||||
var PersistedState = Private(PersistedStatePersistedStateProvider);
|
||||
let State = Private(StateManagementStateProvider);
|
||||
let PersistedState = Private(PersistedStatePersistedStateProvider);
|
||||
let persistedStates;
|
||||
let eventUnsubscribers;
|
||||
|
||||
|
@ -30,31 +30,31 @@ function AppStateProvider(Private, $rootScope, getAppState) {
|
|||
|
||||
AppState.prototype.makeStateful = function (prop) {
|
||||
if (persistedStates[prop]) return persistedStates[prop];
|
||||
var self = this;
|
||||
let self = this;
|
||||
|
||||
// set up the ui state
|
||||
persistedStates[prop] = new PersistedState();
|
||||
|
||||
// update the app state when the stateful instance changes
|
||||
var updateOnChange = function () {
|
||||
var replaceState = false; // TODO: debouncing logic
|
||||
let updateOnChange = function () {
|
||||
let replaceState = false; // TODO: debouncing logic
|
||||
|
||||
self[prop] = persistedStates[prop].getChanges();
|
||||
self.save(replaceState);
|
||||
};
|
||||
var handlerOnChange = (method) => persistedStates[prop][method]('change', updateOnChange);
|
||||
let handlerOnChange = (method) => persistedStates[prop][method]('change', updateOnChange);
|
||||
handlerOnChange('on');
|
||||
eventUnsubscribers.push(() => handlerOnChange('off'));
|
||||
|
||||
// update the stateful object when the app state changes
|
||||
var persistOnChange = function (changes) {
|
||||
let persistOnChange = function (changes) {
|
||||
if (!changes) return;
|
||||
|
||||
if (changes.indexOf(prop) !== -1) {
|
||||
persistedStates[prop].set(self[prop]);
|
||||
}
|
||||
};
|
||||
var handlePersist = (method) => this[method]('fetch_with_changes', persistOnChange);
|
||||
let handlePersist = (method) => this[method]('fetch_with_changes', persistOnChange);
|
||||
handlePersist('on');
|
||||
eventUnsubscribers.push(() => handlePersist('off'));
|
||||
|
||||
|
@ -80,7 +80,7 @@ modules.get('kibana/global_state')
|
|||
|
||||
// Checks to see if the appState might already exist, even if it hasn't been newed up
|
||||
get.previouslyStored = function () {
|
||||
var search = $location.search();
|
||||
let search = $location.search();
|
||||
return search[urlParam] ? true : false;
|
||||
};
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ import rison from 'ui/utils/rison';
|
|||
import StateManagementStateProvider from 'ui/state_management/state';
|
||||
import uiModules from 'ui/modules';
|
||||
|
||||
var module = uiModules.get('kibana/global_state');
|
||||
let module = uiModules.get('kibana/global_state');
|
||||
|
||||
module.service('globalState', function (Private, $rootScope, $location) {
|
||||
var State = Private(StateManagementStateProvider);
|
||||
let State = Private(StateManagementStateProvider);
|
||||
|
||||
_.class(GlobalState).inherits(State);
|
||||
function GlobalState(defaults) {
|
||||
|
|
|
@ -7,13 +7,13 @@ import Notifier from 'ui/notify/notifier';
|
|||
|
||||
|
||||
export default function StateProvider(Private, $rootScope, $location) {
|
||||
var Events = Private(EventsProvider);
|
||||
let Events = Private(EventsProvider);
|
||||
|
||||
_.class(State).inherits(Events);
|
||||
function State(urlParam, defaults) {
|
||||
State.Super.call(this);
|
||||
|
||||
var self = this;
|
||||
let self = this;
|
||||
self.setDefaults(defaults);
|
||||
self._urlParam = urlParam || '_s';
|
||||
|
||||
|
@ -40,11 +40,11 @@ export default function StateProvider(Private, $rootScope, $location) {
|
|||
}
|
||||
|
||||
State.prototype._readFromURL = function () {
|
||||
var search = $location.search();
|
||||
let search = $location.search();
|
||||
try {
|
||||
return search[this._urlParam] ? rison.decode(search[this._urlParam]) : null;
|
||||
} catch (e) {
|
||||
var notify = new Notifier();
|
||||
let notify = new Notifier();
|
||||
notify.error('Unable to parse URL');
|
||||
search[this._urlParam] = rison.encode(this._defaults);
|
||||
$location.search(search).replace();
|
||||
|
@ -57,7 +57,7 @@ export default function StateProvider(Private, $rootScope, $location) {
|
|||
* @returns {void}
|
||||
*/
|
||||
State.prototype.fetch = function () {
|
||||
var stash = this._readFromURL();
|
||||
let stash = this._readFromURL();
|
||||
|
||||
// nothing to read from the url? save if ordered to persist
|
||||
if (stash === null) {
|
||||
|
@ -70,7 +70,7 @@ export default function StateProvider(Private, $rootScope, $location) {
|
|||
|
||||
_.defaults(stash, this._defaults);
|
||||
// apply diff to state from stash, will change state in place via side effect
|
||||
var diffResults = applyDiff(this, stash);
|
||||
let diffResults = applyDiff(this, stash);
|
||||
|
||||
if (diffResults.keys.length) {
|
||||
this.emit('fetch_with_changes', diffResults.keys);
|
||||
|
@ -82,8 +82,8 @@ export default function StateProvider(Private, $rootScope, $location) {
|
|||
* @returns {void}
|
||||
*/
|
||||
State.prototype.save = function (replace) {
|
||||
var stash = this._readFromURL();
|
||||
var state = this.toObject();
|
||||
let stash = this._readFromURL();
|
||||
let state = this.toObject();
|
||||
replace = replace || false;
|
||||
|
||||
if (!stash) {
|
||||
|
@ -93,14 +93,14 @@ export default function StateProvider(Private, $rootScope, $location) {
|
|||
|
||||
_.defaults(state, this._defaults);
|
||||
// apply diff to state from stash, will change state in place via side effect
|
||||
var diffResults = applyDiff(stash, state);
|
||||
let diffResults = applyDiff(stash, state);
|
||||
|
||||
if (diffResults.keys.length) {
|
||||
this.emit('save_with_changes', diffResults.keys);
|
||||
}
|
||||
|
||||
// persist the state in the URL
|
||||
var search = $location.search();
|
||||
let search = $location.search();
|
||||
search[this._urlParam] = this.toRISON();
|
||||
if (replace) {
|
||||
$location.search(search).replace();
|
||||
|
@ -125,7 +125,7 @@ export default function StateProvider(Private, $rootScope, $location) {
|
|||
State.prototype.reset = function () {
|
||||
// apply diff to _attributes from defaults, this is side effecting so
|
||||
// it will change the state in place.
|
||||
var diffResults = applyDiff(this, this._defaults);
|
||||
let diffResults = applyDiff(this, this._defaults);
|
||||
if (diffResults.keys.length) {
|
||||
this.emit('reset_with_changes', diffResults.keys);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import modules from 'ui/modules';
|
|||
import angular from 'angular';
|
||||
|
||||
function Storage(store) {
|
||||
var self = this;
|
||||
let self = this;
|
||||
self.store = store;
|
||||
|
||||
self.get = function (key) {
|
||||
|
@ -30,7 +30,7 @@ function Storage(store) {
|
|||
};
|
||||
}
|
||||
|
||||
var createService = function (type) {
|
||||
let createService = function (type) {
|
||||
return function ($window) {
|
||||
return new Storage($window[type]);
|
||||
};
|
||||
|
|
|
@ -3,9 +3,9 @@ import 'ui/field_format_editor/numeral/numeral';
|
|||
import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format';
|
||||
import BoundToConfigObjProvider from 'ui/bound_to_config_obj';
|
||||
export default function AbstractNumeralFormatProvider(Private) {
|
||||
var FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
var BoundToConfigObj = Private(BoundToConfigObjProvider);
|
||||
var numeral = require('numeral')();
|
||||
let FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
let BoundToConfigObj = Private(BoundToConfigObjProvider);
|
||||
let numeral = require('numeral')();
|
||||
|
||||
_.class(Numeral).inherits(FieldFormat);
|
||||
function Numeral(params) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import StringifyTypesNumeralProvider from 'ui/stringify/types/_numeral';
|
||||
|
||||
export default function BytesFormatProvider(Private) {
|
||||
var Numeral = Private(StringifyTypesNumeralProvider);
|
||||
let Numeral = Private(StringifyTypesNumeralProvider);
|
||||
return Numeral.factory({
|
||||
id: 'bytes',
|
||||
title: 'Bytes',
|
||||
|
|
|
@ -5,8 +5,8 @@ import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/fi
|
|||
import BoundToConfigObjProvider from 'ui/bound_to_config_obj';
|
||||
import dateTemplate from 'ui/stringify/editors/date.html';
|
||||
export default function DateTimeFormatProvider(Private) {
|
||||
var FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
var BoundToConfigObj = Private(BoundToConfigObjProvider);
|
||||
let FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
let BoundToConfigObj = Private(BoundToConfigObjProvider);
|
||||
|
||||
|
||||
_.class(DateTime).inherits(FieldFormat);
|
||||
|
@ -27,7 +27,7 @@ export default function DateTimeFormatProvider(Private) {
|
|||
template: dateTemplate,
|
||||
controllerAs: 'cntrl',
|
||||
controller: function ($interval, $scope) {
|
||||
var self = this;
|
||||
let self = this;
|
||||
self.sampleInputs = [
|
||||
Date.now(),
|
||||
+moment().startOf('year'),
|
||||
|
@ -43,11 +43,11 @@ export default function DateTimeFormatProvider(Private) {
|
|||
DateTime.prototype._convert = function (val) {
|
||||
// don't give away our ref to converter so
|
||||
// we can hot-swap when config changes
|
||||
var pattern = this.param('pattern');
|
||||
var timezone = this.param('timezone');
|
||||
let pattern = this.param('pattern');
|
||||
let timezone = this.param('timezone');
|
||||
|
||||
var timezoneChanged = this._timeZone !== timezone;
|
||||
var datePatternChanged = this._memoizedPattern !== pattern;
|
||||
let timezoneChanged = this._timeZone !== timezone;
|
||||
let datePatternChanged = this._memoizedPattern !== pattern;
|
||||
if (timezoneChanged || datePatternChanged) {
|
||||
this._timeZone = timezone;
|
||||
this._memoizedPattern = pattern;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import _ from 'lodash';
|
||||
import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format';
|
||||
export default function IpFormatProvider(Private) {
|
||||
var FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
let FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
|
||||
_.class(Ip).inherits(FieldFormat);
|
||||
function Ip(params) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import StringifyTypesNumeralProvider from 'ui/stringify/types/_numeral';
|
||||
|
||||
export default function NumberFormatProvider(Private) {
|
||||
var Numeral = Private(StringifyTypesNumeralProvider);
|
||||
let Numeral = Private(StringifyTypesNumeralProvider);
|
||||
return Numeral.factory({
|
||||
id: 'number',
|
||||
title: 'Number',
|
||||
|
|
|
@ -2,8 +2,8 @@ import _ from 'lodash';
|
|||
import BoundToConfigObjProvider from 'ui/bound_to_config_obj';
|
||||
import StringifyTypesNumeralProvider from 'ui/stringify/types/_numeral';
|
||||
export default function PercentFormatProvider(Private) {
|
||||
var BoundToConfigObj = Private(BoundToConfigObjProvider);
|
||||
var Numeral = Private(StringifyTypesNumeralProvider);
|
||||
let BoundToConfigObj = Private(BoundToConfigObjProvider);
|
||||
let Numeral = Private(StringifyTypesNumeralProvider);
|
||||
|
||||
return Numeral.factory({
|
||||
id: 'percent',
|
||||
|
|
|
@ -3,8 +3,8 @@ import noWhiteSpace from 'ui/utils/no_white_space';
|
|||
import angular from 'angular';
|
||||
import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format';
|
||||
export default function _SourceFormatProvider(Private, shortDotsFilter) {
|
||||
var FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
var template = _.template(noWhiteSpace(require('ui/stringify/types/_source.html')));
|
||||
let FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
let template = _.template(noWhiteSpace(require('ui/stringify/types/_source.html')));
|
||||
|
||||
_.class(Source).inherits(FieldFormat);
|
||||
function Source(params) {
|
||||
|
@ -20,15 +20,15 @@ export default function _SourceFormatProvider(Private, shortDotsFilter) {
|
|||
html: function sourceToHtml(source, field, hit) {
|
||||
if (!field) return this.getConverter('text')(source, field, hit);
|
||||
|
||||
var highlights = (hit && hit.highlight) || {};
|
||||
var formatted = field.indexPattern.formatHit(hit);
|
||||
var highlightPairs = [];
|
||||
var sourcePairs = [];
|
||||
let highlights = (hit && hit.highlight) || {};
|
||||
let formatted = field.indexPattern.formatHit(hit);
|
||||
let highlightPairs = [];
|
||||
let sourcePairs = [];
|
||||
|
||||
_.keys(formatted).forEach(function (key) {
|
||||
var pairs = highlights[key] ? highlightPairs : sourcePairs;
|
||||
var field = shortDotsFilter(key);
|
||||
var val = formatted[key];
|
||||
let pairs = highlights[key] ? highlightPairs : sourcePairs;
|
||||
let field = shortDotsFilter(key);
|
||||
let val = formatted[key];
|
||||
pairs.push([field, val]);
|
||||
}, []);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import _ from 'lodash';
|
|||
import 'ui/field_format_editor/samples/samples';
|
||||
import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format';
|
||||
export default function StringFormatProvider(Private) {
|
||||
var FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
let FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
|
||||
|
||||
_.class(_String).inherits(FieldFormat);
|
||||
|
|
|
@ -2,8 +2,8 @@ import _ from 'lodash';
|
|||
|
||||
import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format';
|
||||
export default function TruncateFormatProvider(Private) {
|
||||
var FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
var omission = '...';
|
||||
let FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
let omission = '...';
|
||||
|
||||
_.class(Truncate).inherits(FieldFormat);
|
||||
|
||||
|
@ -16,7 +16,7 @@ export default function TruncateFormatProvider(Private) {
|
|||
Truncate.fieldType = ['string'];
|
||||
|
||||
Truncate.prototype._convert = function (val) {
|
||||
var length = this.param('fieldLength');
|
||||
let length = this.param('fieldLength');
|
||||
if (length > 0) {
|
||||
return _.trunc(val, {
|
||||
'length': length + omission.length,
|
||||
|
|
|
@ -5,7 +5,7 @@ import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/fi
|
|||
import urlTemplate from 'ui/stringify/editors/url.html';
|
||||
export default function UrlFormatProvider(Private, highlightFilter) {
|
||||
|
||||
var FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
let FieldFormat = Private(IndexPatternsFieldFormatProvider);
|
||||
|
||||
|
||||
_.class(Url).inherits(FieldFormat);
|
||||
|
@ -31,7 +31,7 @@ export default function UrlFormatProvider(Private, highlightFilter) {
|
|||
template: urlTemplate,
|
||||
controllerAs: 'url',
|
||||
controller: function ($scope) {
|
||||
var iconPattern = '/bundles/src/ui/public/stringify/icons/{{value}}.png';
|
||||
let iconPattern = '/bundles/src/ui/public/stringify/icons/{{value}}.png';
|
||||
|
||||
this.samples = {
|
||||
a: [ 'john', '/some/pathname/asset.png', 1234 ],
|
||||
|
@ -39,7 +39,7 @@ export default function UrlFormatProvider(Private, highlightFilter) {
|
|||
};
|
||||
|
||||
$scope.$watch('editor.formatParams.type', function (type, prev) {
|
||||
var params = $scope.editor.formatParams;
|
||||
let params = $scope.editor.formatParams;
|
||||
if (type === 'img' && type !== prev && !params.urlTemplate) {
|
||||
params.urlTemplate = iconPattern;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ export default function UrlFormatProvider(Private, highlightFilter) {
|
|||
];
|
||||
|
||||
Url.prototype._formatUrl = function (value) {
|
||||
var template = this.param('urlTemplate');
|
||||
let template = this.param('urlTemplate');
|
||||
if (!template) return value;
|
||||
|
||||
return this._compileTemplate(template)({
|
||||
|
@ -70,7 +70,7 @@ export default function UrlFormatProvider(Private, highlightFilter) {
|
|||
};
|
||||
|
||||
Url.prototype._formatLabel = function (value, url) {
|
||||
var template = this.param('labelTemplate');
|
||||
let template = this.param('labelTemplate');
|
||||
if (url == null) url = this._formatUrl(value);
|
||||
if (!template) return url;
|
||||
|
||||
|
@ -86,8 +86,8 @@ export default function UrlFormatProvider(Private, highlightFilter) {
|
|||
},
|
||||
|
||||
html: function (rawValue, field, hit) {
|
||||
var url = _.escape(this._formatUrl(rawValue));
|
||||
var label = _.escape(this._formatLabel(rawValue, url));
|
||||
let url = _.escape(this._formatUrl(rawValue));
|
||||
let label = _.escape(this._formatLabel(rawValue, url));
|
||||
|
||||
switch (this.param('type')) {
|
||||
case 'img':
|
||||
|
@ -103,19 +103,19 @@ export default function UrlFormatProvider(Private, highlightFilter) {
|
|||
};
|
||||
|
||||
Url.prototype._compileTemplate = function (template) {
|
||||
var parts = template.split(Url.templateMatchRE).map(function (part, i) {
|
||||
let parts = template.split(Url.templateMatchRE).map(function (part, i) {
|
||||
// trim all the odd bits, the variable names
|
||||
return (i % 2) ? part.trim() : part;
|
||||
});
|
||||
|
||||
return function (locals) {
|
||||
// replace all the odd bits with their local var
|
||||
var output = '';
|
||||
var i = -1;
|
||||
let output = '';
|
||||
let i = -1;
|
||||
while (++i < parts.length) {
|
||||
if (i % 2) {
|
||||
if (locals.hasOwnProperty(parts[i])) {
|
||||
var local = locals[parts[i]];
|
||||
let local = locals[parts[i]];
|
||||
output += local == null ? '' : local;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -2,15 +2,15 @@ import _ from 'lodash';
|
|||
import $ from 'jquery';
|
||||
import 'ui/config';
|
||||
import uiModules from 'ui/modules';
|
||||
var $style = $('<style>').appendTo('head').attr('id', 'style-compile');
|
||||
let $style = $('<style>').appendTo('head').attr('id', 'style-compile');
|
||||
|
||||
|
||||
uiModules
|
||||
.get('kibana')
|
||||
.run(function ($rootScope, $compile, config) {
|
||||
var truncateGradientHeight = 15;
|
||||
var template = _.template(require('./style_compile.css.tmpl'));
|
||||
var locals = {};
|
||||
let truncateGradientHeight = 15;
|
||||
let template = _.template(require('./style_compile.css.tmpl'));
|
||||
let locals = {};
|
||||
|
||||
// watch the value of the truncate:maxHeight config param
|
||||
$rootScope.$watch(function () {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import _ from 'lodash';
|
||||
import VisRenderbotProvider from 'ui/vis/renderbot';
|
||||
export default function TemplateRenderbotFactory(Private, $compile, $rootScope) {
|
||||
var Renderbot = Private(VisRenderbotProvider);
|
||||
let Renderbot = Private(VisRenderbotProvider);
|
||||
|
||||
_.class(TemplateRenderbot).inherits(Renderbot);
|
||||
function TemplateRenderbot(vis, $el, uiState) {
|
||||
|
|
|
@ -2,8 +2,8 @@ import _ from 'lodash';
|
|||
import VisVisTypeProvider from 'ui/vis/vis_type';
|
||||
import TemplateVisTypeTemplateRenderbotProvider from 'ui/template_vis_type/template_renderbot';
|
||||
export default function TemplateVisTypeFactory(Private) {
|
||||
var VisType = Private(VisVisTypeProvider);
|
||||
var TemplateRenderbot = Private(TemplateVisTypeTemplateRenderbotProvider);
|
||||
let VisType = Private(VisVisTypeProvider);
|
||||
let TemplateRenderbot = Private(TemplateVisTypeTemplateRenderbotProvider);
|
||||
|
||||
_.class(TemplateVisType).inherits(VisType);
|
||||
function TemplateVisType(opts) {
|
||||
|
|
|
@ -18,8 +18,8 @@ $('body').attr('id', 'test-harness-body'); // so we can make high priority selec
|
|||
|
||||
|
||||
/*** Setup seeded random ***/
|
||||
var seedInput = parse(window.location.href, true).query.seed;
|
||||
var seed = _.add(seedInput, 0) || Date.now();
|
||||
let seedInput = parse(window.location.href, true).query.seed;
|
||||
let seed = _.add(seedInput, 0) || Date.now();
|
||||
Math.random = _.bindKey(new Nonsense(seed), 'frac');
|
||||
Math.random.nonsense = new Nonsense(seed);
|
||||
console.log('Random-ness seed: ' + seed);
|
||||
|
@ -38,7 +38,7 @@ before(function () {
|
|||
this.timeout(30000);
|
||||
|
||||
let mapper;
|
||||
var Runner = window.Mocha.Runner;
|
||||
let Runner = window.Mocha.Runner;
|
||||
|
||||
Runner.prototype.emit = _.wrap(Runner.prototype.emit, function (emit, event, test, err) {
|
||||
if (err && mapper) err = mapper.mapError(err);
|
||||
|
|
|
@ -3,7 +3,7 @@ import moment from 'moment';
|
|||
export default function DateIntervalRoundingRulesProvider() {
|
||||
// these are the rounding rules used by roundInterval()
|
||||
|
||||
var roundingRules = [
|
||||
let roundingRules = [
|
||||
[ d(500, 'ms'), d(100, 'ms') ],
|
||||
[ d(5, 'second'), d(1, 'second') ],
|
||||
[ d(7.5, 'second'), d(5, 'second') ],
|
||||
|
@ -22,16 +22,16 @@ export default function DateIntervalRoundingRulesProvider() {
|
|||
[ Infinity, d(1, 'year') ]
|
||||
];
|
||||
|
||||
var revRoundingRules = roundingRules.slice(0).reverse();
|
||||
let revRoundingRules = roundingRules.slice(0).reverse();
|
||||
|
||||
function find(rules, check, last) {
|
||||
function pick(buckets, duration) {
|
||||
var target = duration / buckets;
|
||||
let target = duration / buckets;
|
||||
let lastResp;
|
||||
|
||||
for (var i = 0; i < rules.length; i++) {
|
||||
var rule = rules[i];
|
||||
var resp = check(rule[0], rule[1], target);
|
||||
for (let i = 0; i < rules.length; i++) {
|
||||
let rule = rules[i];
|
||||
let resp = check(rule[0], rule[1], target);
|
||||
|
||||
if (resp == null) {
|
||||
if (!last) continue;
|
||||
|
@ -44,12 +44,12 @@ export default function DateIntervalRoundingRulesProvider() {
|
|||
}
|
||||
|
||||
// fallback to just a number of milliseconds, ensure ms is >= 1
|
||||
var ms = Math.max(Math.floor(target), 1);
|
||||
let ms = Math.max(Math.floor(target), 1);
|
||||
return moment.duration(ms, 'ms');
|
||||
}
|
||||
|
||||
return function (buckets, duration) {
|
||||
var interval = pick(buckets, duration);
|
||||
let interval = pick(buckets, duration);
|
||||
if (interval) return moment.duration(interval._data);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ import moment from 'moment';
|
|||
import dateMath from 'ui/utils/date_math';
|
||||
export default function () {
|
||||
|
||||
var unitsDesc = dateMath.unitsDesc;
|
||||
var largeMax = unitsDesc.indexOf('M');
|
||||
let unitsDesc = dateMath.unitsDesc;
|
||||
let largeMax = unitsDesc.indexOf('M');
|
||||
|
||||
/**
|
||||
* Convert a moment.duration into an es
|
||||
|
@ -14,9 +14,9 @@ export default function () {
|
|||
* @return {object}
|
||||
*/
|
||||
function esDuration(duration) {
|
||||
for (var i = 0; i < unitsDesc.length; i++) {
|
||||
var unit = unitsDesc[i];
|
||||
var val = duration.as(unit);
|
||||
for (let i = 0; i < unitsDesc.length; i++) {
|
||||
let unit = unitsDesc[i];
|
||||
let val = duration.as(unit);
|
||||
// find a unit that rounds neatly
|
||||
if (val >= 1 && Math.floor(val) === val) {
|
||||
|
||||
|
@ -35,7 +35,7 @@ export default function () {
|
|||
}
|
||||
}
|
||||
|
||||
var ms = duration.as('ms');
|
||||
let ms = duration.as('ms');
|
||||
return {
|
||||
value: ms,
|
||||
unit: 'ms',
|
||||
|
|
|
@ -6,9 +6,9 @@ import TimeBucketsCalcAutoIntervalProvider from 'ui/time_buckets/calc_auto_inter
|
|||
import TimeBucketsCalcEsIntervalProvider from 'ui/time_buckets/calc_es_interval';
|
||||
export default function IntervalHelperProvider(Private, timefilter, config) {
|
||||
|
||||
var calcAuto = Private(TimeBucketsCalcAutoIntervalProvider);
|
||||
var calcEsInterval = Private(TimeBucketsCalcEsIntervalProvider);
|
||||
var tzOffset = moment().format('Z');
|
||||
let calcAuto = Private(TimeBucketsCalcAutoIntervalProvider);
|
||||
let calcEsInterval = Private(TimeBucketsCalcEsIntervalProvider);
|
||||
let tzOffset = moment().format('Z');
|
||||
|
||||
function isValidMoment(m) {
|
||||
return m && ('isValid' in m) && m.isValid();
|
||||
|
@ -51,11 +51,11 @@ export default function IntervalHelperProvider(Private, timefilter, config) {
|
|||
bounds = _.isArray(input) ? input : [];
|
||||
}
|
||||
|
||||
var moments = _(bounds)
|
||||
let moments = _(bounds)
|
||||
.map(_.ary(moment, 1))
|
||||
.sortBy(Number);
|
||||
|
||||
var valid = moments.size() === 2 && moments.every(isValidMoment);
|
||||
let valid = moments.size() === 2 && moments.every(isValidMoment);
|
||||
if (!valid) {
|
||||
this.clearBounds();
|
||||
throw new Error('invalid bounds set: ' + input);
|
||||
|
@ -133,7 +133,7 @@ export default function IntervalHelperProvider(Private, timefilter, config) {
|
|||
* @param {object|string|moment.duration} input - see desc
|
||||
*/
|
||||
TimeBuckets.prototype.setInterval = function (input) {
|
||||
var interval = input;
|
||||
let interval = input;
|
||||
|
||||
// selection object -> val
|
||||
if (_.isObject(input)) {
|
||||
|
@ -197,13 +197,13 @@ export default function IntervalHelperProvider(Private, timefilter, config) {
|
|||
* @return {[type]} [description]
|
||||
*/
|
||||
TimeBuckets.prototype.getInterval = function () {
|
||||
var self = this;
|
||||
var duration = self.getDuration();
|
||||
let self = this;
|
||||
let duration = self.getDuration();
|
||||
return decorateInterval(maybeScaleInterval(readInterval()));
|
||||
|
||||
// either pull the interval from state or calculate the auto-interval
|
||||
function readInterval() {
|
||||
var interval = self._i;
|
||||
let interval = self._i;
|
||||
if (moment.isDuration(interval)) return interval;
|
||||
return calcAuto.near(config.get('histogram:barTarget'), duration);
|
||||
}
|
||||
|
@ -212,8 +212,8 @@ export default function IntervalHelperProvider(Private, timefilter, config) {
|
|||
function maybeScaleInterval(interval) {
|
||||
if (!self.hasBounds()) return interval;
|
||||
|
||||
var maxLength = config.get('histogram:maxBars');
|
||||
var approxLen = duration / interval;
|
||||
let maxLength = config.get('histogram:maxBars');
|
||||
let approxLen = duration / interval;
|
||||
let scaled;
|
||||
|
||||
if (approxLen > maxLength) {
|
||||
|
@ -234,13 +234,13 @@ export default function IntervalHelperProvider(Private, timefilter, config) {
|
|||
|
||||
// append some TimeBuckets specific props to the interval
|
||||
function decorateInterval(interval) {
|
||||
var esInterval = calcEsInterval(interval);
|
||||
let esInterval = calcEsInterval(interval);
|
||||
interval.esValue = esInterval.value;
|
||||
interval.esUnit = esInterval.unit;
|
||||
interval.expression = esInterval.expression;
|
||||
interval.overflow = duration > interval ? moment.duration(interval - duration) : false;
|
||||
|
||||
var prettyUnits = moment.normalizeUnits(esInterval.unit);
|
||||
let prettyUnits = moment.normalizeUnits(esInterval.unit);
|
||||
if (esInterval.value === 1) {
|
||||
interval.description = prettyUnits;
|
||||
} else {
|
||||
|
@ -263,11 +263,11 @@ export default function IntervalHelperProvider(Private, timefilter, config) {
|
|||
* @return {string}
|
||||
*/
|
||||
TimeBuckets.prototype.getScaledDateFormat = function () {
|
||||
var interval = this.getInterval();
|
||||
var rules = config.get('dateFormat:scaled');
|
||||
let interval = this.getInterval();
|
||||
let rules = config.get('dateFormat:scaled');
|
||||
|
||||
for (var i = rules.length - 1; i >= 0; i--) {
|
||||
var rule = rules[i];
|
||||
for (let i = rules.length - 1; i >= 0; i--) {
|
||||
let rule = rules[i];
|
||||
if (!rule[0] || interval >= moment.duration(rule[0])) {
|
||||
return rule[1];
|
||||
}
|
||||
|
@ -278,23 +278,23 @@ export default function IntervalHelperProvider(Private, timefilter, config) {
|
|||
|
||||
|
||||
TimeBuckets.__cached__ = function (self) {
|
||||
var cache = {};
|
||||
var sameMoment = same(moment.isMoment);
|
||||
var sameDuration = same(moment.isDuration);
|
||||
let cache = {};
|
||||
let sameMoment = same(moment.isMoment);
|
||||
let sameDuration = same(moment.isDuration);
|
||||
|
||||
var desc = {
|
||||
let desc = {
|
||||
__cached__: {
|
||||
value: self
|
||||
},
|
||||
};
|
||||
|
||||
var breakers = {
|
||||
let breakers = {
|
||||
setBounds: 'bounds',
|
||||
clearBounds: 'bounds',
|
||||
setInterval: 'interval'
|
||||
};
|
||||
|
||||
var resources = {
|
||||
let resources = {
|
||||
bounds: {
|
||||
setup: function () {
|
||||
return [self._lb, self._ub];
|
||||
|
@ -326,16 +326,16 @@ export default function IntervalHelperProvider(Private, timefilter, config) {
|
|||
}
|
||||
|
||||
function cacheBreaker(prop) {
|
||||
var resource = resources[breakers[prop]];
|
||||
var setup = resource.setup;
|
||||
var changes = resource.changes;
|
||||
var deps = resource.deps;
|
||||
var fn = self[prop];
|
||||
let resource = resources[breakers[prop]];
|
||||
let setup = resource.setup;
|
||||
let changes = resource.changes;
|
||||
let deps = resource.deps;
|
||||
let fn = self[prop];
|
||||
|
||||
return {
|
||||
value: function cacheBreaker(input) {
|
||||
var prev = setup.call(self);
|
||||
var ret = fn.apply(self, arguments);
|
||||
let prev = setup.call(self);
|
||||
let ret = fn.apply(self, arguments);
|
||||
|
||||
if (changes.call(self, prev)) {
|
||||
cache = {};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import _ from 'lodash';
|
||||
import UtilsDiffTimePickerValsProvider from 'ui/utils/diff_time_picker_vals';
|
||||
export default function diffTimeProvider(Private) {
|
||||
var diff = Private(UtilsDiffTimePickerValsProvider);
|
||||
let diff = Private(UtilsDiffTimePickerValsProvider);
|
||||
|
||||
return function (self) {
|
||||
var oldRefreshInterval = _.clone(self.refreshInterval);
|
||||
let oldRefreshInterval = _.clone(self.refreshInterval);
|
||||
|
||||
return function () {
|
||||
if (diff(self.refreshInterval, oldRefreshInterval)) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import _ from 'lodash';
|
||||
import UtilsDiffTimePickerValsProvider from 'ui/utils/diff_time_picker_vals';
|
||||
export default function diffTimeProvider(Private) {
|
||||
var diff = Private(UtilsDiffTimePickerValsProvider);
|
||||
let diff = Private(UtilsDiffTimePickerValsProvider);
|
||||
|
||||
return function (self) {
|
||||
var oldTime = _.clone(self.time);
|
||||
let oldTime = _.clone(self.time);
|
||||
return function () {
|
||||
if (diff(self.time, oldTime)) {
|
||||
self.emit('update');
|
||||
|
|
|
@ -20,12 +20,12 @@ uiModules
|
|||
.get('kibana')
|
||||
.service('timefilter', function (Private, globalState, $rootScope, config) {
|
||||
|
||||
var Events = Private(EventsProvider);
|
||||
var diff = Private(UtilsDiffTimePickerValsProvider);
|
||||
let Events = Private(EventsProvider);
|
||||
let diff = Private(UtilsDiffTimePickerValsProvider);
|
||||
|
||||
|
||||
function convertISO8601(stringTime) {
|
||||
var obj = moment(stringTime, 'YYYY-MM-DDTHH:mm:ss.SSSZ', true);
|
||||
let obj = moment(stringTime, 'YYYY-MM-DDTHH:mm:ss.SSSZ', true);
|
||||
return obj.isValid() ? obj : stringTime;
|
||||
}
|
||||
|
||||
|
@ -33,9 +33,9 @@ uiModules
|
|||
function Timefilter() {
|
||||
Timefilter.Super.call(this);
|
||||
|
||||
var self = this;
|
||||
var diffTime = Private(TimefilterLibDiffTimeProvider)(self);
|
||||
var diffInterval = Private(TimefilterLibDiffIntervalProvider)(self);
|
||||
let self = this;
|
||||
let diffTime = Private(TimefilterLibDiffTimeProvider)(self);
|
||||
let diffInterval = Private(TimefilterLibDiffIntervalProvider)(self);
|
||||
|
||||
self.enabled = false;
|
||||
|
||||
|
@ -45,8 +45,8 @@ uiModules
|
|||
});
|
||||
|
||||
self.consumeDefaults = _.once(function () {
|
||||
var timeDefaults = config.get('timepicker:timeDefaults');
|
||||
var refreshIntervalDefaults = config.get('timepicker:refreshIntervalDefaults');
|
||||
let timeDefaults = config.get('timepicker:timeDefaults');
|
||||
let refreshIntervalDefaults = config.get('timepicker:refreshIntervalDefaults');
|
||||
|
||||
// These can be date math strings or moments.
|
||||
self.time = _.defaults(globalState.time || {}, timeDefaults);
|
||||
|
@ -54,8 +54,8 @@ uiModules
|
|||
|
||||
globalState.on('fetch_with_changes', function () {
|
||||
// clone and default to {} in one
|
||||
var newTime = _.defaults({}, globalState.time, timeDefaults);
|
||||
var newRefreshInterval = _.defaults({}, globalState.refreshInterval, refreshIntervalDefaults);
|
||||
let newTime = _.defaults({}, globalState.time, timeDefaults);
|
||||
let newRefreshInterval = _.defaults({}, globalState.refreshInterval, refreshIntervalDefaults);
|
||||
|
||||
if (newTime) {
|
||||
if (newTime.to) newTime.to = convertISO8601(newTime.to);
|
||||
|
@ -85,10 +85,10 @@ uiModules
|
|||
|
||||
Timefilter.prototype.get = function (indexPattern) {
|
||||
let filter;
|
||||
var timefield = indexPattern.timeFieldName && _.find(indexPattern.fields, {name: indexPattern.timeFieldName});
|
||||
let timefield = indexPattern.timeFieldName && _.find(indexPattern.fields, {name: indexPattern.timeFieldName});
|
||||
|
||||
if (timefield) {
|
||||
var bounds = this.getBounds();
|
||||
let bounds = this.getBounds();
|
||||
filter = {range : {}};
|
||||
filter.range[timefield.name] = {
|
||||
gte: bounds.min.valueOf(),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import uiModules from 'ui/modules';
|
||||
var module = uiModules.get('kibana');
|
||||
let module = uiModules.get('kibana');
|
||||
|
||||
module.constant('quickRanges', [
|
||||
{ from: 'now/d', to: 'now/d', display: 'Today', section: 0 },
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import uiModules from 'ui/modules';
|
||||
var module = uiModules.get('kibana');
|
||||
let module = uiModules.get('kibana');
|
||||
|
||||
module.constant('refreshIntervals', [
|
||||
{ value : 0, display: 'Off', section: 0},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import uiModules from 'ui/modules';
|
||||
var module = uiModules.get('kibana');
|
||||
let module = uiModules.get('kibana');
|
||||
|
||||
module.constant('timeUnits', {
|
||||
s: 'second',
|
||||
|
|
|
@ -10,8 +10,8 @@ import 'ui/timepicker/refresh_intervals';
|
|||
import 'ui/timepicker/time_units';
|
||||
import 'ui/timepicker/kbn_global_timepicker';
|
||||
import uiModules from 'ui/modules';
|
||||
var module = uiModules.get('ui/timepicker');
|
||||
var notify = new Notifier({
|
||||
let module = uiModules.get('ui/timepicker');
|
||||
let notify = new Notifier({
|
||||
location: 'timepicker',
|
||||
});
|
||||
|
||||
|
@ -28,7 +28,7 @@ module.directive('kbnTimepicker', function (quickRanges, timeUnits, refreshInter
|
|||
},
|
||||
template: html,
|
||||
controller: function ($scope) {
|
||||
var init = function () {
|
||||
let init = function () {
|
||||
$scope.setMode($scope.mode);
|
||||
};
|
||||
|
||||
|
@ -78,8 +78,8 @@ module.directive('kbnTimepicker', function (quickRanges, timeUnits, refreshInter
|
|||
case 'quick':
|
||||
break;
|
||||
case 'relative':
|
||||
var fromParts = $scope.from.toString().split('-');
|
||||
var relativeParts = [];
|
||||
let fromParts = $scope.from.toString().split('-');
|
||||
let relativeParts = [];
|
||||
|
||||
// Try to parse the relative time, if we can't use moment duration to guestimate
|
||||
if ($scope.to.toString() === 'now' && fromParts[0] === 'now' && fromParts[1]) {
|
||||
|
@ -89,11 +89,11 @@ module.directive('kbnTimepicker', function (quickRanges, timeUnits, refreshInter
|
|||
$scope.relative.count = parseInt(relativeParts[1], 10);
|
||||
$scope.relative.unit = relativeParts[2];
|
||||
} else {
|
||||
var duration = moment.duration(moment().diff(dateMath.parse($scope.from)));
|
||||
var units = _.pluck(_.clone($scope.relativeOptions).reverse(), 'value');
|
||||
let duration = moment.duration(moment().diff(dateMath.parse($scope.from)));
|
||||
let units = _.pluck(_.clone($scope.relativeOptions).reverse(), 'value');
|
||||
if ($scope.from.toString().split('/')[1]) $scope.relative.round = true;
|
||||
for (var i = 0; i < units.length; i++) {
|
||||
var as = duration.as(units[i]);
|
||||
for (let i = 0; i < units.length; i++) {
|
||||
let as = duration.as(units[i]);
|
||||
if (as > 1) {
|
||||
$scope.relative.count = Math.round(as);
|
||||
$scope.relative.unit = units[i];
|
||||
|
@ -125,7 +125,7 @@ module.directive('kbnTimepicker', function (quickRanges, timeUnits, refreshInter
|
|||
};
|
||||
|
||||
$scope.formatRelative = function () {
|
||||
var parsed = dateMath.parse(getRelativeString());
|
||||
let parsed = dateMath.parse(getRelativeString());
|
||||
$scope.relative.preview = parsed ? parsed.format($scope.format) : undefined;
|
||||
return parsed;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import _ from 'lodash';
|
||||
import 'ui/notify/directives';
|
||||
import uiModules from 'ui/modules';
|
||||
var typeahead = uiModules.get('kibana/typeahead');
|
||||
let typeahead = uiModules.get('kibana/typeahead');
|
||||
|
||||
|
||||
typeahead.directive('kbnTypeaheadInput', function ($rootScope) {
|
||||
|
@ -11,8 +11,8 @@ typeahead.directive('kbnTypeaheadInput', function ($rootScope) {
|
|||
require: ['^ngModel', '^kbnTypeahead'],
|
||||
|
||||
link: function ($scope, $el, $attr, deps) {
|
||||
var model = deps[0];
|
||||
var typeaheadCtrl = deps[1];
|
||||
let model = deps[0];
|
||||
let typeaheadCtrl = deps[1];
|
||||
|
||||
typeaheadCtrl.setInputModel(model);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import _ from 'lodash';
|
|||
import listTemplate from 'ui/typeahead/partials/typeahead-items.html';
|
||||
import 'ui/notify/directives';
|
||||
import uiModules from 'ui/modules';
|
||||
var typeahead = uiModules.get('kibana/typeahead');
|
||||
let typeahead = uiModules.get('kibana/typeahead');
|
||||
|
||||
|
||||
typeahead.directive('kbnTypeaheadItems', function () {
|
||||
|
|
|
@ -3,11 +3,11 @@ import 'ui/typeahead/typeahead.less';
|
|||
import 'ui/typeahead/_input';
|
||||
import 'ui/typeahead/_items';
|
||||
import uiModules from 'ui/modules';
|
||||
var typeahead = uiModules.get('kibana/typeahead');
|
||||
let typeahead = uiModules.get('kibana/typeahead');
|
||||
|
||||
|
||||
typeahead.directive('kbnTypeahead', function () {
|
||||
var keyMap = {
|
||||
let keyMap = {
|
||||
ESC: 27,
|
||||
UP: 38,
|
||||
DOWN: 40,
|
||||
|
@ -23,7 +23,7 @@ typeahead.directive('kbnTypeahead', function () {
|
|||
controllerAs: 'typeahead',
|
||||
|
||||
controller: function ($scope, $element, $timeout, PersistedLog, config) {
|
||||
var self = this;
|
||||
let self = this;
|
||||
self.form = $element.closest('form');
|
||||
self.query = '';
|
||||
self.hidden = true;
|
||||
|
@ -76,7 +76,7 @@ typeahead.directive('kbnTypeahead', function () {
|
|||
};
|
||||
|
||||
self.activateNext = function () {
|
||||
var index = self.getActiveIndex();
|
||||
let index = self.getActiveIndex();
|
||||
if (index == null) {
|
||||
index = 0;
|
||||
} else if (index < $scope.filteredItems.length - 1) {
|
||||
|
@ -87,7 +87,7 @@ typeahead.directive('kbnTypeahead', function () {
|
|||
};
|
||||
|
||||
self.activatePrev = function () {
|
||||
var index = self.getActiveIndex();
|
||||
let index = self.getActiveIndex();
|
||||
|
||||
if (index > 0 && index != null) {
|
||||
--index;
|
||||
|
@ -138,7 +138,7 @@ typeahead.directive('kbnTypeahead', function () {
|
|||
};
|
||||
|
||||
self.keypressHandler = function (ev) {
|
||||
var keyCode = ev.which || ev.keyCode;
|
||||
let keyCode = ev.which || ev.keyCode;
|
||||
|
||||
if (self.focused) {
|
||||
self.hidden = false;
|
||||
|
@ -194,11 +194,11 @@ typeahead.directive('kbnTypeahead', function () {
|
|||
}
|
||||
|
||||
// update the filteredItems using the query
|
||||
var beginningMatches = $scope.items.filter(function (item) {
|
||||
let beginningMatches = $scope.items.filter(function (item) {
|
||||
return item.indexOf(query) === 0;
|
||||
});
|
||||
|
||||
var otherMatches = $scope.items.filter(function (item) {
|
||||
let otherMatches = $scope.items.filter(function (item) {
|
||||
return item.indexOf(query) > 0;
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue