mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
add autoRefreshFetch event to timefilter (#20863)
* add autoRefreshFetch event to timefilter * replace fetchAndRender with reloadVis remove listener from editor * unsubscribe correct handler
This commit is contained in:
parent
395fce7b69
commit
6132cd92cc
2 changed files with 5 additions and 0 deletions
|
@ -23,6 +23,7 @@ import { fatalError } from '../../notify';
|
|||
import '../../promises';
|
||||
import { searchRequestQueue } from '../search_request_queue';
|
||||
import { FetchSoonProvider } from '../fetch';
|
||||
import { timefilter } from 'ui/timefilter';
|
||||
|
||||
export function SearchPollProvider(Private, Promise) {
|
||||
const fetchSoon = Private(FetchSoonProvider);
|
||||
|
@ -81,6 +82,7 @@ export function SearchPollProvider(Private, Promise) {
|
|||
// We use resolve() here instead of try() because the latter won't trigger a $digest
|
||||
// when the promise resolves.
|
||||
this._searchPromise = Promise.resolve().then(() => {
|
||||
timefilter.emit('autoRefreshFetch');
|
||||
const requests = searchRequestQueue.getInactive();
|
||||
|
||||
// The promise returned from fetchSearchRequests() only resolves when the requests complete.
|
||||
|
|
|
@ -22,6 +22,7 @@ import { EventEmitter } from 'events';
|
|||
import { visualizationLoader } from './visualization_loader';
|
||||
import { VisualizeDataLoader } from './visualize_data_loader';
|
||||
import { RenderCompleteHelper } from '../../render_complete';
|
||||
import { timefilter } from 'ui/timefilter';
|
||||
|
||||
const RENDER_COMPLETE_EVENT = 'render_complete';
|
||||
|
||||
|
@ -71,6 +72,7 @@ export class EmbeddedVisualizeHandler {
|
|||
this._vis.on('update', this._handleVisUpdate);
|
||||
this._vis.on('reload', this._reloadVis);
|
||||
this._uiState.on('change', this._fetchAndRender);
|
||||
timefilter.on('autoRefreshFetch', this._reloadVis);
|
||||
|
||||
this._visualize = new VisualizeDataLoader(this._vis, Private);
|
||||
this._renderCompleteHelper = new RenderCompleteHelper(this._element);
|
||||
|
@ -168,6 +170,7 @@ export class EmbeddedVisualizeHandler {
|
|||
destroy() {
|
||||
this._destroyed = true;
|
||||
this._fetchAndRender.cancel();
|
||||
timefilter.off('autoRefreshFetch', this._reloadVis);
|
||||
this._vis.removeListener('reload', this._reloadVis);
|
||||
this._vis.removeListener('update', this._handleVisUpdate);
|
||||
this._element.removeEventListener('renderComplete', this._elementListener);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue