diff --git a/src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/lib/rows_headers.js b/src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/lib/rows_headers.js index be6e9fa6a6302..9b63b8cd18f3e 100644 --- a/src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/lib/rows_headers.js +++ b/src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/lib/rows_headers.js @@ -207,12 +207,6 @@ describe('Doc Table', function() { maxLength: 50, }); - /** - sinon - .stub(config, 'get') - .withArgs('metaFields') - .returns(['_id']); **/ - // Open the row $scope.toggleRow(); $scope.$digest(); diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js index 63165e6f19857..d8c6a824213fc 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js @@ -64,7 +64,7 @@ const { share, timefilter, toastNotifications, - uiSettings, + uiSettings: config, visualizations, } = getServices(); @@ -131,7 +131,7 @@ app.config($routeProvider => { * * @type {State} */ - const id = getIndexPatternId(index, indexPatternList, uiSettings.get('defaultIndex')); + const id = getIndexPatternId(index, indexPatternList, config.get('defaultIndex')); return Promise.props({ list: indexPatternList, loaded: indexPatterns.get(id), @@ -211,7 +211,7 @@ function discoverController( getPreviousAppState, } = getState({ defaultAppState: getStateDefaults(), - storeInSessionStorage: getServices().uiSettings.get('state:storeInSessionStorage'), + storeInSessionStorage: config.get('state:storeInSessionStorage'), history, }); if (appStateContainer.getState().index !== $scope.indexPattern.id) { @@ -536,7 +536,7 @@ function discoverController( const { searchFields, selectFields } = await getSharingDataFields( $scope.state.columns, $scope.indexPattern.timeFieldName, - uiSettings.get('doc_table:hideTimeColumn') + config.get('doc_table:hideTimeColumn') ); searchSource.setField('fields', searchFields); searchSource.setField( @@ -544,7 +544,7 @@ function discoverController( getSortForSearchSource( $scope.state.sort, $scope.indexPattern, - uiSettings.get('discover:sort:defaultOrder') + config.get('discover:sort:defaultOrder') ) ); searchSource.setField('highlight', null); @@ -571,15 +571,13 @@ function discoverController( const query = $scope.searchSource.getField('query') || getDefaultQuery( - localStorage.get('kibana.userQueryLanguage') || uiSettings.get('search:queryLanguage') + localStorage.get('kibana.userQueryLanguage') || config.get('search:queryLanguage') ); return { query, sort: getSortArray(savedSearch.sort, $scope.indexPattern), columns: - savedSearch.columns.length > 0 - ? savedSearch.columns - : uiSettings.get('defaultColumns').slice(), + savedSearch.columns.length > 0 ? savedSearch.columns : config.get('defaultColumns').slice(), index: $scope.indexPattern.id, interval: 'auto', filters: _.cloneDeep($scope.searchSource.getOwnField('filter')), @@ -609,7 +607,7 @@ function discoverController( $scope.opts = { // number of records to fetch, then paginate through - sampleSize: uiSettings.get('discover:sampleSize'), + sampleSize: config.get('discover:sampleSize'), timefield: getTimeField(), savedSearch: savedSearch, indexPatternList: $route.current.locals.savedObjects.ip.list, @@ -619,7 +617,7 @@ function discoverController( // A saved search is created on every page load, so we check the ID to see if we're loading a // previously saved search or if it is just transient return ( - uiSettings.get('discover:searchOnPageLoad') || + config.get('discover:searchOnPageLoad') || savedSearch.id !== undefined || timefilter.getRefreshInterval().pause === false ); @@ -829,7 +827,7 @@ function discoverController( const state = { ...appStateContainer.getState(), query: getDefaultQuery( - localStorage.get('kibana.userQueryLanguage') || uiSettings.get('search:queryLanguage') + localStorage.get('kibana.userQueryLanguage') || config.get('search:queryLanguage') ), filters: [], }; @@ -919,7 +917,7 @@ function discoverController( }; $scope.toMoment = function(datetime) { - return moment(datetime).format(uiSettings.get('dateFormat')); + return moment(datetime).format(config.get('dateFormat')); }; $scope.resetQuery = function() { @@ -940,7 +938,7 @@ function discoverController( getSortForSearchSource( $scope.state.sort, indexPattern, - uiSettings.get('discover:sort:defaultOrder') + config.get('discover:sort:defaultOrder') ) ) .setField('query', $scope.state.query || null) diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header.ts index c67cb91112033..84d865fd22a9a 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header.ts @@ -20,6 +20,8 @@ import { TableHeader } from './table_header/table_header'; import { wrapInI18nContext, getServices } from '../../../../kibana_services'; export function createTableHeaderDirective(reactDirective: any) { + const { uiSettings: config } = getServices(); + return reactDirective( wrapInI18nContext(TableHeader), [ @@ -34,9 +36,9 @@ export function createTableHeaderDirective(reactDirective: any) { ], { restrict: 'A' }, { - hideTimeColumn: getServices().uiSettings.get('doc_table:hideTimeColumn'), - isShortDots: getServices().uiSettings.get('shortDots:enable'), - defaultSortOrder: getServices().uiSettings.get('discover:sort:defaultOrder'), + hideTimeColumn: config.get('doc_table:hideTimeColumn'), + isShortDots: config.get('shortDots:enable'), + defaultSortOrder: config.get('discover:sort:defaultOrder'), } ); } diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/field_chooser/field_chooser.js b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/field_chooser/field_chooser.js index 37e5f331c5e86..398728e51862f 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/field_chooser/field_chooser.js +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/field_chooser/field_chooser.js @@ -50,6 +50,7 @@ export function createFieldChooserDirective($location) { $scope.showFilter = false; $scope.toggleShowFilter = () => ($scope.showFilter = !$scope.showFilter); $scope.indexPatternList = _.sortBy($scope.indexPatternList, o => o.get('title')); + const config = getServices().uiSettings; const filter = ($scope.filter = { props: ['type', 'aggregatable', 'searchable', 'missing', 'name'], @@ -157,9 +158,7 @@ export function createFieldChooserDirective($location) { groups.unpopular = groups.unpopular || []; // move excess popular fields to un-popular list - const extras = groups.popular.splice( - getServices().uiSettings.get('fields:popularLimit') - ); + const extras = groups.popular.splice(config.get('fields:popularLimit')); groups.unpopular = extras.concat(groups.unpopular); }) .each(function(group, name) { @@ -216,7 +215,7 @@ export function createFieldChooserDirective($location) { schema: 'segment', params: { field: field.name, - size: parseInt(getServices().uiSettings.get('discover:aggs:terms:size'), 10), + size: parseInt(config.get('discover:aggs:terms:size'), 10), orderBy: '2', }, };