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

Panel Header Fix: Implement new Panel Header on Angular Panels #66826

Merged
merged 10 commits into from
Apr 25, 2023

Conversation

axelavargas
Copy link
Member

@axelavargas axelavargas commented Apr 19, 2023

What is this feature?

Use the new panel header on angular panels.

  • Research effort required to use PanelChrome on PanelChromeAngular
  • Implement PanelChrome on angular panels

Idea from Torkel: refactor out a bit of code from PanelStateWrapper (something like getPanelChromeProps(panel, plugin, data)) so we can share some logic between PanelStateWrapper and PanelChromeAngular

Why do we need this feature?

Prevent a mix of UI on dashboards that have angular and react panels

Who is this feature for?

everyone

Which issue(s) does this PR fix?:

Fixes #66282

Special notes for your reviewer:

  • Should I target this change to milestone v10? or 9.5.x?

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@axelavargas axelavargas added this to the 10.0.0 milestone Apr 19, 2023
@axelavargas axelavargas self-assigned this Apr 19, 2023
@axelavargas axelavargas requested review from torkelo, mckn, a team, evictorero, kaydelaney and dprokop and removed request for a team April 19, 2023 09:49
@axelavargas axelavargas modified the milestones: 10.0.0, 9.5.x Apr 19, 2023
@axelavargas axelavargas added add to changelog backport v9.5.x Bot will automatically open backport PR labels Apr 19, 2023
@grafanabot
Copy link
Contributor

Hello @axelavargas!
Backport pull requests need to be either:

  • Pull requests which address bugs,
  • Urgent fixes which need product approval, in order to get merged,
  • Docs changes.

Please, if the current pull request addresses a bug fix, label it with the type/bug label.
If it already has the product approval, please add the product-approved label. For docs changes, please add the type/docs label.
If the pull request modifies CI behaviour, please add the type/ci label.
If none of the above applies, please consider removing the backport label and target the next major/minor release.
Thanks!

Copy link
Member

@dprokop dprokop left a comment

Choose a reason for hiding this comment

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

Comment on lines +247 to +248
data-testid={selectors.components.Panels.Panel.title(panel.title)}
aria-label={selectors.components.Panels.Panel.containerByTitle(panel.title)}
Copy link
Member

Choose a reason for hiding this comment

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

Wonder if lack of these when using the new PanelChrome wouldn't cause some test to fail?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, in the past we got some failed tests when we enabled the newPanelChromeUI feature flag by default, not only because of these selectors but also because we changed the flow of opening a menu. Marcus helped us in implementing code to maintain backward compatibility between the old angular panels and new panels PR. But, I think this code is not needed anymore as we will have the same flow for angular panels and react panels.

Copy link
Member

@torkelo torkelo left a comment

Choose a reason for hiding this comment

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

This looks really good but looks like you can move a lot more of the props to getPanelChromeProps

@polibb
Copy link
Contributor

polibb commented Apr 20, 2023

I can see some issues related to updating the panel when changing its settings: Change of the DS, description, links, transparency, etc. do not change the data or look of the panel until after the dashboard is saved and the page reloaded.

Screen.Recording.2023-04-20.at.14.01.24.mov

Changing the transparency, for example, is effective "immediately" if you change the panel type to a non-angular one and go back to the angular one:

Video: From angular panel to react panel, transparency udpate
Screen.Recording.2023-04-20.at.13.56.22.mov

NB! However, I can also see those problems on Ops right now:

Video: reproducing in ops
Screen.Recording.2023-04-20.at.13.59.20.mov

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
@axelavargas
Copy link
Member Author

I can see some issues related to updating the panel when changing its settings: Change of the DS, description, links, transparency, etc. do not change the data or look of the panel until after the dashboard is saved and the page reloaded.

Thank you @polibb 🙌🏾, I've tested locally and confirmed that these are indeed bugs. As you mentioned, they also exist in the current implementation (I tested them in ops). For now, I won't address them in this PR since they are out of scope. We can discuss this problem with the team and evaluate whether we should fix these issues, keeping in mind that Angular panels are deprecated.

@axelavargas axelavargas marked this pull request as ready for review April 25, 2023 09:32
@axelavargas axelavargas requested a review from a team as a code owner April 25, 2023 09:32
@axelavargas
Copy link
Member Author

@torkelo I applied all the suggestions 😄
✔️ Returned title items directly
✔️ Moved drag class, title, and description to getPanelChromeProps
✔️ Extracted common props from PanelChromeAngular and PanelStateWrapper

import { PanelPadding } from '@grafana/ui';
import { InspectTab } from 'app/features/inspector/types';
import { getPanelLinksSupplier } from 'app/features/panel/panellinks/linkSuppliers';
import { plugin } from 'app/plugins/panel/alertGroups/module';
Copy link
Member

Choose a reason for hiding this comment

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

@axelavargas I discovered a bug, the panel padding is not working / correctly set for panels that have the "noPadding" option set (Stat panel, old angular table panel).

The problem is that your importing plugin from here instead of accessing it from props :)

Copy link
Member Author

Choose a reason for hiding this comment

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

oh! will fix it :)

Copy link
Contributor

@polibb polibb left a comment

Choose a reason for hiding this comment

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

Manually tested with CarpetPlot and d3 - LGTM! Beautiful!

@axelavargas axelavargas changed the title Panel Header: Implement new Panel Header on Angular Panels Panel Header Fix: Implement new Panel Header on Angular Panels Apr 25, 2023
@axelavargas axelavargas merged commit 2a67b8a into main Apr 25, 2023
@axelavargas axelavargas deleted the axelav/migrate-to-angular-panels branch April 25, 2023 16:16
grafanabot pushed a commit that referenced this pull request Apr 25, 2023
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
(cherry picked from commit 2a67b8a)
axelavargas added a commit that referenced this pull request Apr 25, 2023
…ls (#67228)

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
Co-authored-by: Alexa V <239999+axelavargas@users.noreply.github.com>
Fix: Implement new Panel Header on Angular Panels (#66826)
@gtk-grafana
Copy link
Contributor

gtk-grafana commented May 1, 2023

https://ops.grafana-ops.net/d/eef643/mimir-reads?orgId=1&refresh=10s
image
https://github.com/grafana/grafana/blob/main/public/app/features/dashboard/utils/getPanelChromeProps.tsx#L44

I get nearly 100 of these dashboards_panelheader_description_displayed rudderstack events just scrolling to the bottom of a big dashboard, and they just keep coming. Do we really need to make this many requests? Can we aggregate and send these events out in batches or something if this data collection is critical?

@axelavargas

@axelavargas
Copy link
Member Author

Hey @gtk-grafana, thank you so much for pointing out this issue 🙌🏾 . Unfortunately, I overlooked the message 😢 and only became aware of the problem when it was brought up again today in our Slack channel. I have opened a PR to address this, as it isn't the expected behavior.

@zerok zerok modified the milestones: 10.0.0, 10.0.0-preview May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panel Header: Implement new Panel Header on Angular Panels
7 participants