mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Merge branch 'master' of github.com:elastic/kibana into chore/reorganizeVisClasses
This commit is contained in:
commit
ec6d04b4a2
142 changed files with 798 additions and 962 deletions
|
@ -650,7 +650,7 @@ While you can do it with pure JS, a utility will remove a lot of boilerplate, an
|
|||
```js
|
||||
// uses a lodash inherits mixin
|
||||
// inheritance is defined first - it's easier to read and the function will be hoisted
|
||||
_(Square).inherits(Shape);
|
||||
_.class(Square).inherits(Shape);
|
||||
|
||||
function Square(width, height) {
|
||||
Square.Super.call(this);
|
||||
|
|
|
@ -38,14 +38,13 @@
|
|||
"leaflet": "0.7.3",
|
||||
"Leaflet.heat": "Leaflet/Leaflet.heat#627ede7c11bbe43",
|
||||
"lesshat": "3.0.2",
|
||||
"lodash": "2.4.2",
|
||||
"lodash": "3.9.3",
|
||||
"moment": "2.10.3",
|
||||
"moment-timezone": "0.4.0",
|
||||
"ng-clip": "0.2.6",
|
||||
"require-css": "0.1.8",
|
||||
"requirejs": "2.1.18",
|
||||
"requirejs-text": "2.0.14",
|
||||
"lodash-deep": "spenceralger/lodash-deep#1a7eca8344",
|
||||
"marked": "0.3.3",
|
||||
"numeral": "1.5.3",
|
||||
"leaflet-draw": "0.2.4"
|
||||
|
|
|
@ -29,7 +29,7 @@ exported.
|
|||
years.
|
||||
* {k4pull}3273[Pull Request 3273]: Line smoothing for for line and area charts.
|
||||
* {k4pull}3464[Pull Request 3464]: You can now specify the extent of the Y axis for charts.
|
||||
* {k4pull}3526[Pull Request 3526]: You can add columns to Dicover's list of results directly from an entry's table of
|
||||
* {k4pull}3526[Pull Request 3526]: You can add columns to Discover's list of results directly from an entry's table of
|
||||
fields.
|
||||
* {k4pull}3671[Pull Request 3671]: Tile maps now support latitude/longitude filtering.
|
||||
* {k4pull}3800[Pull Request 3800]: You can now pause auto-refresh on a dashboard.
|
||||
|
|
|
@ -58,11 +58,9 @@
|
|||
"http-auth": "^2.2.5",
|
||||
"joi": "^6.4.3",
|
||||
"js-yaml": "^3.2.5",
|
||||
"lodash": "^3.9.3",
|
||||
"json-stringify-safe": "^5.0.1",
|
||||
"lodash": "^2.4.1",
|
||||
"lodash-deep": "^1.6.0",
|
||||
"moment": "^2.10.3",
|
||||
"morgan": "~1.5.1",
|
||||
"numeral": "^1.5.3",
|
||||
"request": "^2.40.0",
|
||||
"requirefrom": "^0.2.0",
|
||||
|
|
|
@ -34,8 +34,8 @@ define(function (require) {
|
|||
properties: {
|
||||
min: _.min(values),
|
||||
max: _.max(values),
|
||||
zoom: _.deepGet(geoAgg, 'params.mapZoom'),
|
||||
center: _.deepGet(geoAgg, 'params.mapCenter')
|
||||
zoom: _.get(geoAgg, 'params.mapZoom'),
|
||||
center: _.get(geoAgg, 'params.mapCenter')
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4,9 +4,9 @@ define(function (require) {
|
|||
var nextChildren = _.pluck(children, 'children');
|
||||
var keys = _.pluck(children, 'name');
|
||||
return _(nextChildren)
|
||||
.map(collectKeys)
|
||||
.flatten()
|
||||
.union(keys)
|
||||
.value();
|
||||
.map(collectKeys)
|
||||
.flattenDeep()
|
||||
.union(keys)
|
||||
.value();
|
||||
};
|
||||
});
|
||||
|
|
|
@ -21,7 +21,9 @@ define(function (require) {
|
|||
}
|
||||
|
||||
// Create the columns
|
||||
results.columns = _(aggs).flatten().map(function (agg) {
|
||||
results.columns = _(aggs)
|
||||
.flattenDeep()
|
||||
.map(function (agg) {
|
||||
return {
|
||||
categoryName: agg.schema.name,
|
||||
id: agg.id,
|
||||
|
@ -30,7 +32,8 @@ define(function (require) {
|
|||
field: agg.params.field,
|
||||
label: agg.type.makeLabel(agg)
|
||||
};
|
||||
}).value();
|
||||
})
|
||||
.value();
|
||||
|
||||
|
||||
// if there are no buckets then we need to just set the value and return
|
||||
|
@ -58,7 +61,7 @@ define(function (require) {
|
|||
// iterate through all the buckets
|
||||
_.each(extractBuckets(data[agg.id]), function (bucket) {
|
||||
|
||||
var _record = _.flatten([record, bucket.key]);
|
||||
var _record = _.flattenDeep([record, bucket.key]);
|
||||
_.each(metrics, function (metric) {
|
||||
var value = bucket.doc_count;
|
||||
if (bucket[metric.id] && !_.isUndefined(bucket[metric.id].value)) {
|
||||
|
|
|
@ -7,7 +7,7 @@ define(function (require) {
|
|||
|
||||
var AggConfigResult = require('components/vis/AggConfigResult');
|
||||
|
||||
_(SplitAcr).inherits(AggConfigResult);
|
||||
_.class(SplitAcr).inherits(AggConfigResult);
|
||||
function SplitAcr(agg, parent, key) {
|
||||
SplitAcr.Super.call(this, agg, parent, key, key);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ define(function (require) {
|
|||
* @extends IndexedArray
|
||||
* @param {object[]} params - array of params that get new-ed up as AggParam objects as descibed above
|
||||
*/
|
||||
_(AggParams).inherits(IndexedArray);
|
||||
_.class(AggParams).inherits(IndexedArray);
|
||||
function AggParams(params) {
|
||||
AggParams.Super.call(this, {
|
||||
index: ['name'],
|
||||
|
|
|
@ -3,7 +3,7 @@ define(function (require) {
|
|||
var _ = require('lodash');
|
||||
var AggType = Private(require('components/agg_types/_agg_type'));
|
||||
|
||||
_(BucketAggType).inherits(AggType);
|
||||
_.class(BucketAggType).inherits(AggType);
|
||||
function BucketAggType(config) {
|
||||
BucketAggType.Super.call(this, config);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ define(function (require) {
|
|||
return function CreateFilterFiltersProvider(Private) {
|
||||
return function (aggConfig, key) {
|
||||
// have the aggConfig write agg dsl params
|
||||
var dslFilters = _.deepGet(aggConfig.toDsl(), 'filters.filters');
|
||||
var dslFilters = _.get(aggConfig.toDsl(), 'filters.filters');
|
||||
var filter = dslFilters[key];
|
||||
|
||||
if (filter) {
|
||||
|
|
|
@ -15,7 +15,7 @@ define(function (require) {
|
|||
{
|
||||
name: 'filters',
|
||||
editor: require('text!components/agg_types/controls/filters.html'),
|
||||
default: [ {input: {}} ],
|
||||
default: [ {input: {}, label: ''} ],
|
||||
write: function (aggConfig, output) {
|
||||
var inFilters = aggConfig.params.filters;
|
||||
if (!_.size(inFilters)) return;
|
||||
|
@ -29,7 +29,7 @@ define(function (require) {
|
|||
|
||||
decorateQuery(query);
|
||||
|
||||
var label = _.deepGet(query, 'query_string.query') || angular.toJson(query);
|
||||
var label = filter.label || _.get(query, 'query_string.query') || angular.toJson(query);
|
||||
filters[label] = input;
|
||||
}, {});
|
||||
|
||||
|
|
|
@ -1,19 +1,43 @@
|
|||
<div class="form-group">
|
||||
<div ng-repeat="filter in agg.params.filters">
|
||||
<label>Filter {{$index + 1}}</label>
|
||||
<div class="form-group vis-editor-agg-form-row">
|
||||
<div class="vis-editor-agg-header">
|
||||
<label>
|
||||
Filter {{$index + 1}}
|
||||
<span ng-if="filter.label">- {{ filter.label }}</span>
|
||||
</label>
|
||||
|
||||
<div class="btn-group">
|
||||
<button
|
||||
ng-click="showConfig = !showConfig"
|
||||
type="button"
|
||||
class="btn btn-default btn-xs">
|
||||
<i class="fa fa-tag"></i>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
ng-click="agg.params.filters.splice($index, 1)"
|
||||
class="btn btn-danger btn-xs">
|
||||
<i class="fa fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input validate-query
|
||||
ng-model="filter.input.query"
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="filter{{$index}}">
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
ng-click="agg.params.filters.splice($index, 1)"
|
||||
class="btn btn-danger btn-xs">
|
||||
<i class="fa fa-times"></i>
|
||||
</button>
|
||||
<div class="form-group" ng-show="showConfig">
|
||||
<label>Filter {{$index + 1}} label</label>
|
||||
<input
|
||||
ng-model="filter.label"
|
||||
placeholder="Label"
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="label{{$index}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@ define(function (require) {
|
|||
var AggType = Private(require('components/agg_types/_agg_type'));
|
||||
var fieldFormats = Private(require('registry/field_formats'));
|
||||
|
||||
_(MetricAggType).inherits(AggType);
|
||||
_.class(MetricAggType).inherits(AggType);
|
||||
function MetricAggType(config) {
|
||||
MetricAggType.Super.call(this, config);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ define(function (require) {
|
|||
var BaseAggParam = Private(require('components/agg_types/param_types/base'));
|
||||
var SavedObjectNotFound = require('errors').SavedObjectNotFound;
|
||||
|
||||
_(FieldAggParam).inherits(BaseAggParam);
|
||||
_.class(FieldAggParam).inherits(BaseAggParam);
|
||||
function FieldAggParam(config) {
|
||||
FieldAggParam.Super.call(this, config);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ define(function (require) {
|
|||
var IndexedArray = require('utils/indexed_array/index');
|
||||
var BaseAggParam = Private(require('components/agg_types/param_types/base'));
|
||||
|
||||
_(OptionedAggParam).inherits(BaseAggParam);
|
||||
_.class(OptionedAggParam).inherits(BaseAggParam);
|
||||
function OptionedAggParam(config) {
|
||||
OptionedAggParam.Super.call(this, config);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ define(function (require) {
|
|||
var BaseAggParam = Private(require('components/agg_types/param_types/base'));
|
||||
var editorHtml = require('text!components/agg_types/controls/raw_json.html');
|
||||
|
||||
_(RawJSONAggParam).inherits(BaseAggParam);
|
||||
_.class(RawJSONAggParam).inherits(BaseAggParam);
|
||||
function RawJSONAggParam(config) {
|
||||
// force name override
|
||||
config = _.defaults(config, { name: 'json' });
|
||||
|
|
|
@ -5,7 +5,7 @@ define(function (require) {
|
|||
var BaseAggParam = Private(require('components/agg_types/param_types/base'));
|
||||
var editorHtml = require('text!components/agg_types/controls/regular_expression.html');
|
||||
|
||||
_(RegexAggParam).inherits(BaseAggParam);
|
||||
_.class(RegexAggParam).inherits(BaseAggParam);
|
||||
function RegexAggParam(config) {
|
||||
// Java RegExp flags
|
||||
var flags = [
|
||||
|
|
|
@ -5,7 +5,7 @@ define(function (require) {
|
|||
var editorHtml = require('text!components/agg_types/controls/string.html');
|
||||
var BaseAggParam = Private(require('components/agg_types/param_types/base'));
|
||||
|
||||
_(ScriptAggParam).inherits(BaseAggParam);
|
||||
_.class(ScriptAggParam).inherits(BaseAggParam);
|
||||
function ScriptAggParam(config) {
|
||||
ScriptAggParam.Super.call(this, config);
|
||||
}
|
||||
|
|
|
@ -7,9 +7,8 @@ define(function (require) {
|
|||
require('modules')
|
||||
.get('kibana')
|
||||
.directive('collapsibleSidebar', function () {
|
||||
var listOfWidthClasses = 1;
|
||||
// simply a list of all of all of angulars .col-md-* classes except 12
|
||||
listOfWidthClasses = _(new Array(11)).map(function (n) { return 'col-md-' + listOfWidthClasses++; });
|
||||
var listOfWidthClasses = _.times(11, function (i) { return 'col-md-' + i; });
|
||||
|
||||
return {
|
||||
restrict: 'C',
|
||||
|
|
|
@ -120,8 +120,8 @@ define(function (require) {
|
|||
|
||||
// Listen for refreshInterval changes
|
||||
$rootScope.$watchCollection('timefilter.refreshInterval', function () {
|
||||
var refreshValue = _.deepGet($rootScope, 'timefilter.refreshInterval.value');
|
||||
var refreshPause = _.deepGet($rootScope, 'timefilter.refreshInterval.pause');
|
||||
var refreshValue = _.get($rootScope, 'timefilter.refreshInterval.value');
|
||||
var refreshPause = _.get($rootScope, 'timefilter.refreshInterval.pause');
|
||||
if (_.isNumber(refreshValue) && !refreshPause) {
|
||||
self.fetchInterval(refreshValue);
|
||||
} else {
|
||||
|
|
|
@ -9,7 +9,7 @@ define(function (require) {
|
|||
return function (query) {
|
||||
var queryOptions = config.get('query:queryString:options');
|
||||
|
||||
if (_.deepHas(query, 'query_string.query')) {
|
||||
if (_.has(query, 'query_string.query')) {
|
||||
_.extend(query.query_string, queryOptions);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ define(function (require) {
|
|||
var DocRequest = Private(require('components/courier/fetch/request/doc'));
|
||||
var docStrategy = Private(require('components/courier/fetch/strategy/doc'));
|
||||
|
||||
_(DocSource).inherits(SourceAbstract);
|
||||
_.class(DocSource).inherits(SourceAbstract);
|
||||
function DocSource(initialState) {
|
||||
DocSource.Super.call(this, initialState, docStrategy);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ define(function (require) {
|
|||
var searchStrategy = Private(require('components/courier/fetch/strategy/search'));
|
||||
var normalizeSortRequest = Private(require('components/courier/data_source/_normalize_sort_request'));
|
||||
|
||||
_(SearchSource).inherits(SourceAbstract);
|
||||
_.class(SearchSource).inherits(SourceAbstract);
|
||||
function SearchSource(initialState) {
|
||||
SearchSource.Super.call(this, initialState, searchStrategy);
|
||||
}
|
||||
|
@ -154,17 +154,12 @@ define(function (require) {
|
|||
case 'filter':
|
||||
// user a shallow flatten to detect if val is an array, and pull the values out if it is
|
||||
state.filters = _([ state.filters || [], val ])
|
||||
.flatten(true)
|
||||
// Yo Dawg! I heard you needed to filter out your filters
|
||||
.filter(function (filter) {
|
||||
if (!filter) return false;
|
||||
// return true for anything that is either empty or false
|
||||
// return false for anything that is explicitly set to true
|
||||
if (filter.meta)
|
||||
return !filter.meta.disabled;
|
||||
return true;
|
||||
})
|
||||
.value();
|
||||
.flatten()
|
||||
// Yo Dawg! I heard you needed to filter out your filters
|
||||
.reject(function (filter) {
|
||||
return !filter || _.get(filter, 'meta.disabled');
|
||||
})
|
||||
.value();
|
||||
return;
|
||||
case 'index':
|
||||
case 'type':
|
||||
|
|
|
@ -14,7 +14,7 @@ define(function (require) {
|
|||
*
|
||||
* @param {SegmentedRequest} - req - the requst this handle relates to
|
||||
*/
|
||||
_(SegmentedHandle).inherits(Events);
|
||||
_.class(SegmentedHandle).inherits(Events);
|
||||
function SegmentedHandle(req) {
|
||||
SegmentedHandle.Super.call(this);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ define(function (require) {
|
|||
var docStrategy = Private(require('components/courier/fetch/strategy/doc'));
|
||||
var AbstractRequest = Private(require('components/courier/fetch/request/request'));
|
||||
|
||||
_(DocRequest).inherits(AbstractRequest);
|
||||
_.class(DocRequest).inherits(AbstractRequest);
|
||||
function DocRequest(source, defer) {
|
||||
DocRequest.Super.call(this, source, defer);
|
||||
|
||||
|
|
|
@ -36,10 +36,7 @@ define(function (require) {
|
|||
source.activeFetchCount = 1;
|
||||
}
|
||||
|
||||
if (source.history) {
|
||||
source.history.push(this);
|
||||
source.history = _.last(source.history, 1);
|
||||
}
|
||||
source.history = [this];
|
||||
};
|
||||
|
||||
AbstractReq.prototype.getFetchParams = function () {
|
||||
|
|
|
@ -5,7 +5,7 @@ define(function (require) {
|
|||
var searchStrategy = Private(require('components/courier/fetch/strategy/search'));
|
||||
var AbstractRequest = Private(require('components/courier/fetch/request/request'));
|
||||
|
||||
_(SearchReq).inherits(AbstractRequest);
|
||||
_.class(SearchReq).inherits(AbstractRequest);
|
||||
var Super = SearchReq.Super;
|
||||
function SearchReq(source, defer) {
|
||||
Super.call(this, source, defer);
|
||||
|
|
|
@ -9,7 +9,7 @@ define(function (require) {
|
|||
location: 'Segmented Fetch'
|
||||
});
|
||||
|
||||
_(SegmentedReq).inherits(SearchReq);
|
||||
_.class(SegmentedReq).inherits(SearchReq);
|
||||
function SegmentedReq(source, defer, initFn) {
|
||||
SearchReq.call(this, source, defer);
|
||||
|
||||
|
@ -176,8 +176,8 @@ define(function (require) {
|
|||
this._complete.push(index);
|
||||
if (!seg) return; // segment was ignored/filtered, don't store it
|
||||
|
||||
var hadHits = _.deepGet(this._mergedResp, 'hits.hits.length') > 0;
|
||||
var gotHits = _.deepGet(seg, 'hits.hits.length') > 0;
|
||||
var hadHits = _.get(this._mergedResp, 'hits.hits.length') > 0;
|
||||
var gotHits = _.get(seg, 'hits.hits.length') > 0;
|
||||
var firstHits = !hadHits && gotHits;
|
||||
var haveHits = hadHits || gotHits;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ define(function (require) {
|
|||
return reqsFetchParams.map(function (fetchParams) {
|
||||
var indexList = fetchParams.index;
|
||||
|
||||
if (_.isFunction(_.deepGet(indexList, 'toIndexList'))) {
|
||||
if (_.isFunction(_.get(indexList, 'toIndexList'))) {
|
||||
var timeBounds = timefilter.getBounds();
|
||||
indexList = indexList.toIndexList(timeBounds.min, timeBounds.max);
|
||||
}
|
||||
|
@ -42,4 +42,4 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -246,7 +246,7 @@ define(function (require) {
|
|||
.then(finish)
|
||||
.catch(function (err) {
|
||||
// record exists, confirm overwriting
|
||||
if (_.deepGet(err, 'origError.status') === 409) {
|
||||
if (_.get(err, 'origError.status') === 409) {
|
||||
var confirmMessage = 'Are you sure you want to overwrite ' + self.title + '?';
|
||||
|
||||
if (window.confirm(confirmMessage)) {
|
||||
|
|
|
@ -18,7 +18,7 @@ define(function (require) {
|
|||
|
||||
var sortableField = function (field) {
|
||||
if (!$scope.indexPattern) return;
|
||||
var sortable = _.deepGet($scope.indexPattern.fields.byName[field], 'sortable');
|
||||
var sortable = _.get($scope.indexPattern.fields.byName[field], 'sortable');
|
||||
return sortable;
|
||||
};
|
||||
|
||||
|
@ -77,4 +77,4 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -28,7 +28,7 @@ define(function (require) {
|
|||
parts.push(baseTitle);
|
||||
}
|
||||
|
||||
return _(parts).flatten().compact().join(' - ');
|
||||
return _(parts).flattenDeep().compact().join(' - ');
|
||||
}
|
||||
|
||||
self.change = function (title, complete) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
var angular = require('angular');
|
||||
var inherits = require('lodash').inherits;
|
||||
|
||||
var canStack = (function () {
|
||||
var err = new Error();
|
||||
|
@ -24,7 +23,7 @@ define(function (require) {
|
|||
}
|
||||
}
|
||||
errors.KbnError = KbnError;
|
||||
inherits(KbnError, Error);
|
||||
_.class(KbnError).inherits(Error);
|
||||
|
||||
/**
|
||||
* HastyRefresh error class
|
||||
|
@ -35,7 +34,7 @@ define(function (require) {
|
|||
'Courier attempted to start a query before the previous had finished.',
|
||||
errors.HastyRefresh);
|
||||
};
|
||||
inherits(errors.HastyRefresh, KbnError);
|
||||
_.class(errors.HastyRefresh).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* SearchTimeout error class
|
||||
|
@ -45,7 +44,7 @@ define(function (require) {
|
|||
'All or part of your request has timed out. The data shown may be incomplete.',
|
||||
errors.SearchTimeout);
|
||||
};
|
||||
inherits(errors.SearchTimeout, KbnError);
|
||||
_.class(errors.SearchTimeout).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* Request Failure - When an entire mutli request fails
|
||||
|
@ -62,7 +61,7 @@ define(function (require) {
|
|||
this.origError = err;
|
||||
this.resp = resp;
|
||||
};
|
||||
inherits(errors.RequestFailure, KbnError);
|
||||
_.class(errors.RequestFailure).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* FetchFailure Error - when there is an error getting a doc or search within
|
||||
|
@ -76,7 +75,7 @@ define(function (require) {
|
|||
|
||||
this.resp = resp;
|
||||
};
|
||||
inherits(errors.FetchFailure, KbnError);
|
||||
_.class(errors.FetchFailure).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* ShardFailure Error - when one or more shards fail
|
||||
|
@ -88,7 +87,7 @@ define(function (require) {
|
|||
|
||||
this.resp = resp;
|
||||
};
|
||||
inherits(errors.ShardFailure, KbnError);
|
||||
_.class(errors.ShardFailure).inherits(KbnError);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -102,7 +101,7 @@ define(function (require) {
|
|||
|
||||
this.resp = resp;
|
||||
};
|
||||
inherits(errors.VersionConflict, KbnError);
|
||||
_.class(errors.VersionConflict).inherits(KbnError);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -114,7 +113,7 @@ define(function (require) {
|
|||
'Field "' + field + '" is defined with at least two different types in indices matching the pattern',
|
||||
errors.MappingConflict);
|
||||
};
|
||||
inherits(errors.MappingConflict, KbnError);
|
||||
_.class(errors.MappingConflict).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* a field mapping was using a restricted fields name
|
||||
|
@ -126,7 +125,7 @@ define(function (require) {
|
|||
|
||||
KbnError.call(this, msg, errors.RestrictedMapping);
|
||||
};
|
||||
inherits(errors.RestrictedMapping, KbnError);
|
||||
_.class(errors.RestrictedMapping).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* a non-critical cache write to elasticseach failed
|
||||
|
@ -136,7 +135,7 @@ define(function (require) {
|
|||
'A Elasticsearch cache write has failed.',
|
||||
errors.CacheWriteFailure);
|
||||
};
|
||||
inherits(errors.CacheWriteFailure, KbnError);
|
||||
_.class(errors.CacheWriteFailure).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* when a field mapping is requested for an unknown field
|
||||
|
@ -147,7 +146,7 @@ define(function (require) {
|
|||
'The ' + name + ' field was not found in the cached mappings',
|
||||
errors.FieldNotFoundInCache);
|
||||
};
|
||||
inherits(errors.FieldNotFoundInCache, KbnError);
|
||||
_.class(errors.FieldNotFoundInCache).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* when a mapping already exists for a field the user is attempting to add
|
||||
|
@ -158,7 +157,7 @@ define(function (require) {
|
|||
'The "' + name + '" field already exists in this mapping',
|
||||
errors.DuplicateField);
|
||||
};
|
||||
inherits(errors.DuplicateField, KbnError);
|
||||
_.class(errors.DuplicateField).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* A saved object was not found
|
||||
|
@ -172,7 +171,7 @@ define(function (require) {
|
|||
'Could not locate that ' + type + idMsg,
|
||||
errors.SavedObjectNotFound);
|
||||
};
|
||||
inherits(errors.SavedObjectNotFound, KbnError);
|
||||
_.class(errors.SavedObjectNotFound).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* Tried to call a method that relies on SearchSource having an indexPattern assigned
|
||||
|
@ -182,7 +181,7 @@ define(function (require) {
|
|||
'IndexPattern\'s configured pattern does not match any indices',
|
||||
errors.IndexPatternMissingIndices);
|
||||
};
|
||||
inherits(errors.IndexPatternMissingIndices, KbnError);
|
||||
_.class(errors.IndexPatternMissingIndices).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* Tried to call a method that relies on SearchSource having an indexPattern assigned
|
||||
|
@ -192,7 +191,7 @@ define(function (require) {
|
|||
'Define at least one index pattern to continue',
|
||||
errors.NoDefinedIndexPatterns);
|
||||
};
|
||||
inherits(errors.NoDefinedIndexPatterns, KbnError);
|
||||
_.class(errors.NoDefinedIndexPatterns).inherits(KbnError);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -203,7 +202,7 @@ define(function (require) {
|
|||
'Please specify a default index pattern',
|
||||
errors.NoDefaultIndexPattern);
|
||||
};
|
||||
inherits(errors.NoDefaultIndexPattern, KbnError);
|
||||
_.class(errors.NoDefaultIndexPattern).inherits(KbnError);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -215,7 +214,7 @@ define(function (require) {
|
|||
'This container is too small to render the visualization',
|
||||
errors.ContainerTooSmall);
|
||||
};
|
||||
inherits(errors.ContainerTooSmall, KbnError);
|
||||
_.class(errors.ContainerTooSmall).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* error thrown when user tries to render an chart with less
|
||||
|
@ -225,7 +224,7 @@ define(function (require) {
|
|||
errors.NotEnoughData = function NotEnoughData(message) {
|
||||
KbnError.call(this, message, errors.NotEnoughData);
|
||||
};
|
||||
inherits(errors.NotEnoughData, KbnError);
|
||||
_.class(errors.NotEnoughData).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* error thrown when no results are returned from an elasticsearch query
|
||||
|
@ -235,7 +234,7 @@ define(function (require) {
|
|||
'No results found',
|
||||
errors.NoResults);
|
||||
};
|
||||
inherits(errors.NoResults, KbnError);
|
||||
_.class(errors.NoResults).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* error thrown when no results are returned from an elasticsearch query
|
||||
|
@ -245,7 +244,7 @@ define(function (require) {
|
|||
'No results displayed because all values equal 0',
|
||||
errors.PieContainsAllZeros);
|
||||
};
|
||||
inherits(errors.PieContainsAllZeros, KbnError);
|
||||
_.class(errors.PieContainsAllZeros).inherits(KbnError);
|
||||
|
||||
/**
|
||||
* error thrown when no results are returned from an elasticsearch query
|
||||
|
@ -255,7 +254,7 @@ define(function (require) {
|
|||
'Values less than 1 cannot be displayed on a log scale',
|
||||
errors.InvalidLogScaleValues);
|
||||
};
|
||||
inherits(errors.InvalidLogScaleValues, KbnError);
|
||||
_.class(errors.InvalidLogScaleValues).inherits(KbnError);
|
||||
|
||||
/** error thrown when wiggle chart is selected for non linear data */
|
||||
errors.InvalidWiggleSelection = function InvalidWiggleSelection() {
|
||||
|
@ -263,7 +262,7 @@ define(function (require) {
|
|||
'In wiggle mode the area chart requires ordered values on the x-axis. Try using a Histogram or Date Histogram aggregation.',
|
||||
errors.InvalidWiggleSelection);
|
||||
};
|
||||
inherits(errors.InvalidWiggleSelection, KbnError);
|
||||
_.class(errors.InvalidWiggleSelection).inherits(KbnError);
|
||||
|
||||
return errors;
|
||||
});
|
||||
|
|
|
@ -27,7 +27,7 @@ define(function (require) {
|
|||
};
|
||||
|
||||
self.$$invalidModels = function (predicate) {
|
||||
predicate = _.createCallback(predicate);
|
||||
predicate = _.callback(predicate);
|
||||
|
||||
var invalid = [];
|
||||
|
||||
|
|
|
@ -17,15 +17,15 @@ define(function (require) {
|
|||
if (aggConfigResult) {
|
||||
var results = _.filter(aggConfigResult.getPath(), { type: 'bucket' });
|
||||
var filters = _(results)
|
||||
.map(function (result) {
|
||||
try {
|
||||
return result.createFilter();
|
||||
} catch (e) {
|
||||
notify.warning(e.message);
|
||||
}
|
||||
})
|
||||
.filter(Boolean)
|
||||
.value();
|
||||
.map(function (result) {
|
||||
try {
|
||||
return result.createFilter();
|
||||
} catch (e) {
|
||||
notify.warning(e.message);
|
||||
}
|
||||
})
|
||||
.filter(Boolean)
|
||||
.value();
|
||||
|
||||
if (!filters.length) return;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ define(function (require) {
|
|||
return Promise.method(function (filters) {
|
||||
// Assume all the index patterns are the same since they will be added
|
||||
// from the same visualization.
|
||||
var id = _.deepGet(filters, '[0].meta.index');
|
||||
var id = _.get(filters, '[0].meta.index');
|
||||
if (id == null) return;
|
||||
|
||||
return courier.indexPatterns.get(id).then(function (indexPattern) {
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
return function (filters) {
|
||||
return _(filters)
|
||||
.filter(function (filter) {
|
||||
return filter.meta.apply;
|
||||
})
|
||||
.value();
|
||||
return _.filter(filters, 'meta.apply');
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ define(function (require) {
|
|||
var _ = require('lodash');
|
||||
return function filterOutTimeBaseFilter(courier, Promise) {
|
||||
return Promise.method(function (filters) {
|
||||
var id = _.deepGet(filters, '[0].meta.index');
|
||||
var id = _.get(filters, '[0].meta.index');
|
||||
if (id == null) return;
|
||||
|
||||
return courier.indexPatterns.get(id).then(function (indexPattern) {
|
||||
|
|
|
@ -3,14 +3,12 @@ define(function (require) {
|
|||
return function mapAndFlattenFiltersProvider(Private, Promise) {
|
||||
var mapFilter = Private(require('components/filter_bar/lib/mapFilter'));
|
||||
return function (filters) {
|
||||
filters = _(filters)
|
||||
.filter(function (filter) {
|
||||
return filter;
|
||||
})
|
||||
.flatten(true)
|
||||
.value();
|
||||
|
||||
return Promise.map(filters, mapFilter);
|
||||
return _(filters)
|
||||
.flatten()
|
||||
.compact()
|
||||
.map(mapFilter)
|
||||
.thru(Promise.all)
|
||||
.value();
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ define(function (require) {
|
|||
var _ = require('lodash');
|
||||
|
||||
var pluckDisabled = function (filter) {
|
||||
return _.deepGet(filter, 'meta.disabled');
|
||||
return _.get(filter, 'meta.disabled');
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,7 @@ define(function (require) {
|
|||
filterManager.add = function (field, values, operation, index) {
|
||||
values = _.isArray(values) ? values : [values];
|
||||
var fieldName = _.isObject(field) ? field.name : field;
|
||||
var filters = _.flatten([queryFilter.getAppFilters()], true);
|
||||
var filters = _.flatten([queryFilter.getAppFilters()]);
|
||||
var newFilters = [];
|
||||
|
||||
var negate = (operation === '-');
|
||||
|
|
|
@ -42,7 +42,7 @@ define(function (require) {
|
|||
};
|
||||
}
|
||||
|
||||
unlisten = _.compose(
|
||||
unlisten = _.flow(
|
||||
bind($el, $scroller),
|
||||
bind($scroller, $el),
|
||||
function () { unlisten = _.noop; }
|
||||
|
|
|
@ -4,7 +4,7 @@ define(function (require) {
|
|||
var IndexedArray = require('utils/indexed_array/index');
|
||||
var _ = require('lodash');
|
||||
|
||||
_(FieldList).inherits(IndexedArray);
|
||||
_.class(FieldList).inherits(IndexedArray);
|
||||
function FieldList(indexPattern, specs) {
|
||||
FieldList.Super.call(this, {
|
||||
index: ['name'],
|
||||
|
|
|
@ -153,7 +153,7 @@ define(function (require) {
|
|||
self.popularizeField = function (fieldName, unit) {
|
||||
if (unit == null) unit = 1;
|
||||
|
||||
var field = _.deepGet(self, ['fields', 'byName', fieldName]);
|
||||
var field = _.get(self, ['fields', 'byName', fieldName]);
|
||||
if (!field) return;
|
||||
|
||||
var count = Math.max((field.count || 0) + unit, 0);
|
||||
|
@ -214,7 +214,7 @@ define(function (require) {
|
|||
.then(setId)
|
||||
.catch(function (err) {
|
||||
var confirmMessage = 'Are you sure you want to overwrite this?';
|
||||
if (_.deepGet(err, 'origError.status') === 409 && window.confirm(confirmMessage)) {
|
||||
if (_.get(err, 'origError.status') === 409 && window.confirm(confirmMessage)) {
|
||||
return docSource.doIndex(body).then(setId);
|
||||
}
|
||||
return Promise.resolve(false);
|
||||
|
|
|
@ -86,13 +86,18 @@ define(function (require) {
|
|||
})
|
||||
.then(function (resp) {
|
||||
// var all = Object.keys(resp).sort();
|
||||
var all = _(resp).map(function (index, key) {
|
||||
var all = _(resp)
|
||||
.map(function (index, key) {
|
||||
if (index.aliases) {
|
||||
return [Object.keys(index.aliases), key];
|
||||
} else {
|
||||
return key;
|
||||
}
|
||||
}).flatten().uniq().value().sort();
|
||||
})
|
||||
.flattenDeep()
|
||||
.sort()
|
||||
.uniq(true)
|
||||
.value();
|
||||
|
||||
var matches = all.filter(function (existingIndex) {
|
||||
var parsed = moment(existingIndex, indexPattern.id);
|
||||
|
|
|
@ -8,7 +8,7 @@ define(function (require) {
|
|||
}());
|
||||
|
||||
// abstract error class
|
||||
_(KibanaError).inherits(Error);
|
||||
_.class(KibanaError).inherits(Error);
|
||||
function KibanaError(msg, constructor) {
|
||||
this.message = msg;
|
||||
|
||||
|
@ -65,7 +65,7 @@ define(function (require) {
|
|||
'Unable to load ' + modules + ' because of ' + explain + '.',
|
||||
errors.ScriptLoadFailure);
|
||||
};
|
||||
_(errors.ScriptLoadFailure).inherits(KibanaError);
|
||||
_.class(errors.ScriptLoadFailure).inherits(KibanaError);
|
||||
|
||||
return errors;
|
||||
});
|
|
@ -11,7 +11,7 @@ define(function (require) {
|
|||
var MOUSE_EVENTS = 'mouseup';
|
||||
var WINDOW_EVENTS = 'resize';
|
||||
|
||||
_(ReflowWatcher).inherits(EventEmitter);
|
||||
_.class(ReflowWatcher).inherits(EventEmitter);
|
||||
/**
|
||||
* Watches global activity which might hint at a change in the content, which
|
||||
* in turn provides a hint to resizers that they should check their size
|
||||
|
|
|
@ -6,7 +6,7 @@ define(function (require) {
|
|||
// don't override other setup errors
|
||||
if (err && err instanceof SetupError) return err;
|
||||
|
||||
var err2 = new Error(_.template(template, { configFile: configFile }));
|
||||
var err2 = new Error(_.template(template)({ configFile: configFile }));
|
||||
if (err) {
|
||||
err2.origError = err;
|
||||
if (err.stack) err2.stack = err.stack;
|
||||
|
@ -15,4 +15,4 @@ define(function (require) {
|
|||
}
|
||||
return SetupError;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ define(function (require) {
|
|||
var State = Private(require('components/state_management/state'));
|
||||
|
||||
|
||||
_(AppState).inherits(State);
|
||||
_.class(AppState).inherits(State);
|
||||
function AppState(defaults) {
|
||||
AppState.Super.call(this, urlParam, defaults);
|
||||
getAppState._set(this);
|
||||
|
|
|
@ -9,7 +9,7 @@ define(function (require) {
|
|||
module.service('globalState', function (Private, $rootScope, $location) {
|
||||
var State = Private(require('components/state_management/state'));
|
||||
|
||||
_(GlobalState).inherits(State);
|
||||
_.class(GlobalState).inherits(State);
|
||||
function GlobalState(defaults) {
|
||||
GlobalState.Super.call(this, '_g', defaults);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ define(function (require) {
|
|||
return function StateProvider(Notifier, Private, $rootScope, $location) {
|
||||
var Events = Private(require('factories/events'));
|
||||
|
||||
_(State).inherits(Events);
|
||||
_.class(State).inherits(Events);
|
||||
function State(urlParam, defaults) {
|
||||
State.Super.call(this);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ define(function (require) {
|
|||
|
||||
require('components/field_format_editor/pattern/pattern');
|
||||
|
||||
_(DateTime).inherits(FieldFormat);
|
||||
_.class(DateTime).inherits(FieldFormat);
|
||||
function DateTime(params) {
|
||||
DateTime.Super.call(this, params);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ define(function (require) {
|
|||
var _ = require('lodash');
|
||||
var FieldFormat = Private(require('components/index_patterns/_field_format/FieldFormat'));
|
||||
|
||||
_(Ip).inherits(FieldFormat);
|
||||
_.class(Ip).inherits(FieldFormat);
|
||||
function Ip(params) {
|
||||
Ip.Super.call(this, params);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ define(function (require) {
|
|||
var template = _.template(noWhiteSpace(require('text!components/stringify/types/_source.html')));
|
||||
var angular = require('angular');
|
||||
|
||||
_(Source).inherits(FieldFormat);
|
||||
_.class(Source).inherits(FieldFormat);
|
||||
function Source(params) {
|
||||
Source.Super.call(this, params);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ define(function (require) {
|
|||
|
||||
require('components/field_format_editor/samples/samples');
|
||||
|
||||
_(_String).inherits(FieldFormat);
|
||||
_.class(_String).inherits(FieldFormat);
|
||||
function _String(params) {
|
||||
_String.Super.call(this, params);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ define(function (require) {
|
|||
var FieldFormat = Private(require('components/index_patterns/_field_format/FieldFormat'));
|
||||
require('components/field_format_editor/pattern/pattern');
|
||||
|
||||
_(Url).inherits(FieldFormat);
|
||||
_.class(Url).inherits(FieldFormat);
|
||||
function Url(params) {
|
||||
Url.Super.call(this, params);
|
||||
this._compileTemplate = _.memoize(this._compileTemplate);
|
||||
|
|
|
@ -6,7 +6,7 @@ define(function (require) {
|
|||
var numeral = require('numeral')();
|
||||
require('components/field_format_editor/numeral/numeral');
|
||||
|
||||
_(Numeral).inherits(FieldFormat);
|
||||
_.class(Numeral).inherits(FieldFormat);
|
||||
function Numeral(params) {
|
||||
Numeral.Super.call(this, params);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ define(function (require) {
|
|||
|
||||
|
||||
Numeral.factory = function (opts) {
|
||||
_(Class).inherits(Numeral);
|
||||
_.class(Class).inherits(Numeral);
|
||||
function Class(params) {
|
||||
Class.Super.call(this, params);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ define(function (require) {
|
|||
var _ = require('lodash');
|
||||
var Renderbot = Private(require('components/vis/Renderbot'));
|
||||
|
||||
_(TemplateRenderbot).inherits(Renderbot);
|
||||
_.class(TemplateRenderbot).inherits(Renderbot);
|
||||
function TemplateRenderbot(vis, $el) {
|
||||
TemplateRenderbot.Super.call(this, vis, $el);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ define(function (require) {
|
|||
var VisType = Private(require('components/vis/VisType'));
|
||||
var TemplateRenderbot = Private(require('components/template_vis_type/TemplateRenderbot'));
|
||||
|
||||
_(TemplateVisType).inherits(VisType);
|
||||
_.class(TemplateVisType).inherits(VisType);
|
||||
function TemplateVisType(opts) {
|
||||
TemplateVisType.Super.call(this, opts);
|
||||
|
||||
|
|
|
@ -51,8 +51,8 @@ define(function (require) {
|
|||
}
|
||||
|
||||
var moments = _(bounds)
|
||||
.map(function (time) { return moment(time); })
|
||||
.sortBy(Number);
|
||||
.map(_.ary(moment, 1))
|
||||
.sortBy(Number);
|
||||
|
||||
var valid = moments.size() === 2 && moments.every(isValidMoment);
|
||||
if (!valid) {
|
||||
|
@ -369,4 +369,4 @@ define(function (require) {
|
|||
|
||||
return TimeBuckets;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
return obj.isValid() ? obj : stringTime;
|
||||
}
|
||||
|
||||
_(Timefilter).inherits(Events);
|
||||
_.class(Timefilter).inherits(Events);
|
||||
function Timefilter() {
|
||||
Timefilter.Super.call(this);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ define(function (require) {
|
|||
|
||||
AggConfig.aggTypes = Private(require('components/agg_types/index'));
|
||||
|
||||
_(AggConfigs).inherits(IndexedArray);
|
||||
_.class(AggConfigs).inherits(IndexedArray);
|
||||
function AggConfigs(vis, configStates) {
|
||||
var self = this;
|
||||
self.vis = vis;
|
||||
|
@ -41,7 +41,8 @@ define(function (require) {
|
|||
self.push(new AggConfig(vis, state));
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +62,8 @@ define(function (require) {
|
|||
config: agg,
|
||||
dsl: agg.toDsl()
|
||||
};
|
||||
});
|
||||
})
|
||||
.value();
|
||||
}
|
||||
|
||||
this.getRequestAggs()
|
||||
|
|
|
@ -8,52 +8,53 @@ define(function (require) {
|
|||
var self = this;
|
||||
|
||||
_(schemas || [])
|
||||
.map(function (schema) {
|
||||
if (!schema.name) throw new Error('all schema must have a unique name');
|
||||
.map(function (schema) {
|
||||
if (!schema.name) throw new Error('all schema must have a unique name');
|
||||
|
||||
if (schema.name === 'split') {
|
||||
schema.params = [
|
||||
{
|
||||
name: 'row',
|
||||
default: true
|
||||
}
|
||||
];
|
||||
schema.editor = require('text!plugins/kbn_vislib_vis_types/controls/rows_or_columns.html');
|
||||
} else if (schema.name === 'radius') {
|
||||
schema.editor = require('text!plugins/kbn_vislib_vis_types/controls/radius_ratio_option.html');
|
||||
}
|
||||
if (schema.name === 'split') {
|
||||
schema.params = [
|
||||
{
|
||||
name: 'row',
|
||||
default: true
|
||||
}
|
||||
];
|
||||
schema.editor = require('text!plugins/kbn_vislib_vis_types/controls/rows_or_columns.html');
|
||||
} else if (schema.name === 'radius') {
|
||||
schema.editor = require('text!plugins/kbn_vislib_vis_types/controls/radius_ratio_option.html');
|
||||
}
|
||||
|
||||
_.defaults(schema, {
|
||||
min: 0,
|
||||
max: Infinity,
|
||||
group: 'buckets',
|
||||
title: schema.name,
|
||||
aggFilter: '*',
|
||||
editor: false,
|
||||
params: []
|
||||
});
|
||||
|
||||
// convert the params into a params registry
|
||||
schema.params = new AggParams(schema.params);
|
||||
|
||||
return schema;
|
||||
})
|
||||
.tap(function (schemas) {
|
||||
self.all = new IndexedArray({
|
||||
index: ['name'],
|
||||
group: ['group'],
|
||||
immutable: true,
|
||||
initialSet: schemas
|
||||
});
|
||||
})
|
||||
.groupBy('group')
|
||||
.forOwn(function (group, groupName) {
|
||||
self[groupName] = new IndexedArray({
|
||||
index: ['name'],
|
||||
immutable: true,
|
||||
initialSet: group
|
||||
});
|
||||
_.defaults(schema, {
|
||||
min: 0,
|
||||
max: Infinity,
|
||||
group: 'buckets',
|
||||
title: schema.name,
|
||||
aggFilter: '*',
|
||||
editor: false,
|
||||
params: []
|
||||
});
|
||||
|
||||
// convert the params into a params registry
|
||||
schema.params = new AggParams(schema.params);
|
||||
|
||||
return schema;
|
||||
})
|
||||
.tap(function (schemas) {
|
||||
self.all = new IndexedArray({
|
||||
index: ['name'],
|
||||
group: ['group'],
|
||||
immutable: true,
|
||||
initialSet: schemas
|
||||
});
|
||||
})
|
||||
.groupBy('group')
|
||||
.forOwn(function (group, groupName) {
|
||||
self[groupName] = new IndexedArray({
|
||||
index: ['name'],
|
||||
immutable: true,
|
||||
initialSet: group
|
||||
});
|
||||
})
|
||||
.commit();
|
||||
}
|
||||
|
||||
return Schemas;
|
||||
|
|
|
@ -16,7 +16,7 @@ define(function (require) {
|
|||
|
||||
return _.chain(obj)
|
||||
.pluck('series')
|
||||
.flatten()
|
||||
.flattenDeep()
|
||||
.value();
|
||||
};
|
||||
};
|
||||
|
|
|
@ -20,9 +20,9 @@ define(function (require) {
|
|||
|
||||
return _(charts ? charts : [obj])
|
||||
.pluck('series')
|
||||
.flatten()
|
||||
.flattenDeep()
|
||||
.pluck('values')
|
||||
.flatten()
|
||||
.flattenDeep()
|
||||
.filter(Boolean)
|
||||
.value();
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ define(function (require) {
|
|||
}
|
||||
|
||||
var objKeys = getUniqKeys(obj);
|
||||
var interval = _.deepGet(obj, 'ordered.interval');
|
||||
var interval = _.get(obj, 'ordered.interval');
|
||||
var dateInterval = moment.isDuration(interval) ? interval : false;
|
||||
|
||||
return _(objKeys)
|
||||
|
@ -34,7 +34,7 @@ define(function (require) {
|
|||
var val = +d[0];
|
||||
if (interval == null) return val;
|
||||
|
||||
var gapEdge = parseFloat(_.deepGet(list, [i + 1, 0]));
|
||||
var gapEdge = parseFloat(_.get(list, [i + 1, 0]));
|
||||
if (isNaN(gapEdge)) return val;
|
||||
|
||||
var vals = [];
|
||||
|
@ -55,7 +55,7 @@ define(function (require) {
|
|||
|
||||
return vals;
|
||||
})
|
||||
.flatten(true)
|
||||
.flatten()
|
||||
.value();
|
||||
};
|
||||
};
|
||||
|
|
|
@ -3,15 +3,13 @@ define(function (require) {
|
|||
var $ = require('jquery');
|
||||
var _ = require('lodash');
|
||||
|
||||
var ErrorHandler = Private(require('components/vislib/lib/_error_handler'));
|
||||
/**
|
||||
* Appends chart titles to the visualization
|
||||
* Adds allerts that float in front of a visualization
|
||||
*
|
||||
* @class Alerts
|
||||
* @constructor
|
||||
* @param el {HTMLElement} Reference to DOM element
|
||||
*/
|
||||
|
||||
function Alerts(vis, data, alertDefs) {
|
||||
if (!(this instanceof Alerts)) {
|
||||
return new Alerts(vis, data, alertDefs);
|
||||
|
|
|
@ -14,6 +14,7 @@ define(function (require) {
|
|||
* @param xTitle {String} X-axis title
|
||||
* @param yTitle {String} Y-axis title
|
||||
*/
|
||||
_.class(AxisTitle).inherits(ErrorHandler);
|
||||
function AxisTitle(el, xTitle, yTitle) {
|
||||
if (!(this instanceof AxisTitle)) {
|
||||
return new AxisTitle(el, xTitle, yTitle);
|
||||
|
@ -24,8 +25,6 @@ define(function (require) {
|
|||
this.yTitle = yTitle;
|
||||
}
|
||||
|
||||
_(AxisTitle.prototype).extend(ErrorHandler.prototype);
|
||||
|
||||
/**
|
||||
* Renders both x and y axis titles
|
||||
*
|
||||
|
|
|
@ -13,7 +13,7 @@ define(function (require) {
|
|||
* @constructor
|
||||
* @param el {HTMLElement} Reference to DOM element
|
||||
*/
|
||||
|
||||
_.class(ChartTitle).inherits(ErrorHandler);
|
||||
function ChartTitle(el) {
|
||||
if (!(this instanceof ChartTitle)) {
|
||||
return new ChartTitle(el);
|
||||
|
@ -25,8 +25,6 @@ define(function (require) {
|
|||
});
|
||||
}
|
||||
|
||||
_(ChartTitle.prototype).extend(ErrorHandler.prototype);
|
||||
|
||||
/**
|
||||
* Renders chart titles
|
||||
*
|
||||
|
|
|
@ -218,7 +218,7 @@ define(function (require) {
|
|||
Data.prototype.chartData = function () {
|
||||
if (!this.data.series) {
|
||||
var arr = this.data.rows ? this.data.rows : this.data.columns;
|
||||
return _.pluck(arr);
|
||||
return _.toArray(arr);
|
||||
}
|
||||
return [this.data];
|
||||
};
|
||||
|
@ -282,9 +282,9 @@ define(function (require) {
|
|||
Data.prototype.flatten = function () {
|
||||
return _(this.chartData())
|
||||
.pluck('series')
|
||||
.flatten()
|
||||
.flattenDeep()
|
||||
.pluck('values')
|
||||
.flatten()
|
||||
.flattenDeep()
|
||||
.value();
|
||||
};
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ define(function (require) {
|
|||
* @param handler {Object} Reference to Handler Class Object
|
||||
*/
|
||||
|
||||
_(Dispatch).inherits(SimpleEmitter);
|
||||
_.class(Dispatch).inherits(SimpleEmitter);
|
||||
function Dispatch(handler) {
|
||||
if (!(this instanceof Dispatch)) {
|
||||
return new Dispatch(handler);
|
||||
|
|
|
@ -54,7 +54,7 @@ define(function (require) {
|
|||
Layout.prototype.createLayout = function (arr) {
|
||||
var self = this;
|
||||
|
||||
return _(arr).forEach(function (obj) {
|
||||
return _.each(arr, function (obj) {
|
||||
self.layout(obj);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ define(function (require) {
|
|||
* @class ResizeChecker
|
||||
* @param {HtmlElement} el - the element to track the size of
|
||||
*/
|
||||
_(ResizeChecker).inherits(EventEmitter);
|
||||
_.class(ResizeChecker).inherits(EventEmitter);
|
||||
function ResizeChecker(el) {
|
||||
ResizeChecker.Super.call(this);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ define(function (require) {
|
|||
* @param args {{el: (HTMLElement), xValues: (Array), ordered: (Object|*),
|
||||
* xAxisFormatter: (Function), _attr: (Object|*)}}
|
||||
*/
|
||||
_.class(XAxis).inherits(ErrorHandler);
|
||||
function XAxis(args) {
|
||||
if (!(this instanceof XAxis)) {
|
||||
return new XAxis(args);
|
||||
|
@ -27,8 +28,6 @@ define(function (require) {
|
|||
this._attr = _.defaults(args._attr || {});
|
||||
}
|
||||
|
||||
_(XAxis.prototype).extend(ErrorHandler.prototype);
|
||||
|
||||
/**
|
||||
* Renders the x axis
|
||||
*
|
||||
|
|
|
@ -13,6 +13,7 @@ define(function (require) {
|
|||
* @constructor
|
||||
* @param args {{el: (HTMLElement), yMax: (Number), _attr: (Object|*)}}
|
||||
*/
|
||||
_.class(YAxis).inherits(ErrorHandler);
|
||||
function YAxis(args) {
|
||||
this.el = args.el;
|
||||
this.scale = null;
|
||||
|
@ -21,8 +22,6 @@ define(function (require) {
|
|||
this._attr = args._attr || {};
|
||||
}
|
||||
|
||||
_(YAxis.prototype).extend(ErrorHandler.prototype);
|
||||
|
||||
/**
|
||||
* Renders the y axis
|
||||
*
|
||||
|
|
|
@ -17,7 +17,7 @@ define(function (require) {
|
|||
* @param $el {HTMLElement} jQuery selected HTML element
|
||||
* @param config {Object} Parameters that define the chart type and chart options
|
||||
*/
|
||||
_(Vis).inherits(Events);
|
||||
_.class(Vis).inherits(Events);
|
||||
function Vis($el, config) {
|
||||
if (!(this instanceof Vis)) {
|
||||
return new Vis($el, config);
|
||||
|
|
|
@ -6,7 +6,7 @@ define(function (require) {
|
|||
var Tooltip = Private(require('components/vislib/components/tooltip/tooltip'));
|
||||
var touchdownTmpl = _.template(require('text!components/vislib/partials/touchdown.tmpl.html'));
|
||||
|
||||
_(PointSeriesChart).inherits(Chart);
|
||||
_.class(PointSeriesChart).inherits(Chart);
|
||||
function PointSeriesChart(handler, chartEl, chartData) {
|
||||
if (!(this instanceof PointSeriesChart)) {
|
||||
return new PointSeriesChart(handler, chartEl, chartData);
|
||||
|
|
|
@ -19,7 +19,7 @@ define(function (require) {
|
|||
* @param chartData {Object} Elasticsearch query results for this specific
|
||||
* chart
|
||||
*/
|
||||
_(AreaChart).inherits(PointSeriesChart);
|
||||
_.class(AreaChart).inherits(PointSeriesChart);
|
||||
function AreaChart(handler, chartEl, chartData) {
|
||||
if (!(this instanceof AreaChart)) {
|
||||
return new AreaChart(handler, chartEl, chartData);
|
||||
|
|
|
@ -21,7 +21,7 @@ define(function (require) {
|
|||
* @param el {HTMLElement} HTML element to which the chart will be appended
|
||||
* @param chartData {Object} Elasticsearch query results for this specific chart
|
||||
*/
|
||||
_(ColumnChart).inherits(PointSeriesChart);
|
||||
_.class(ColumnChart).inherits(PointSeriesChart);
|
||||
function ColumnChart(handler, chartEl, chartData) {
|
||||
if (!(this instanceof ColumnChart)) {
|
||||
return new ColumnChart(handler, chartEl, chartData);
|
||||
|
|
|
@ -18,7 +18,7 @@ define(function (require) {
|
|||
* @param el {HTMLElement} HTML element to which the chart will be appended
|
||||
* @param chartData {Object} Elasticsearch query results for this specific chart
|
||||
*/
|
||||
_(LineChart).inherits(PointSeriesChart);
|
||||
_.class(LineChart).inherits(PointSeriesChart);
|
||||
function LineChart(handler, chartEl, chartData) {
|
||||
if (!(this instanceof LineChart)) {
|
||||
return new LineChart(handler, chartEl, chartData);
|
||||
|
@ -74,14 +74,20 @@ define(function (require) {
|
|||
var ordered = this.handler.data.get('ordered');
|
||||
var tooltip = this.tooltip;
|
||||
var isTooltip = this._attr.addTooltip;
|
||||
|
||||
var radii = _(data)
|
||||
.map(function (series) { return _.map(series, function (point) { return point._input.z; }); })
|
||||
.flatten()
|
||||
.reduce(function (result, val) {
|
||||
if (result.min > val) result.min = val;
|
||||
if (result.max < val) result.max = val;
|
||||
return result;
|
||||
}, {min: Infinity, max: -Infinity});
|
||||
.map(function (series) {
|
||||
return _.pluck(series, '_input.z');
|
||||
})
|
||||
.flattenDeep()
|
||||
.reduce(function (result, val) {
|
||||
if (result.min > val) result.min = val;
|
||||
if (result.max < val) result.max = val;
|
||||
return result;
|
||||
}, {
|
||||
min: Infinity,
|
||||
max: -Infinity
|
||||
});
|
||||
|
||||
var radiusStep = ((radii.max - radii.min) || (radii.max * 100)) / Math.pow(this._attr.radiusRatio, 2);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ define(function (require) {
|
|||
* @param el {HTMLElement} HTML element to which the chart will be appended
|
||||
* @param chartData {Object} Elasticsearch query results for this specific chart
|
||||
*/
|
||||
_(PieChart).inherits(Chart);
|
||||
_.class(PieChart).inherits(Chart);
|
||||
function PieChart(handler, chartEl, chartData) {
|
||||
if (!(this instanceof PieChart)) {
|
||||
return new PieChart(handler, chartEl, chartData);
|
||||
|
|
|
@ -27,7 +27,7 @@ define(function (require) {
|
|||
* @param chartEl {HTMLElement} HTML element to which the map will be appended
|
||||
* @param chartData {Object} Elasticsearch query results for this map
|
||||
*/
|
||||
_(TileMap).inherits(Chart);
|
||||
_.class(TileMap).inherits(Chart);
|
||||
function TileMap(handler, chartEl, chartData) {
|
||||
if (!(this instanceof TileMap)) {
|
||||
return new TileMap(handler, chartEl, chartData);
|
||||
|
@ -41,8 +41,8 @@ define(function (require) {
|
|||
this.originalConfig = chartData || {};
|
||||
_.assign(this, this.originalConfig);
|
||||
|
||||
this._attr.mapZoom = _.deepGet(this.geoJson, 'properties.zoom') || defaultMapZoom;
|
||||
this._attr.mapCenter = _.deepGet(this.geoJson, 'properties.center') || defaultMapCenter;
|
||||
this._attr.mapZoom = _.get(this.geoJson, 'properties.zoom') || defaultMapZoom;
|
||||
this._attr.mapCenter = _.get(this.geoJson, 'properties.center') || defaultMapCenter;
|
||||
|
||||
// add allmin and allmax to geoJson
|
||||
var allMinMax = this.getMinMax(handler.data.data);
|
||||
|
@ -263,8 +263,8 @@ define(function (require) {
|
|||
*/
|
||||
TileMap.prototype._getDataRectangles = function () {
|
||||
return _(this.geoJson.features)
|
||||
.deepPluck('properties.rectangle')
|
||||
.map(function (rectangle) { return rectangle.map(cloneAndReverse); })
|
||||
.pluck('properties.rectangle')
|
||||
.invoke('map', cloneAndReverse)
|
||||
.value();
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ define(function (require) {
|
|||
var Renderbot = Private(require('components/vis/Renderbot'));
|
||||
var buildChartData = Private(require('components/vislib_vis_type/buildChartData'));
|
||||
|
||||
_(VislibRenderbot).inherits(Renderbot);
|
||||
_.class(VislibRenderbot).inherits(Renderbot);
|
||||
function VislibRenderbot(vis, $el) {
|
||||
VislibRenderbot.Super.call(this, vis, $el);
|
||||
this._createVis();
|
||||
|
|
|
@ -11,7 +11,7 @@ define(function (require) {
|
|||
require('plugins/kbn_vislib_vis_types/controls/point_series_options');
|
||||
require('plugins/kbn_vislib_vis_types/controls/line_interpolation_option');
|
||||
|
||||
_(VislibVisType).inherits(VisType);
|
||||
_.class(VislibVisType).inherits(VisType);
|
||||
function VislibVisType(opts) {
|
||||
opts = opts || {};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ define(function (require) {
|
|||
var SimpleEmitter = require('utils/SimpleEmitter');
|
||||
var notify = new Notifier({ location: 'EventEmitter' });
|
||||
|
||||
_(Events).inherits(SimpleEmitter);
|
||||
_.class(Events).inherits(SimpleEmitter);
|
||||
function Events() {
|
||||
Events.Super.call(this);
|
||||
this._listeners = {};
|
||||
|
|
|
@ -8,7 +8,7 @@ define(function (require) {
|
|||
|
||||
// SavedDashboard constructor. Usually you'd interact with an instance of this.
|
||||
// ID is option, without it one will be generated on save.
|
||||
_(SavedDashboard).inherits(courier.SavedObject);
|
||||
_.class(SavedDashboard).inherits(courier.SavedObject);
|
||||
function SavedDashboard(id) {
|
||||
// Gives our SavedDashboard the properties of a SavedObject
|
||||
courier.SavedObject.call(this, {
|
||||
|
|
|
@ -140,7 +140,8 @@ define(function (require) {
|
|||
})
|
||||
.each(function (group, name) {
|
||||
$scope[name + 'Fields'] = _.sortBy(group, name === 'selected' ? 'display' : 'name');
|
||||
});
|
||||
})
|
||||
.commit();
|
||||
|
||||
// include undefined so the user can clear the filter
|
||||
$scope.fieldTypes = _.union([undefined], _.pluck(fields, 'type'));
|
||||
|
@ -230,7 +231,6 @@ define(function (require) {
|
|||
if (!indexPattern || !hits || !fieldCounts) return;
|
||||
|
||||
var fieldSpecs = indexPattern.fields.slice(0);
|
||||
|
||||
var fieldNamesInDocs = _.keys(fieldCounts);
|
||||
var fieldNamesInIndexPattern = _.keys(indexPattern.fields.byName);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ define(function (require) {
|
|||
]);
|
||||
|
||||
module.factory('SavedSearch', function (courier) {
|
||||
_(SavedSearch).inherits(courier.SavedObject);
|
||||
_.class(SavedSearch).inherits(courier.SavedObject);
|
||||
function SavedSearch(id) {
|
||||
courier.SavedObject.call(this, {
|
||||
type: SavedSearch.type,
|
||||
|
|
|
@ -29,7 +29,7 @@ define(function (require) {
|
|||
},
|
||||
listeners: {
|
||||
rectangle: function (event) {
|
||||
var agg = _.deepGet(event, 'chart.geohashGridAgg');
|
||||
var agg = _.get(event, 'chart.geohashGridAgg');
|
||||
if (!agg) return;
|
||||
|
||||
var pushFilter = Private(require('components/filter_bar/push_filter'))(getAppState());
|
||||
|
@ -41,7 +41,7 @@ define(function (require) {
|
|||
pushFilter(filter, false, indexPatternName);
|
||||
},
|
||||
mapMoveEnd: function (event) {
|
||||
var agg = _.deepGet(event, 'chart.geohashGridAgg');
|
||||
var agg = _.get(event, 'chart.geohashGridAgg');
|
||||
if (!agg) return;
|
||||
|
||||
agg.params.mapZoom = event.zoom;
|
||||
|
@ -57,7 +57,7 @@ define(function (require) {
|
|||
}
|
||||
},
|
||||
mapZoomEnd: function (event) {
|
||||
var agg = _.deepGet(event, 'chart.geohashGridAgg');
|
||||
var agg = _.get(event, 'chart.geohashGridAgg');
|
||||
if (!agg || !agg.params.autoPrecision) return;
|
||||
|
||||
// zoomPrecision maps event.zoom to a geohash precision value
|
||||
|
|
|
@ -27,16 +27,15 @@ define(function (require) {
|
|||
config.$bind($scope, 'defaultIndex');
|
||||
|
||||
$scope.$watch('defaultIndex', function () {
|
||||
$scope.indexPatternList = _($route.current.locals.indexPatternIds)
|
||||
.map(function (id) {
|
||||
return {
|
||||
id: id,
|
||||
url: kbnUrl.eval('#/settings/indices/{{id}}', {id: id}),
|
||||
class: 'sidebar-item-title ' + ($scope.edittingId === id ? 'active' : ''),
|
||||
default: $scope.defaultIndex === id
|
||||
};
|
||||
})
|
||||
.value();
|
||||
var ids = $route.current.locals.indexPatternIds;
|
||||
$scope.indexPatternList = ids.map(function (id) {
|
||||
return {
|
||||
id: id,
|
||||
url: kbnUrl.eval('#/settings/indices/{{id}}', {id: id}),
|
||||
class: 'sidebar-item-title ' + ($scope.edittingId === id ? 'active' : ''),
|
||||
default: $scope.defaultIndex === id
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
$scope.$emit('application.load');
|
||||
|
|
|
@ -93,7 +93,7 @@ define(function (require) {
|
|||
var objs = $scope.services.map(function (service) {
|
||||
return service.data.map(_.partialRight(_.extend, {type: service.type}));
|
||||
});
|
||||
retrieveAndExportDocs(_.flatten(objs));
|
||||
retrieveAndExportDocs(_.flattenDeep(objs));
|
||||
};
|
||||
|
||||
function retrieveAndExportDocs(objs) {
|
||||
|
@ -134,7 +134,7 @@ define(function (require) {
|
|||
if (existingDocs.length === 0 || window.confirm(confirmMessage + _.pluck(existingDocs, '_id').join('\n'))) {
|
||||
return es.bulk({
|
||||
index: config.file.kibana_index,
|
||||
body: _.flatten(docs.map(transformToBulk))
|
||||
body: _.flattenDeep(docs.map(transformToBulk))
|
||||
})
|
||||
.then(refreshIndex)
|
||||
.then(refreshData, notify.error);
|
||||
|
|
|
@ -183,7 +183,7 @@ define(function (require) {
|
|||
value = JSON.parse(field.value);
|
||||
}
|
||||
|
||||
_.setValue(source, field.name, value);
|
||||
_.set(source, field.name, value);
|
||||
});
|
||||
|
||||
es.index({
|
||||
|
|
|
@ -137,7 +137,7 @@ define(function (require) {
|
|||
$scope.responseValueAggs = null;
|
||||
try {
|
||||
$scope.responseValueAggs = editableVis.aggs.getResponseAggs().filter(function (agg) {
|
||||
return _.deepGet(agg, 'schema.group') === 'metrics';
|
||||
return _.get(agg, 'schema.group') === 'metrics';
|
||||
});
|
||||
} catch (e) {
|
||||
// this can fail when the agg.type is changed but the
|
||||
|
@ -260,9 +260,12 @@ define(function (require) {
|
|||
parent.set('filter', _.union(searchSource.getOwn('filter'), parent.getOwn('filter')));
|
||||
|
||||
// copy over all state except "aggs" and filter, which is already copied
|
||||
_(parent.toJSON()).omit('aggs').forOwn(function (val, key) {
|
||||
_(parent.toJSON())
|
||||
.omit('aggs')
|
||||
.forOwn(function (val, key) {
|
||||
searchSource.set(key, val);
|
||||
});
|
||||
})
|
||||
.commit();
|
||||
|
||||
$state.query = searchSource.get('query');
|
||||
$state.filters = searchSource.get('filter');
|
||||
|
|
|
@ -131,6 +131,14 @@
|
|||
padding: @vis-editor-agg-editor-spacing;
|
||||
margin-bottom: @vis-editor-agg-editor-spacing;
|
||||
}
|
||||
|
||||
label {
|
||||
.flex(2 0 0);
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.visualization-options {
|
||||
|
|
|
@ -9,7 +9,7 @@ define(function (require) {
|
|||
location: 'SavedVis'
|
||||
});
|
||||
|
||||
_(SavedVis).inherits(courier.SavedObject);
|
||||
_.class(SavedVis).inherits(courier.SavedObject);
|
||||
function SavedVis(opts) {
|
||||
var self = this;
|
||||
opts = opts || {};
|
||||
|
|
|
@ -78,7 +78,7 @@ define(function (require) {
|
|||
_.forOwn(self, function (fn) {
|
||||
if (_.isFunction(fn) && fn.cache) {
|
||||
// clear all memoize caches
|
||||
fn.cache = {};
|
||||
fn.cache = new _.memoize.Cache();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ require.config({
|
|||
routes: 'utils/routes/index',
|
||||
errors: 'components/errors',
|
||||
modules: 'utils/modules',
|
||||
lodash: 'utils/_mixins',
|
||||
lodash: 'utils/lodash-mixins/index',
|
||||
|
||||
// bower_components
|
||||
'angular-bindonce': 'bower_components/angular-bindonce/bindonce',
|
||||
|
@ -29,8 +29,7 @@ require.config({
|
|||
jquery: 'bower_components/jquery/dist/jquery',
|
||||
leaflet: 'bower_components/leaflet/dist/leaflet',
|
||||
'leaflet-draw': 'bower_components/leaflet-draw/dist/leaflet.draw',
|
||||
lodash_src: 'bower_components/lodash/dist/lodash',
|
||||
'lodash-deep': 'bower_components/lodash-deep/factory',
|
||||
lodash_src: 'bower_components/lodash/lodash',
|
||||
moment: 'bower_components/moment/moment',
|
||||
'ng-clip': 'bower_components/ng-clip/src/ngClip',
|
||||
text: 'bower_components/requirejs-text/text',
|
||||
|
|
|
@ -17,19 +17,17 @@ define(function (require) {
|
|||
|
||||
// esFactory automatically injects the AngularConnector to the config
|
||||
// https://github.com/elastic/elasticsearch-js/blob/master/src/lib/connectors/angular.js
|
||||
_(CustomAngularConnector).inherits(config.connectionClass);
|
||||
_.class(CustomAngularConnector).inherits(config.connectionClass);
|
||||
function CustomAngularConnector(host, config) {
|
||||
CustomAngularConnector.Super.call(this, host, config);
|
||||
|
||||
var originalRequest = this.request;
|
||||
this.request = function (params) {
|
||||
this.request = _.wrap(this.request, function (request, params, cb) {
|
||||
if (String(params.method).toUpperCase() === 'GET') {
|
||||
params.query = params.query || {};
|
||||
params.query._ = Date.now();
|
||||
params.query = _.defaults({ _: Date.now() }, params.query);
|
||||
}
|
||||
|
||||
return originalRequest.apply(this, arguments);
|
||||
};
|
||||
return request.call(this, params, cb);
|
||||
});
|
||||
}
|
||||
|
||||
config.connectionClass = CustomAngularConnector;
|
||||
|
|
|
@ -8,7 +8,7 @@ define(function (require) {
|
|||
*
|
||||
* @class
|
||||
*/
|
||||
_(SimpleEmitter).inherits(BaseObject);
|
||||
_.class(SimpleEmitter).inherits(BaseObject);
|
||||
function SimpleEmitter() {
|
||||
this._listeners = {};
|
||||
}
|
||||
|
@ -67,10 +67,8 @@ define(function (require) {
|
|||
* @param {*} [arg...] - any number of arguments that will be applied to each handler
|
||||
* @return {SimpleEmitter} - this, for chaining
|
||||
*/
|
||||
SimpleEmitter.prototype.emit = function (name, arg) {
|
||||
SimpleEmitter.prototype.emit = _.restParam(function (name, args) {
|
||||
if (!this._listeners[name]) return this;
|
||||
|
||||
var args = _.rest(arguments);
|
||||
var listeners = this.listeners(name);
|
||||
var i = -1;
|
||||
|
||||
|
@ -79,7 +77,7 @@ define(function (require) {
|
|||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Get a list of the event names that currently have listeners
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue