Skip to content

Commit

Permalink
[Tests] update disable bucket agg feature for tests (#1284)
Browse files Browse the repository at this point in the history
Test failure introduced:
#1196

Updating to handle the if that configuration is not found or if it is
not an array.

Issue:
n/a

Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla committed Mar 3, 2022
1 parent eaa669c commit d05afde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/plugins/data/common/search/aggs/agg_types_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ export class AggTypesRegistry {
start = ({ uiSettings }: AggTypesRegistryStartDependencies) => {
const disabledBucketAgg = uiSettings.get('visualize:disableBucketAgg');

for (const k of this.bucketAggs.keys()) {
if (disabledBucketAgg.includes(k)) this.bucketAggs.delete(k);
if (disabledBucketAgg !== undefined && Array.isArray(disabledBucketAgg)) {
for (const k of this.bucketAggs.keys()) {
if (disabledBucketAgg.includes(k)) this.bucketAggs.delete(k);
}
}

return {
Expand Down
7 changes: 1 addition & 6 deletions src/plugins/data/server/search/aggs/aggs_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@

import { pick } from 'lodash';

import {
UiSettingsServiceSetup,
UiSettingsServiceStart,
SavedObjectsClientContract,
} from 'src/core/server';
import { UiSettingsServiceStart, SavedObjectsClientContract } from 'src/core/server';
import { ExpressionsServiceSetup } from 'src/plugins/expressions/common';
import {
AggsCommonService,
Expand All @@ -52,7 +48,6 @@ import { AggsSetup, AggsStart } from './types';
/** @internal */
export interface AggsSetupDependencies {
registerFunction: ExpressionsServiceSetup['registerFunction'];
uiSettings: UiSettingsServiceSetup;
}

/** @internal */
Expand Down

0 comments on commit d05afde

Please sign in to comment.