Skip to content

Commit

Permalink
fixing merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Jul 14, 2020
1 parent d49b0ad commit b343a28
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { ml } from './ml_api_service';
import { getIndexPatternAndSavedSearch } from '../util/index_utils';

// called in the angular routing resolve block to initialize the
// called in the routing resolve block to initialize the
// newJobCapsService with the currently selected index pattern
export function loadNewJobCapabilities(
indexPatternId: string,
Expand Down
19 changes: 10 additions & 9 deletions x-pack/plugins/ml/server/models/data_visualizer/data_visualizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { ILegacyScopedClusterClient } from 'kibana/server';
import { LegacyAPICaller } from 'kibana/server';
import _ from 'lodash';
import { KBN_FIELD_TYPES } from '../../../../../../src/plugins/data/server';
import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types';
Expand Down Expand Up @@ -181,7 +180,7 @@ type BatchStats =
| FieldExamples;

const getAggIntervals = async (
callAsCurrentUser: LegacyAPICaller,
{ callAsCurrentUser }: ILegacyScopedClusterClient,
indexPatternTitle: string,
query: any,
fields: HistogramField[],
Expand Down Expand Up @@ -239,14 +238,15 @@ const getAggIntervals = async (

// export for re-use by transforms plugin
export const getHistogramsForFields = async (
callAsCurrentUser: LegacyAPICaller,
mlClusterClient: ILegacyScopedClusterClient,
indexPatternTitle: string,
query: any,
fields: HistogramField[],
samplerShardSize: number
) => {
const { callAsCurrentUser } = mlClusterClient;
const aggIntervals = await getAggIntervals(
callAsCurrentUser,
mlClusterClient,
indexPatternTitle,
query,
fields,
Expand Down Expand Up @@ -349,11 +349,12 @@ export const getHistogramsForFields = async (
};

export class DataVisualizer {
callAsCurrentUser: LegacyAPICaller;

constructor(callAsCurrentUser: LegacyAPICaller) {
this.callAsCurrentUser = callAsCurrentUser;
private _mlClusterClient: ILegacyScopedClusterClient;
private _callAsCurrentUser: ILegacyScopedClusterClient['callAsCurrentUser'];

constructor(mlClusterClient: ILegacyScopedClusterClient) {
this._callAsCurrentUser = mlClusterClient.callAsCurrentUser;
this._mlClusterClient = mlClusterClient;
}

// Obtains overall stats on the fields in the supplied index pattern, returning an object
Expand Down Expand Up @@ -449,7 +450,7 @@ export class DataVisualizer {
samplerShardSize: number
): Promise<any> {
return await getHistogramsForFields(
this.callAsCurrentUser,
this._mlClusterClient,
indexPatternTitle,
query,
fields,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/ml/server/routes/data_visualizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function getHistogramsForFields(
fields: HistogramField[],
samplerShardSize: number
) {
const dv = new DataVisualizer(context.ml!.mlClient.callAsCurrentUser);
const dv = new DataVisualizer(context.ml!.mlClient);
return dv.getHistogramsForFields(indexPatternTitle, query, fields, samplerShardSize);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function registerFieldHistogramsRoutes({ router, license }: RouteDependen

try {
const resp = await getHistogramsForFields(
ctx.transform!.dataClient.callAsCurrentUser,
ctx.transform!.dataClient,
indexPatternTitle,
query,
fields,
Expand Down

0 comments on commit b343a28

Please sign in to comment.