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

add autoRefreshFetch event to timefilter #20863

Merged
merged 6 commits into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ui/public/courier/search_poll/search_poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions src/ui/public/visualize/loader/embedded_visualize_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down