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

Plugins: Allow disabling angular deprecation UI for specific plugins #77026

Merged
merged 14 commits into from
Nov 10, 2023

Conversation

xnyo
Copy link
Member

@xnyo xnyo commented Oct 24, 2023

What is this feature?

Adds hideAngularDeprecation to frontendsettings for each plugin. This field is set by the backend if the config contains hide_angular_deprecation = true in the plugin's settings:

[plugin.grafana-worldmap-panel]
hide_angular_deprecation = true

When this is true, the angular deprecation UI elements for that particular plugin will be hidden from dashboards. This does not affect other code relying on Angular detection (e.g.: plugins sandboxing), but it only hides the following UI elements from dashboards:

  • Warning at the top of the dashboard (if FF is enabled)
  • Icons on affected panels (if FF is enabled)
  • Warnings when editing a panel

Why do we need this feature?

Rework of #71067 without breaking changes, as detect-angular-dashboards now depends on it. Due to it the previous PR got stale and was never merged.

Who is this feature for?

Grafana users relying on Angular plugins.

Which issue(s) does this PR fix?:

Fixes #

Special notes for your reviewer:

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.

@xnyo xnyo marked this pull request as ready for review October 27, 2023 09:38
@xnyo xnyo requested review from a team as code owners October 27, 2023 09:38
@xnyo xnyo requested review from dprokop, ivanortegaalba, academo, joshhunt, L-M-K-B, wbrowne and marefr and removed request for a team October 27, 2023 09:38
@xnyo xnyo requested review from oshirohugo, zserge, nikimanoledaki, suntala, jackw, mckn and briangann and removed request for a team October 27, 2023 09:38
Copy link
Contributor

@mckn mckn left a comment

Choose a reason for hiding this comment

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

Overall I think this looks good! I have added a suggestion about grouping the properties together in a struct and also revisit the types on the frontend since I believe we have added the properties incorrectly to the plugin meta type.

pkg/plugins/models.go Show resolved Hide resolved
Comment on lines 227 to 228
AngularDetected bool `json:"angularDetected"`
HideAngularDeprecation bool `json:"hideAngularDeprecation"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to group these into an angular struct? Something like: type Angular struct { Detected: bool HideDeprecation: bool }?

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, it makes sense. I tried avoiding it so we don't introduce a breaking change. However this piece of information is currently being used only by the sandbox and detect-angular-dashboards, as far as I know. Since we own both pieces, and it was suggested also in the original PR, I will do it the way you suggested 😄

Copy link
Contributor

github-actions bot commented Nov 7, 2023

⚠️   Possible breaking changes

(Open the links below in a new tab to go to the correct steps)

grafana-data has possible breaking changes (more info)
grafana-runtime has possible breaking changes (more info)

Console output
Read our guideline

@github-actions github-actions bot added the levitate breaking change A label indicating a breaking change and assigned by Levitate. label Nov 7, 2023
@xnyo xnyo requested a review from mckn November 7, 2023 11:02
Copy link
Contributor

@mckn mckn left a comment

Choose a reason for hiding this comment

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

LGTM!

I got the functionality working for the akumuli-datasource but I couldn't get it to work for the graph.

This was the config I used:

[plugin.graph]
hide_angular_deprecation = true

@xnyo
Copy link
Member Author

xnyo commented Nov 8, 2023

I got the functionality working for the akumuli-datasource but I couldn't get it to work for the graph.

This was the config I used:

[plugin.graph]
hide_angular_deprecation = true

Good catch! I have fixed the issue here: 7880738. However, angular.detected will still be false because angular detections do not work properly for core plugins as we inspect the plugin's module.js file.

graph still gets flagged as angular by the frontend because we check for angularPanelCtrl as well:

return (this.plugin && this.plugin.angularPanelCtrl) !== undefined || (this.plugin?.meta?.angular?.detected ?? false);

However angular.detected being false can have some unintended side effects, I will take a look but it's not related/introduced to this PR :)

@xnyo xnyo merged commit da117ae into main Nov 10, 2023
18 of 19 checks passed
@xnyo xnyo deleted the giuseppe/angular-deprecation/ui-plugin-settings-v2 branch November 10, 2023 10:44
@aangelisc aangelisc modified the milestones: 10.3.x, 10.2.3 Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants