Skip to content

Commit

Permalink
Issue #16: code review, delete unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
idrissneumann committed Nov 24, 2023
1 parent 397fb19 commit 12f869a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ import { segmentStyles } from '../styles';
import { SettingsEditor } from './SettingsEditor';
import {
isMetricAggregationWithField,
isMetricAggregationWithInlineScript,
isMetricAggregationWithSettings,
isPipelineAggregation,
isPipelineAggregationWithMultipleBucketPaths,
isPipelineAggregationWithMultipleBucketPaths
} from './aggregations';
import { changeMetricField, changeMetricType } from './state/actions';
import { getStyles } from './styles';
Expand Down Expand Up @@ -64,13 +63,8 @@ export const MetricEditor = ({ value }: Props) => {
const loadOptions = useCallback(async () => {
const remoteFields = await getFields();

// Metric aggregations that have inline script support don't require a field to be set.
if (isMetricAggregationWithInlineScript(value)) {
return [{ label: 'None' }, ...remoteFields];
}

return remoteFields;
}, [getFields, value]);
}, [getFields]);

const previousMetrics = query.metrics!.slice(
0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
BaseMetricAggregation,
MetricAggregationWithField,
MetricAggregationWithMissingSupport,
MetricAggregationWithInlineScript,
PipelineMetricAggregation,
MetricAggregationWithSettings,
} from '../../../types';
Expand Down Expand Up @@ -62,10 +61,6 @@ export const isMetricAggregationWithMeta = (
metric: BaseMetricAggregation | MetricAggregationWithMeta
): metric is MetricAggregationWithMeta => metricAggregationConfig[metric.type].hasMeta;

export const isMetricAggregationWithInlineScript = (
metric: BaseMetricAggregation | MetricAggregationWithInlineScript
): metric is MetricAggregationWithInlineScript => metricAggregationConfig[metric.type].supportsInlineScript;

export const METRIC_AGGREGATION_TYPES: MetricAggregationType[] = [
'count',
'avg',
Expand Down

0 comments on commit 12f869a

Please sign in to comment.