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

Ability to Pin Views #739

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

hriday-panchasara
Copy link
Contributor

@hriday-panchasara hriday-panchasara commented Apr 26, 2022

  • Add Ability to pin views to the top of the layout so that they stay visible when scrolling
  • Current implementation is to allow pinning only one view at a time
  • View is scrolled into focus when pinned/unpinned
  • Pinned view persists when page refreshed
  • Added additional resize handlers to pinned view in case height exceeds page length

Screen Shot 2022-05-18 at 11 07 59 AM

@hriday-panchasara
Copy link
Contributor Author

Our current layout is using two containers - one for timeline-charts and below it one for non-timeline-charts. In order to show a pinned view I've added another container on top of these two, so that any view when pinned would move to this top container without breaking the existing layout. The only issue is that when we re-render trace-context-component to show this new layout, the new Virtual DOM tree shows that an output is added to / removed from the pinned views container, hence re-rendering the output-view that just got pinned/unpinned. Since we don't keep track of the of the output component's tree, we lose the selections that are made. A future improvement could be to persist the state of the abstract-tree-output component

@bhufmann
Copy link
Collaborator

Nice feature!

@bhufmann
Copy link
Collaborator

bhufmann commented May 13, 2022

Our current layout is using two containers - one for timeline-charts and below it one for non-timeline-charts. In order to show a pinned view I've added another container on top of these two, so that any view when pinned would move to this top container without breaking the existing layout. The only issue is that when we re-render trace-context-component to show this new layout, the new Virtual DOM tree shows that an output is added to / removed from the pinned views container, hence re-rendering the output-view that just got pinned/unpinned. Since we don't keep track of the of the output component's tree, we lose the selections that are made. A future improvement could be to persist the state of the abstract-tree-output component

I think it would be beneficial to persist the state of view that's being pinned and unpinned. When running this change, I expected that the view is just re-arranged to the top, but nothing else changes. Having to redo the selections in the tree or scrolling vertically doesn't provide a good UX. It should just behave like moving the output component manually with the left mouse button drag.

@hriday-panchasara what to you suggest as next steps to also achieve this?

@bhufmann
Copy link
Collaborator

Another question: Should we add a visual indicator that the view is pinned? Maybe add a pin image or something similar somewhere which is only shown when it's pinned.

@hriday-panchasara
Copy link
Contributor Author

hriday-panchasara commented May 17, 2022

Thanks @bhufmann , unfortunately I'm not sure how to pin/unpin views without losing track of state. I tried experimenting with react-grid-layout, but the only way I found to keep a view visible while scrolling was to put it in a separate container and make that container static through CSS. For non-timescale layouts the state can be persisted as datatree-output-component is static and events-table reflects the selected events in the timerange. We can think of a future enhancement to have an option to keep track of abstract-tree-output-component's state on rerender. Since we're only providing the ability to pin one view at the time, and it can only be accessed by the options menu, I'm assuming that toggling pin/unpin won't be used excessively and losing state is a small drawback that we can consider.

@bhufmann
Copy link
Collaborator

Thanks @bhufmann , unfortunately I'm not sure how to pin/unpin views without losing track of state. I tried experimenting with react-grid-layout, but the only way I found to keep a view visible while scrolling was to put it in a separate container and make that container static through CSS. For non-timescale layouts the state can be persisted as datatree-output-component is static and events-table reflects the selected events in the timerange. We can think of a future enhancement to have an option to keep track of abstract-tree-output-component's state on rerender. Since we're only providing the ability to pin one view at the time, and it can only be accessed by the options menu, I'm assuming that toggling pin/unpin won't be used excessively and losing state is a small drawback that we can consider.

I think loosing the state would not be a good UX. However, I'm ok that we work on merging this PR and have a separate PR for keeping the state.

Copy link
Collaborator

@bhufmann bhufmann left a comment

Choose a reason for hiding this comment

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

I tested it and it works well. The location of the pin feels a bit out of place (see picture below). It should be aligned next to the hamburger menu. It should also show some tooltip to indicate what it means when users hover over it with the mouse. Could we even make it a button to unpin?

Secondly, when pinning the events table it is shown under time axis. Could we move it and other non-time-axis views above the axis instead when pinning? Time-axis views (timegraph or XY) would stay below the time axis.

image

@bhufmann
Copy link
Collaborator

I just noticed that the following error was in the console log. Not exactly sure when it happened (maybe during unpin):

root ERROR Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
    in TableOutputComponent (created by TraceContextComponent)
    in Resizable (created by GridItem)
    in DraggableCore (created by GridItem)
    in GridItem (created by ReactGridLayout)
    in div (created by ReactGridLayout)
    in ReactGridLayout (created by ResponsiveReactGridLayout)
    in ResponsiveReactGridLayout (created by WidthProvider)
    in WidthProvider (created by TraceContextComponent)

Have you seen that?

Current implementation is to allow pinning only one view at a time

View is scrolled into focus when pinned/unpinned

Pinned view persists on page refresh

Added additional resize handlers to pinned view in case height exceeds page length

Signed-off-by: hriday-panchasara <hriday.panchasara@ericsson.com>
@hriday-panchasara
Copy link
Contributor Author

hriday-panchasara commented Jun 1, 2022

I tested it and it works well. The location of the pin feels a bit out of place (see picture below). It should be aligned next to the hamburger menu. It should also show some tooltip to indicate what it means when users hover over it with the mouse. Could we even make it a button to unpin?

Secondly, when pinning the events table it is shown under time axis. Could we move it and other non-time-axis views above the axis instead when pinning? Time-axis views (timegraph or XY) would stay below the time axis.

image

I've added a tooltip to the icon on hover, but I'm not sure if its a good idea to have the icon act as a button. We decided to use a hamburger menu because we want charts to have multiple options in the future (filter, export, pin), and we want the menu to be shown on overflow as well. The below picture shows an example where the pin icon is not shown because of title bar label overflow
Screen Shot 2022-06-01 at 10 11 24 AM

Like you mentioned, we could align the pin icon next to the hamburger menu, but then we'll have to increase the output view's min height to keep these buttons visible. The following picture shows the current layout where the view's min height is set to show both the hamburger menu and the close icon:
Screen Shot 2022-06-01 at 10 17 37 AM

Regarding having the icon act as a button, my initial idea was to do the same, but while testing it out at times doing drag and drop for views I clicked the button by mistake, which made me think of it as inconvenient UX.

I've adjusted the layout to show pinned non-time-axis views above the time-axis:
Screen Shot 2022-06-01 at 10 21 36 AM

@hriday-panchasara
Copy link
Contributor Author

I just noticed that the following error was in the console log. Not exactly sure when it happened (maybe during unpin):

root ERROR Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
    in TableOutputComponent (created by TraceContextComponent)
    in Resizable (created by GridItem)
    in DraggableCore (created by GridItem)
    in GridItem (created by ReactGridLayout)
    in div (created by ReactGridLayout)
    in ReactGridLayout (created by ResponsiveReactGridLayout)
    in ResponsiveReactGridLayout (created by WidthProvider)
    in WidthProvider (created by TraceContextComponent)

Have you seen that?

Yeah, I see it only when performing pin/unpin on the events table. Fixed the issue

Copy link
Collaborator

@bhufmann bhufmann left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

@bhufmann bhufmann merged commit 4cc86f9 into eclipse-cdt-cloud:master Jun 7, 2022
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