diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx index 84bcfa911125a..15d3c83ffebe9 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx @@ -51,6 +51,7 @@ interface ScrollableLogTextStreamViewProps { fromScroll: boolean; }) => any; loadNewerItems: () => void; + reloadItems: () => void; setFlyoutItem: (id: string) => void; setFlyoutVisibility: (visible: boolean) => void; highlightedItem: string | null; @@ -269,10 +270,10 @@ export class ScrollableLogTextStreamView extends React.PureComponent< }; private handleReload = () => { - const { jumpToTarget, target } = this.props; + const { reloadItems } = this.props; - if (target) { - jumpToTarget(target); + if (reloadItems) { + reloadItems(); } }; diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_entries/index.ts b/x-pack/legacy/plugins/infra/public/containers/logs/log_entries/index.ts index ed82c0854cdea..04412f5fdd871 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_entries/index.ts +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_entries/index.ts @@ -67,6 +67,7 @@ export type LogEntriesStateParams = { export interface LogEntriesCallbacks { fetchNewerEntries: () => Promise; + checkForNewEntries: () => Promise; } export const logEntriesInitialCallbacks = { fetchNewerEntries: async () => {}, @@ -231,7 +232,7 @@ const useFetchEntriesEffect = ( useEffect(fetchMoreEntriesEffect, fetchMoreEntriesEffectDependencies); useEffect(streamEntriesEffect, streamEntriesEffectDependencies); - return { fetchNewerEntries }; + return { fetchNewerEntries, checkForNewEntries: runFetchNewEntriesRequest }; }; export const useLogEntriesState: ( @@ -239,8 +240,8 @@ export const useLogEntriesState: ( ) => [LogEntriesStateParams, LogEntriesCallbacks] = props => { const [state, dispatch] = useReducer(logEntriesStateReducer, logEntriesInitialState); - const { fetchNewerEntries } = useFetchEntriesEffect(state, dispatch, props); - const callbacks = { fetchNewerEntries }; + const { fetchNewerEntries, checkForNewEntries } = useFetchEntriesEffect(state, dispatch, props); + const callbacks = { fetchNewerEntries, checkForNewEntries }; return [state, callbacks]; }; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_logs_content.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_logs_content.tsx index f789c16b67d9c..4d2b99da9b412 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_logs_content.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_logs_content.tsx @@ -82,6 +82,7 @@ export const LogsPageLogsContent: React.FunctionComponent = () => { items, lastLoadedTime, fetchNewerEntries, + checkForNewEntries, }) => ( { jumpToTarget={jumpToTargetPosition} lastLoadedTime={lastLoadedTime} loadNewerItems={fetchNewerEntries} + reloadItems={checkForNewEntries} reportVisibleInterval={reportVisiblePositions} scale={textScale} target={targetPosition}