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] Set streamLive false in URL state when arriving from link-to (#56329) #57114

Merged
merged 1 commit into from
Feb 7, 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 @@ -16,7 +16,7 @@ import { LogPositionState, LogPositionStateParams } from './log_position_state';

interface LogPositionUrlState {
position: LogPositionStateParams['visibleMidpoint'] | undefined;
streamLive?: boolean | undefined;
streamLive: boolean;
}

export const WithLogPositionUrlState = () => {
Expand Down Expand Up @@ -81,7 +81,7 @@ const mapToPositionUrlState = (value: any) =>
? pickTimeKey(value)
: undefined;

const mapToStreamLiveUrlState = (value: any) => (typeof value === 'boolean' ? value : undefined);
const mapToStreamLiveUrlState = (value: any) => (typeof value === 'boolean' ? value : false);

export const replaceLogPositionInQueryString = (time: number) =>
Number.isNaN(time)
Expand All @@ -91,4 +91,5 @@ export const replaceLogPositionInQueryString = (time: number) =>
time,
tiebreaker: 0,
},
streamLive: false,
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('RedirectToLogs component', () => {

expect(component).toMatchInlineSnapshot(`
<Redirect
to="/logs/stream?logFilter=(expression:'',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404))&sourceId=default"
to="/logs/stream?logFilter=(expression:'',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&sourceId=default"
/>
`);
});
Expand All @@ -33,7 +33,7 @@ describe('RedirectToLogs component', () => {

expect(component).toMatchInlineSnapshot(`
<Redirect
to="/logs/stream?logFilter=(expression:'FILTER_FIELD:FILTER_VALUE',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404))&sourceId=default"
to="/logs/stream?logFilter=(expression:'FILTER_FIELD:FILTER_VALUE',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&sourceId=default"
/>
`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('RedirectToNodeLogs component', () => {

expect(component).toMatchInlineSnapshot(`
<Redirect
to="/logs?logFilter=(expression:'HOST_FIELD:%20HOST_NAME',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404))&sourceId=default"
to="/logs?logFilter=(expression:'HOST_FIELD:%20HOST_NAME',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&sourceId=default"
/>
`);
});
Expand All @@ -89,7 +89,7 @@ describe('RedirectToNodeLogs component', () => {

expect(component).toMatchInlineSnapshot(`
<Redirect
to="/logs?logFilter=(expression:'(HOST_FIELD:%20HOST_NAME)%20and%20(FILTER_FIELD:FILTER_VALUE)',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404))&sourceId=default"
to="/logs?logFilter=(expression:'(HOST_FIELD:%20HOST_NAME)%20and%20(FILTER_FIELD:FILTER_VALUE)',kind:kuery)&logPosition=(position:(tiebreaker:0,time:1550671089404),streamLive:!f)&sourceId=default"
/>
`);
});
Expand Down