Skip to content

Commit

Permalink
Removing IDX from code not covered by elastic#52354
Browse files Browse the repository at this point in the history
  • Loading branch information
simianhacker committed Dec 9, 2019
1 parent b140259 commit e1f3dc4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { uniq } from 'lodash';
import { idx } from '@kbn/elastic-idx';
import { RequestHandlerContext } from 'kibana/server';
import { InfraSnapshotRequestOptions } from './types';
import { InfraTimerangeInput } from '../../../public/graphql/types';
Expand Down Expand Up @@ -45,7 +44,7 @@ const aggregationsToModules = (aggregations: SnapshotModel): string[] => {
Object.values(aggregations)
.reduce((modules, agg) => {
if (SnapshotModelMetricAggRT.is(agg)) {
return modules.concat(Object.values(agg).map(a => idx(a, _ => _.field)));
return modules.concat(Object.values(agg).map(a => a?.field));
}
return modules;
}, [] as Array<string | undefined>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { i18n } from '@kbn/i18n';
import { idx } from '@kbn/elastic-idx';
import { findInventoryModel, findInventoryFields } from '../../../common/inventory_models/index';
import { InfraSnapshotRequestOptions } from './types';
import { getIntervalInSeconds } from '../../utils/get_interval_in_seconds';
Expand Down Expand Up @@ -48,7 +47,7 @@ export const getMetricsSources = (options: InfraSnapshotRequestOptions) => {

export const getMetricsAggregations = (options: InfraSnapshotRequestOptions): SnapshotModel => {
const model = findInventoryModel(options.nodeType);
const aggregation = idx(model, _ => _.metrics.snapshot[options.metric.type]);
const aggregation = model.metrics.snapshot?.[options.metric.type];
if (!SnapshotModelRT.is(aggregation)) {
throw new Error(
i18n.translate('xpack.infra.snapshot.missingSnapshotMetricError', {
Expand Down

0 comments on commit e1f3dc4

Please sign in to comment.