Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data.search.aggs] Remove service getters from agg types (AggConfig part) #62548

Merged
merged 10 commits into from
Apr 15, 2020
Prev Previous commit
Next Next commit
Fixed ci
VladLasitsa committed Apr 7, 2020
commit 359984e503f5b76d60d4a67fd208861647e3888d
8 changes: 5 additions & 3 deletions src/plugins/data/public/search/aggs/agg_config.ts
Original file line number Diff line number Diff line change
@@ -40,8 +40,10 @@ export interface AggConfigDependencies {
fieldFormats: FieldFormatsStart;
}

const tempAggConfigDependencies = {
fieldFormats: getFieldFormats(),
const tempAggConfigDependencies = () => {
return {
fieldFormats: getFieldFormats(),
};
};

/**
@@ -107,7 +109,7 @@ export class AggConfig {
constructor(
aggConfigs: IAggConfigs,
opts: AggConfigOptions,
{ fieldFormats }: AggConfigDependencies = tempAggConfigDependencies
{ fieldFormats }: AggConfigDependencies = tempAggConfigDependencies()
) {
this.aggConfigs = aggConfigs;
this.id = String(opts.id || AggConfig.nextId(aggConfigs.aggs as any));
8 changes: 5 additions & 3 deletions src/plugins/data/public/search/aggs/agg_configs.ts
Original file line number Diff line number Diff line change
@@ -55,8 +55,10 @@ export interface AggConfigsDependencies {
fieldFormats: FieldFormatsStart;
}

const tempAggConfigsDependencies = {
fieldFormats: getFieldFormats(),
const tempAggConfigsDependencies = () => {
return {
fieldFormats: getFieldFormats(),
};
};

export type CreateAggConfigParams = Assign<AggConfigOptions, { type: string | IAggType }>;
@@ -87,7 +89,7 @@ export class AggConfigs {
indexPattern: IndexPattern,
configStates: CreateAggConfigParams[] = [],
opts: AggConfigsOptions,
{ fieldFormats }: AggConfigsDependencies = tempAggConfigsDependencies
{ fieldFormats }: AggConfigsDependencies = tempAggConfigsDependencies()
) {
this.typesRegistry = opts.typesRegistry;