Skip to content

Commit

Permalink
[Logs UI] Set streamLive false in URL state when arriving from link-to (
Browse files Browse the repository at this point in the history
#56329)

* [Logs UI] Remove streamLive false from URL state

* Force false livestream boolean from link-to

* Update type def

* Update snapshots

* Fix snapshot typo

* Fix snapshot again

* Fix node test snapshot

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
Zacqary and elasticmachine authored Feb 7, 2020
1 parent 12fcf01 commit 13944fa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
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

0 comments on commit 13944fa

Please sign in to comment.