mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Changing the name from flattenWith to flattenSearchResponse
This commit is contained in:
parent
a5ff8d7c0f
commit
2fe7233887
5 changed files with 10 additions and 10 deletions
|
@ -307,7 +307,7 @@ define(function (require) {
|
|||
// Flatten the fields
|
||||
|
||||
var indexPattern = $scope.searchSource.get('index');
|
||||
hit._source = indexPattern.flattenWith('.', hit._source);
|
||||
hit._source = indexPattern.flattenSearchResponse(hit._source);
|
||||
|
||||
hit._formatted = _.mapValues(hit._source, function (value, name) {
|
||||
// add up the counts for each field name
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
return function (delimiter, nestedObj) {
|
||||
return function (nestedObj) {
|
||||
var key; // original key
|
||||
var stack = []; // track key stack
|
||||
var flatObj = {};
|
||||
|
@ -8,7 +8,7 @@ define(function (require) {
|
|||
(function flattenObj(obj) {
|
||||
_.keys(obj).forEach(function (key) {
|
||||
stack.push(key);
|
||||
var flattenKey = stack.join(delimiter);
|
||||
var flattenKey = stack.join('.');
|
||||
|
||||
if (self.fieldsByName[flattenKey]) {
|
||||
flatObj[flattenKey] = obj[key];
|
|
@ -11,7 +11,7 @@ define(function (require) {
|
|||
var intervals = Private(require('components/index_patterns/_intervals'));
|
||||
var mappingSetup = Private(require('utils/mapping_setup'));
|
||||
var DocSource = Private(require('components/courier/data_source/doc_source'));
|
||||
var flattenWith = require('components/index_patterns/_flatten_with');
|
||||
var flattenSearchResponse = require('components/index_patterns/_flatten_search_response');
|
||||
|
||||
var type = 'index-pattern';
|
||||
|
||||
|
@ -173,7 +173,7 @@ define(function (require) {
|
|||
return '' + pattern.toJSON();
|
||||
};
|
||||
|
||||
pattern.flattenWith = flattenWith.bind(pattern);
|
||||
pattern.flattenSearchResponse = flattenSearchResponse.bind(pattern);
|
||||
|
||||
}
|
||||
return IndexPattern;
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
'specs/utils/diff_object',
|
||||
'specs/utils/diff_time_picker_vals',
|
||||
'specs/factories/events',
|
||||
'specs/index_patterns/_flatten_with'
|
||||
'specs/index_patterns/_flatten_search_response'
|
||||
], function (kibana, sinon) {
|
||||
kibana.load(function () {
|
||||
var xhr = sinon.useFakeXMLHttpRequest();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
define(function (require) {
|
||||
var flattenWith = require('components/index_patterns/_flatten_with');
|
||||
describe('IndexPattern#flattenWith()', function () {
|
||||
var flattenSearchResponse = require('components/index_patterns/_flatten_search_response');
|
||||
describe('IndexPattern#flattenSearchResponse()', function () {
|
||||
|
||||
var indexPattern = {
|
||||
fieldsByName: {
|
||||
|
@ -13,7 +13,7 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
|
||||
indexPattern.flattenWith = flattenWith.bind(indexPattern);
|
||||
indexPattern.flattenSearchResponse = flattenSearchResponse.bind(indexPattern);
|
||||
|
||||
var fixture = {
|
||||
message: 'Hello World',
|
||||
|
@ -27,7 +27,7 @@ define(function (require) {
|
|||
};
|
||||
|
||||
it('should only flatten keys as far as the mapping', function () {
|
||||
var obj = indexPattern.flattenWith('.', fixture);
|
||||
var obj = indexPattern.flattenSearchResponse(fixture);
|
||||
expect(obj).to.have.property('geo.coordinates', fixture.geo.coordinates);
|
||||
expect(obj).to.not.have.property('geo.coordinates.lat');
|
||||
expect(obj).to.not.have.property('geo.coordinates.lon');
|
Loading…
Add table
Add a link
Reference in a new issue