mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Fix highlight config so it doesn't require a refresh to apply (#10346)
* Acknowledge doc_table:highlight config even after init * Use highlightAll on dashboard
This commit is contained in:
parent
31db424b9b
commit
bd966dbacd
3 changed files with 13 additions and 4 deletions
|
@ -78,6 +78,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
|
|||
let pendingVisCount = _.size(dashboardState.getPanels());
|
||||
|
||||
timefilter.enabled = true;
|
||||
dash.searchSource.highlightAll(true);
|
||||
courier.setRootSearchSource(dash.searchSource);
|
||||
|
||||
// Following the "best practice" of always have a '.' in your ng-models –
|
||||
|
|
|
@ -79,4 +79,14 @@ describe('getHighlightRequest', () => {
|
|||
const request = getHighlightRequest(queryStringQuery);
|
||||
expect(request.fields['*']).to.not.have.property('highlight_query');
|
||||
});
|
||||
|
||||
it('should enable/disable highlighting if config is changed', () => {
|
||||
getHighlightRequest = getHighlightRequestProvider(config);
|
||||
let request = getHighlightRequest(queryStringQuery);
|
||||
expect(request).to.not.be(undefined);
|
||||
|
||||
config.set('doc_table:highlight', false);
|
||||
request = getHighlightRequest(queryStringQuery);
|
||||
expect(request).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,11 +23,9 @@ function getHighlightQuery(query) {
|
|||
}
|
||||
|
||||
export default function getHighlightRequestProvider(config) {
|
||||
if (!config.get('doc_table:highlight')) {
|
||||
return _.noop;
|
||||
}
|
||||
|
||||
return function getHighlightRequest(query) {
|
||||
if (!config.get('doc_table:highlight')) return;
|
||||
|
||||
const fieldsParams = config.get('doc_table:highlight:all_fields')
|
||||
? { highlight_query: getHighlightQuery(query) }
|
||||
: {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue