Skip to content

Commit

Permalink
[Tests] update disable bucket agg feature for tests
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 Feb 25, 2022
1 parent fa47ac3 commit 9a0f071
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 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
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/aggs/aggs_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class AggsService {

return {
calculateAutoTimeExpression,
createAggConfigs: (indexPattern, configStates = [], schemas) => {
createAggConfigs: (indexPattern: any, configStates = [], schemas: any) => {
return new AggConfigs(indexPattern, configStates, { typesRegistry });
},
types: typesRegistry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function fetchIndexPatterns(
searchFields: ['title'],
});

const exactMatches = indexPatternsFromSavedObjects.savedObjects.filter((savedObject) => {
const exactMatches = indexPatternsFromSavedObjects.savedObjects.filter((savedObject: any) => {
return indexPatternStrings.includes(savedObject.attributes.title);
});

Expand Down
3 changes: 1 addition & 2 deletions src/plugins/data/server/search/aggs/aggs_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import { AggsSetup, AggsStart } from './types';
/** @internal */
export interface AggsSetupDependencies {
registerFunction: ExpressionsServiceSetup['registerFunction'];
uiSettings: UiSettingsServiceSetup;
}

/** @internal */
Expand Down Expand Up @@ -130,7 +129,7 @@ export class AggsService {

return {
calculateAutoTimeExpression,
createAggConfigs: (indexPattern, configStates = [], schemas) => {
createAggConfigs: (indexPattern: any, configStates = [], schemas: any) => {
return new AggConfigs(indexPattern, configStates, { typesRegistry });
},
types: typesRegistry,
Expand Down

0 comments on commit 9a0f071

Please sign in to comment.