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 #61069

Merged
merged 14 commits into from
Mar 27, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ class ReactVisController {

const I18nContext = getI18n().Context;

return new Promise(resolve => {
return new Promise((resolve, reject) => {
if (!this.vis.type || !this.vis.type.visConfig || !this.vis.type.visConfig.component) {
reject('Missing component for ReactVisType');
}
Comment on lines +36 to +39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this might be more succinct:

const Component = this.vis.type?.visConfig?.component;
if (!Component) {
  reject('Missing component for ReactVisType');
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukeelmers Have not idea why but ?. is not working with karma tests =(


const Component = this.vis.type.visConfig.component;
const config = getUISettings();
render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const mockUiSettings = {
getUpdate$: () => ({
subscribe: sinon.fake(),
}),
isDefault: sinon.fake(),
'query:allowLeadingWildcards': true,
'query:queryString:options': {},
'courier:ignoreFilterIfFieldNotInIndex': true,
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/data/public/search/aggs/agg_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
import { IUiSettingsClient, NotificationsSetup } from 'kibana/public';
import { QuerySetup } from '../../query';

import { IUiSettingsClient, NotificationsSetup } from 'src/core/public';
import { QuerySetup } from '../../query/query_service';

import { countMetricAgg } from './metrics/count';
import { avgMetricAgg } from './metrics/avg';
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/public/search/aggs/buckets/date_histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import { get, noop, find, every } from 'lodash';
import moment from 'moment-timezone';
import { i18n } from '@kbn/i18n';
import { IUiSettingsClient } from 'src/core/public';

import { IUiSettingsClient } from 'kibana/public';
import { TimeBuckets } from './lib/time_buckets';
import { BucketAggType, IBucketAggConfig } from './_bucket_agg_type';
import { BUCKET_TYPES } from './bucket_agg_types';
Expand All @@ -34,7 +34,7 @@ import { isMetricAggType } from '../metrics/metric_agg_type';
import { FIELD_FORMAT_IDS, KBN_FIELD_TYPES } from '../../../../common';
import { TimefilterContract } from '../../../query';
import { getFieldFormats } from '../../../../public/services';
import { QuerySetup } from '../../../query';
import { QuerySetup } from '../../../query/query_service';

const detectedTimezone = moment.tz.guess();
const tzOffset = moment().format('Z');
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/aggs/buckets/date_range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { get } from 'lodash';
import moment from 'moment-timezone';
import { i18n } from '@kbn/i18n';
import { IUiSettingsClient } from 'kibana/public';
import { IUiSettingsClient } from 'src/core/public';

import { BUCKET_TYPES } from './bucket_agg_types';
import { BucketAggType, IBucketAggConfig } from './_bucket_agg_type';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/aggs/buckets/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { i18n } from '@kbn/i18n';
import { size, transform, cloneDeep } from 'lodash';
import { IUiSettingsClient } from 'kibana/public';
import { IUiSettingsClient } from 'src/core/public';

import { createFilterFilters } from './create_filter/filters';
import { toAngularJSON } from '../utils';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/aggs/buckets/histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { get } from 'lodash';
import { i18n } from '@kbn/i18n';
import { IUiSettingsClient, NotificationsSetup } from 'kibana/public';
import { IUiSettingsClient, NotificationsSetup } from 'src/core/public';

import { BucketAggType, IBucketAggConfig } from './_bucket_agg_type';
import { createFilterHistogram } from './create_filter/histogram';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/search_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { TStrategyTypes } from './strategy_types';
import { getEsClient, LegacyApiCaller } from './es_client';
import { ES_SEARCH_STRATEGY, DEFAULT_SEARCH_STRATEGY } from '../../common/search';
import { esSearchStrategyProvider } from './es_search/es_search_strategy';
import { QuerySetup } from '../query';
import { QuerySetup } from '../query/query_service';
import { SearchInterceptor } from './search_interceptor';
import {
getAggTypes,
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/data/public/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
* under the License.
*/

import { NotificationsStart } from 'src/core/public';
import { CoreSetup, CoreStart } from 'kibana/public';
import { NotificationsStart, CoreSetup, CoreStart } from 'src/core/public';
import { FieldFormatsStart } from './field_formats';
import { createGetterSetter } from '../../kibana_utils/public';
import { IndexPatternsContract } from './index_patterns';
Expand Down