Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/57394' into 57394
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/legacy/core_plugins/data/public/search/tabify/types.ts
  • Loading branch information
alexwizp committed Feb 19, 2020
2 parents 7e9cd11 + 8e52a3f commit 8c427e3
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/legacy/core_plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export {
ISchemas,
OptionedParamEditorProps,
OptionedValueProp,
TabbedResponseWriterOptions,
} from './search/types';

/** @public static code */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ import {

import { buildTabularInspectorData } from './build_tabular_inspector_data';
import { calculateObjectHash } from '../../../../visualizations/public';
import {
tabifyAggResponse,
TabbedResponseWriterOptions,
} from '../../../../../core_plugins/data/public';
import { tabifyAggResponse } from '../../../../../core_plugins/data/public';
import { PersistedState } from '../../../../../ui/public/persisted_state';
import { Adapters } from '../../../../../../plugins/inspector/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
Expand Down Expand Up @@ -198,7 +195,7 @@ const handleCourierRequest = async ({
metricsAtAllLevels,
partialRows,
timeRange: parsedTimeRange ? parsedTimeRange.range : undefined,
} as TabbedResponseWriterOptions;
};

const tabifyCacheHash = calculateObjectHash({ tabifyAggs: aggs, ...tabifyParams });
// We only need to reexecute tabify, if either we did a new request or some input params to tabify changed
Expand Down
8 changes: 5 additions & 3 deletions src/legacy/core_plugins/data/public/search/tabify/buckets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class TabifyBuckets {
}

this.objectMode = isPlainObject(this.buckets);

if (this.objectMode) {
this._keys = keys(this.buckets);
this.length = this._keys.length;
Expand Down Expand Up @@ -83,12 +84,13 @@ export class TabifyBuckets {
this._keys = params.filters.map((filter: any) => {
const query = get(filter, 'input.query.query_string.query', filter.input.query);
const queryString = typeof query === 'string' ? query : JSON.stringify(query);

return filter.label || queryString || '*';
});
} else if (params.ranges && this.objectMode) {
this._keys = params.ranges.map((range: TimeRange) => {
return findKey(this.buckets, (el: TimeRange) => isRangeEqual(el, range));
});
this._keys = params.ranges.map((range: TimeRange) =>
findKey(this.buckets, (el: TimeRange) => isRangeEqual(el, range))
);
} else if (params.ranges && params.field.type !== 'date') {
let ranges = params.ranges;
if (params.ipRangeType) {
Expand Down
2 changes: 0 additions & 2 deletions src/legacy/core_plugins/data/public/search/tabify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@

export { tabifyAggResponse } from './tabify';
export { tabifyGetColumns } from './get_columns';

export { TabbedResponseWriterOptions } from './types';
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { TabbedResponseWriterOptions } from './types';

interface TabbedAggColumn {
id: string;
value: unknown;
value: string | number;
}

type TabbedAggRow = Record<TabbedAggColumn['id'], TabbedAggColumn['value']>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('tabifyAggResponse Integration', () => {

// check that a row has expected values
function expectRow(
row: Record<string, string>,
row: Record<string, string | number>,
asserts: Array<(val: string | number) => void>
) {
expect(typeof row).toBe('object');
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/data/public/search/tabify/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export interface TimeRange extends RangeFilterParams {
name: string;
}

/** @public **/
/** @internal **/
export interface TabbedResponseWriterOptions {
metricsAtAllLevels: boolean;
partialRows: boolean;
timeRange?: RangeFilterParams;
timeRange?: { [key: string]: RangeFilterParams };
}
1 change: 0 additions & 1 deletion src/legacy/core_plugins/data/public/search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@

export * from './aggs/types';
export * from './utils/types';
export { TabbedResponseWriterOptions } from './tabify';

0 comments on commit 8c427e3

Please sign in to comment.