-
Notifications
You must be signed in to change notification settings - Fork 488
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 uiFind icons, scroll to first match #367
add uiFind icons, scroll to first match #367
Conversation
Signed-off-by: Everett Ross <reverett@uber.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very much WIP to discuss better approaches than the setTimeout
s
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/index.tsx
Outdated
Show resolved
Hide resolved
@@ -158,6 +159,10 @@ export class VirtualizedTraceViewImpl extends React.PureComponent<VirtualizedTra | |||
setTrace(trace, uiFind); | |||
} | |||
|
|||
componentDidMount() { | |||
setTimeout(this.props.scrollToFirstVisibleSpan); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the setTimeout
it scrolls to the bottom. I think the rows may not have height in the initial render.
@tiffon do you have any insight on why this would scroll too far without the setTimeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the constructor calls setTrace(...)
. When visiting the URL, directly, the setTrace(...)
applies the find matching.
When coming from the search page the setTimeout
has no effect; the find is already applied to the redux state via the reducer that changed the state to be viewing the trace.
So, seems like the rows are rendered but they're not collapsed, yet, when visiting a trace directly from a URL. Probably it's scrolling to the position of the row, but then the non-matching rows are collapsed and the target scroll position ends up getting truncated with the result of being scrolled to the bottom.
focusUiFind: () => { | ||
if (trace.data) { | ||
focusUiFind(trace.data, uiFind); | ||
setTimeout(this._scrollManager.scrollToFirstVisibleSpan); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scroll destination changes as a result of dispatching focusUiFind
. This setTimeout
achieves the desired result but definitely seems like the wrong way to achieve this.
@tiffon how would you recommend scrolling to the first match only after the rows have been expanded/collapsed and had their children shown/hidden?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a tough one, maybe via componentDidUpdate()
with an instance property indicating whether or not the component should scroll.
Also, I recommend turning this into a method instead of creating a new function with every render.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately an instance property wouldn't work because the component that updates as a result of focusUiFind
is not TracePage/index.tsx
. I got around this by adding a property to the detailStates
Map and childrenHiddenIDs
Set made by calculateHiddenIdsAndDetailStates
in TracePage/duck.tsx
and reading that property in componentDidUpdate
in TraceTimelineViewer/VirtualizedTraceView.tsx
It's slightly unorthodox in principle, but not so bad in practice.
Here is the commit that solely addresses setTimeout
TODO: more tests and icons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Left a few comments.
Also, what do you think of this change to the aesthetics of the search bar? (The borders are removed and the icon is shifted to be the first button.)
And, what do you think of this icon for the collapse-and-scroll?
(Akin to the maps icon to center the map on your current location.)
Last, currently, the search bar elements have a max width which is getting kind of not long enough given how many buttons we're adding. What do you think of removing that and letting it flex-grow when it's in use? The trace-name will probably need to have flex: 0 0 auto
, in that case.
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/index.tsx
Outdated
Show resolved
Hide resolved
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/duck.tsx
Outdated
Show resolved
Hide resolved
focusUiFind: () => { | ||
if (trace.data) { | ||
focusUiFind(trace.data, uiFind); | ||
setTimeout(this._scrollManager.scrollToFirstVisibleSpan); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a tough one, maybe via componentDidUpdate()
with an instance property indicating whether or not the component should scroll.
Also, I recommend turning this into a method instead of creating a new function with every render.
@@ -158,6 +159,10 @@ export class VirtualizedTraceViewImpl extends React.PureComponent<VirtualizedTra | |||
setTrace(trace, uiFind); | |||
} | |||
|
|||
componentDidMount() { | |||
setTimeout(this.props.scrollToFirstVisibleSpan); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the constructor calls setTrace(...)
. When visiting the URL, directly, the setTrace(...)
applies the find matching.
When coming from the search page the setTimeout
has no effect; the find is already applied to the redux state via the reducer that changed the state to be viewing the trace.
So, seems like the rows are rendered but they're not collapsed, yet, when visiting a trace directly from a URL. Probably it's scrolling to the position of the row, but then the non-matching rows are collapsed and the target scroll position ends up getting truncated with the result of being scrolled to the bottom.
TODO: Fix & add tests Signed-off-by: Everett Ross <reverett@uber.com>
tests, add TraceTimelineViewer/duck.tsx tests Signed-off-by: Everett Ross <reverett@uber.com>
Codecov Report
@@ Coverage Diff @@
## master #367 +/- ##
==========================================
+ Coverage 88.12% 88.65% +0.53%
==========================================
Files 157 157
Lines 3494 3518 +24
Branches 798 802 +4
==========================================
+ Hits 3079 3119 +40
+ Misses 378 364 -14
+ Partials 37 35 -2
Continue to review full report at Codecov.
|
Signed-off-by: Everett Ross <reverett@uber.com>
Signed-off-by: Everett Ross <reverett@uber.com>
Signed-off-by: Everett Ross <reverett@uber.com>
Signed-off-by: Everett Ross <reverett@uber.com>
Except for the possibility of removing Tween.tsx I believe all feedback has been addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Left some comments, let me know what you think.
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/VirtualizedTraceView.tsx
Outdated
Show resolved
Hide resolved
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/duck.tsx
Outdated
Show resolved
Hide resolved
packages/jaeger-ui/src/components/TracePage/TracePageHeader/TracePageSearchBar.css
Outdated
Show resolved
Hide resolved
packages/jaeger-ui/src/components/TracePage/TracePageHeader/TracePageSearchBar.tsx
Show resolved
Hide resolved
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/index.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: Everett Ross <reverett@uber.com>
Signed-off-by: Everett Ross <reverett@uber.com>
Signed-off-by: Everett Ross <reverett@uber.com>
Signed-off-by: Everett Ross <reverett@uber.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Some minor comments. LMK if you want to talk about any of them.
width: 40%; | ||
} | ||
|
||
.TracePageSearchBar--InputGroup { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have an initial lowercase:
.TracePageSearchBar--inputGroup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, you can use the util class .ub-justify-end
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, updated
Where is the list of .ub-
classes?
packages/jaeger-ui/src/components/TracePage/TracePageHeader/TracePageSearchBar.css
Outdated
Show resolved
Hide resolved
{/* style inline because compact overwrites the display */} | ||
<Input.Group compact style={{ display: 'flex' }}> | ||
<Input.Group className="TracePageSearchBar--InputGroup" compact style={{ display: 'flex' }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid using style
unless the style is dynamic and needs to be calculated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's pre-existing. I can take a stab at fixing it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above the inline style
seems to be accurate. I'm going to leave it as is.
@@ -69,6 +68,7 @@ export default function SpanDetail(props: SpanDetailProps) { | |||
value: formatDuration(relativeStartTime), | |||
}, | |||
]; | |||
const deepLinkCopyText = `${window.location.origin}${window.location.pathname}?uiFind=${spanID}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just using location.origin
, sans window
?
Also, it's a bit strange having the magic string 'uiFind'
in several places. I think this makes three. We can consolidate in a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I'm just used to seeing window.location
instead of location
on its own, but location
on its own works fine and is shorter so I updated.
I agree about consolidating uiFind
in its own PR. Should that just be when uiFind
is in a string? If so, this seems to be the only instance based on a quick search (ag --ts '['"'"'"`].+uiFind'
). But I think it would make sense to be a constant whenever it is interacting with the URL (i.e.: here and when interacting with queryString.parse
/ queryString.stringify
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, eslint dislikes location
but doesn't mind window.location
. What is your preference on using window.location
vs // eslint-disable-line no-restricted-globals
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/VirtualizedTraceView.tsx
Show resolved
Hide resolved
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/duck.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: Everett Ross <reverett@uber.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One quick question about focusing the find results from going back to the trace timeline view. Seems like that might be jarring?
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/VirtualizedTraceView.tsx
Show resolved
Hide resolved
@@ -280,6 +280,9 @@ export class TracePageImpl extends React.PureComponent<TProps, TState> { | |||
if (this.props.trace && this.props.trace.data) { | |||
this.traceDagEV = calculateTraceDagEV(this.props.trace.data); | |||
} | |||
if (traceGraphView) { | |||
this.focusUiFindMatches(); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems kind of strange. So, it will focus the UI find matches when you go back to the timeline view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I had removed this... It doesn't work without more changes and as you said it may not be the desired functionality.
Will really remove and push.
Signed-off-by: Everett Ross <reverett@uber.com>
…0-improve-uiFind-interactions add uiFind icons, scroll to first match Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
Which problem is this PR solving?
Short description of the changes
Screenshots of visual changes:
Unfocused Find
Aside from the icon button changes, the uiFind input looks the same before focusing
Focused Find
Focusing the input results in it widening
Icon close up
New Icon is currently hovered to show distinction. Vertical borders have been removed.
Deep link icon
New deep link icon, with tooltip (and with safari's scrollbar rearing its head)
Focused button
Slight highlight indicates focus.