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

[7.x] [Logs UI] Fix Check for New Data button on empty indices screen (#56239) #56320

Merged
merged 2 commits into from
Jan 30, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ interface ScrollableLogTextStreamViewProps {
fromScroll: boolean;
}) => any;
loadNewerItems: () => void;
reloadItems: () => void;
setFlyoutItem: (id: string) => void;
setFlyoutVisibility: (visible: boolean) => void;
highlightedItem: string | null;
Expand Down Expand Up @@ -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();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export type LogEntriesStateParams = {

export interface LogEntriesCallbacks {
fetchNewerEntries: () => Promise<TimeKey | null | undefined>;
checkForNewEntries: () => Promise<void>;
}
export const logEntriesInitialCallbacks = {
fetchNewerEntries: async () => {},
Expand Down Expand Up @@ -231,16 +232,16 @@ const useFetchEntriesEffect = (
useEffect(fetchMoreEntriesEffect, fetchMoreEntriesEffectDependencies);
useEffect(streamEntriesEffect, streamEntriesEffectDependencies);

return { fetchNewerEntries };
return { fetchNewerEntries, checkForNewEntries: runFetchNewEntriesRequest };
};

export const useLogEntriesState: (
props: LogEntriesProps
) => [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];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const LogsPageLogsContent: React.FunctionComponent = () => {
items,
lastLoadedTime,
fetchNewerEntries,
checkForNewEntries,
}) => (
<ScrollableLogTextStreamView
columnConfigurations={(source && source.configuration.logColumns) || []}
Expand All @@ -94,6 +95,7 @@ export const LogsPageLogsContent: React.FunctionComponent = () => {
jumpToTarget={jumpToTargetPosition}
lastLoadedTime={lastLoadedTime}
loadNewerItems={fetchNewerEntries}
reloadItems={checkForNewEntries}
reportVisibleInterval={reportVisiblePositions}
scale={textScale}
target={targetPosition}
Expand Down