Skip to content

Commit

Permalink
[Metrics UI] Remove remaining field filtering (#63398) (#63985)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
simianhacker and elasticmachine authored Apr 20, 2020
1 parent 8b70b49 commit 27c0d8e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { i18n } from '@kbn/i18n';
import React, { useCallback } from 'react';
import { IFieldType } from 'src/plugins/data/public';
import { MetricsExplorerOptions } from '../../containers/metrics_explorer/use_metrics_explorer_options';
import { isDisplayable } from '../../utils/is_displayable';

interface Props {
options: MetricsExplorerOptions;
Expand All @@ -27,18 +26,6 @@ export const MetricsExplorerGroupBy = ({ options, onChange, fields }: Props) =>
[onChange]
);

const metricPrefixes = options.metrics
.map(
metric =>
(metric.field &&
metric.field
.split(/\./)
.slice(0, 2)
.join('.')) ||
null
)
.filter(metric => metric) as string[];

return (
<EuiComboBox
placeholder={i18n.translate('xpack.infra.metricsExplorer.groupByLabel', {
Expand All @@ -51,7 +38,7 @@ export const MetricsExplorerGroupBy = ({ options, onChange, fields }: Props) =>
singleSelection={true}
selectedOptions={(options.groupBy && [{ label: options.groupBy }]) || []}
options={fields
.filter(f => isDisplayable(f, metricPrefixes) && f.aggregatable && f.type === 'string')
.filter(f => f.aggregatable && f.type === 'string')
.map(f => ({ label: f.name }))}
onChange={handleChange}
isClearable={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { i18n } from '@kbn/i18n';
import React, { useEffect, useState } from 'react';
import { WithKueryAutocompletion } from '../../containers/with_kuery_autocompletion';
import { AutocompleteField } from '../autocomplete_field';
import { isDisplayable } from '../../utils/is_displayable';
import { esKuery, IIndexPattern } from '../../../../../../src/plugins/data/public';

interface Props {
Expand Down Expand Up @@ -51,7 +50,7 @@ export const MetricsExplorerKueryBar = ({

const filteredDerivedIndexPattern = {
...derivedIndexPattern,
fields: derivedIndexPattern.fields.filter(field => isDisplayable(field)),
fields: derivedIndexPattern.fields,
};

const defaultPlaceholder = i18n.translate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { IFieldType } from 'src/plugins/data/public';
import { colorTransformer, MetricsExplorerColor } from '../../../common/color_palette';
import { MetricsExplorerMetric } from '../../../common/http_api/metrics_explorer';
import { MetricsExplorerOptions } from '../../containers/metrics_explorer/use_metrics_explorer_options';
import { isDisplayable } from '../../utils/is_displayable';

interface Props {
autoFocus?: boolean;
Expand Down Expand Up @@ -54,9 +53,7 @@ export const MetricsExplorerMetrics = ({ options, onChange, fields, autoFocus =
[onChange, options.aggregation, colors]
);

const comboOptions = fields
.filter(field => isDisplayable(field))
.map(field => ({ label: field.name, value: field.name }));
const comboOptions = fields.map(field => ({ label: field.name, value: field.name }));
const selectedOptions = options.metrics
.filter(m => m.aggregation !== 'count')
.map(metric => ({
Expand Down

0 comments on commit 27c0d8e

Please sign in to comment.