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

Keyboard shortcuts and minimap UX #93

Merged
merged 23 commits into from
Oct 20, 2017

Conversation

tiffon
Copy link
Member

@tiffon tiffon commented Oct 14, 2017

93-00-viewrange-ux-kbd

Issues addressed:

Changes:

  • Revamped mouse UX on trace minimap
  • Adjusted rendering of the trace minimap to make spans more visible in large traces
  • Added visuals and mouse UX for zooming to trace timeline header row
  • Added keyboard shortcuts:
    • Scroll up, down (w, s)
    • Scroll to next, previous visible span (f, b)
    • Pan left, right (a or left, d or right)
    • Large pan left, right (shift+left, shift+right)
    • Zoom in, out (up, down)
    • Large zoom in, out (shift+up, shift+down)

TODO: fix tests.

Primary reason for this refactor is to lay the ground-work for keyboard
shortcuts.

- Got rid of components/TracePage#context

- components/TracePage#state.viewRange changed to have `.current` and
  `.next` with `.next` being the "unapplied" change from the mouse UX

- Minimap UX now publishes unapplied changes (user dragging on minimap)
  to `viewRange.next` instead of retaining them in the minimap state

- Minimap rendering changed to draw highlights based on `viewRange.next`
  regardless of UX state
- Color generator now also provides colors in RGB
- ListView now has a public API to inspect the state of the
  ListView scrolling
- VirtualizedTraceView now has a public API to inspect the state of
  the trace view
- SpanGraph scrubbers have wider grips
- SpanGraph minimap rendering update so the spans of large traces are
  more visible
- Tween utility class added
- scroll-page util added for animating window scrolling
- ScrollManager added for scrolling to prev / next visible span,
  sensitive to search filtering
- Keyboard shortcuts added for panning left, right, up down; zoom in,
  out; fast pan, zoom; skip to prev / next visible span

TODO
- Fix tests, add tests
- Reorganize a bit to make things a bit smaller and more
  compartmentalized (a few things are getting a little large)
- Refactor viewRange.next to support animating next position for both
  scrubbers
- Fixed a few tests, there are still broken tests
- Fixed issue in minimap when page resized
- Fixed issue in timeline header row mouse zoom when resize the columns
@coveralls
Copy link

Coverage Status

Coverage decreased (-8.6%) to 47.997% when pulling 6aad7ed on issue-23-trace-minimap-navigate-zoom into 61cd543 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+14.8%) to 71.399% when pulling 4ef1c55 on issue-23-trace-minimap-navigate-zoom into 61cd543 on master.

@tiffon tiffon changed the title [WIP] Keyboard shortcuts and minimap UX Keyboard shortcuts and minimap UX Oct 16, 2017
@@ -386,4 +446,4 @@ function mapDispatchToProps(dispatch) {
return bindActionCreators(actions, dispatch);
}

export default connect(mapStateToProps, mapDispatchToProps)(VirtualizedTraceView);
export default connect(mapStateToProps, mapDispatchToProps)(VirtualizedTraceViewImpl);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saminzadeh You had a suggestion for a better name than *Impl (where Impl is short form of implementation)... What was that, again?

- Use options object for DraggableManager
- Dont rerender CanvasSpanGraph unless trace changes
- Remove rows, spans from ViewRange
@coveralls
Copy link

Coverage Status

Coverage increased (+14.4%) to 71.004% when pulling 272cd64 on issue-23-trace-minimap-navigate-zoom into 61cd543 on master.

- Make trace minimap colors more prounounced
@coveralls
Copy link

Coverage Status

Coverage increased (+14.4%) to 71.038% when pulling 3cc5817 on issue-23-trace-minimap-navigate-zoom into 61cd543 on master.

package.json Outdated
@@ -83,7 +85,7 @@
"clear-homepage": "json -I -f package.json -e 'delete this.homepage'",
"deploy-docs": "./bin/deploy-docs.sh",
"postpublish": "npm run build:docs && npm run deploy-docs",
"add-license": "uber-licence",
"add-license": "uber-licence && git co flow-typed",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why git co flow-type?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cd src

* `setAccessors` is bound in the ctor, so it can be passed as a prop to
* children components.
*/
setAccessors = function setAccessors(accessors: Accessors) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you just do

{
  setAccessors(accessors) {
    this.accessors = accessors
  }
}

And then remove all those bindings in the constructor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Investigate

* ScrollManager is intended for scrolling the TracePage. Has two modes, paging
* and scrolling to the previous or next visible span.
*/
export default class ScrollManager {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit impartial about the OOP vs functional style here. Seems like the codebase has a mix of it now? I can see why you went with OOP given the implementation, but do you think we should be consistent? More specifically, to reduce state and unintended side effects in modules.

describe('<CanvasSpanGraph>', () => {
it('renders without exploding', () => {
const items = [{ valueWidth: 1, valueOffset: 1, serviceName: 'service-name-0' }];
const wrapper = mount(<CanvasSpanGraph items={[]} valueWidth={4000} />);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do shallow rendering here instead? Mount requires more and will slow down tests from my understanding?
https://github.com/airbnb/enzyme/blob/master/docs/api/mount.md

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great call. mount(...) is necessary in a few spots, but this is not one of them 👍

onClick={this._childrenToggle}
/>
<a
className={`span-name ${isDetailExapnded ? 'is-detail-expanded' : ''}`}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exapnded misspelled

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

getViewRange = function getViewRange() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this accessors are unnecessary abstraction. Just use the prop value directly, reduce the amount of boilerplate code.

Rename the props as necessary if you feel like it helps with readability.

Copy link
Member

@saminzadeh saminzadeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@coveralls
Copy link

Coverage Status

Coverage increased (+13.9%) to 70.516% when pulling 7a6fb5e on issue-23-trace-minimap-navigate-zoom into 61cd543 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+13.9%) to 70.516% when pulling f41bcf6 on issue-23-trace-minimap-navigate-zoom into 61cd543 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+13.7%) to 70.342% when pulling 2f22b02 on issue-23-trace-minimap-navigate-zoom into 61cd543 on master.

@tiffon tiffon merged commit b922904 into master Oct 20, 2017
@yurishkuro yurishkuro deleted the issue-23-trace-minimap-navigate-zoom branch January 29, 2020 15:06
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 5, 2021
…navigate-zoom

Keyboard shortcuts and minimap UX
Signed-off-by: vvvprabhakar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants