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

DashboardScene: adjust lib panel as a dashboard datasource refresh logic #87120

Merged
merged 4 commits into from May 2, 2024

Conversation

Sergej-Vlasov
Copy link
Contributor

@Sergej-Vlasov Sergej-Vlasov commented Apr 30, 2024

Not sure if this is not caused by a more global issue.
So far seems like two issues were causing the bug:

Fixes #87128

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.

@Sergej-Vlasov Sergej-Vlasov added type/bug area/frontend/library-panels no-changelog Skip including change in changelog/release notes area/scenes internal for issues made by grafanistas labels Apr 30, 2024
@Sergej-Vlasov Sergej-Vlasov added this to the 11.0.x milestone Apr 30, 2024
@Sergej-Vlasov Sergej-Vlasov self-assigned this Apr 30, 2024
@grafana-delivery-bot grafana-delivery-bot bot modified the milestones: 11.0.x, 11.1.x Apr 30, 2024
@@ -10,10 +10,15 @@ export class PanelModelCompatibilityWrapper implements PanelModel {
constructor(private _vizPanel: VizPanel) {}

public get id() {
// console.log('this._vizPanel.parent', this._vizPanel.parent);
// console.log('this._vizPanel', this._vizPanel);

const id = getPanelIdForVizPanel(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should use getPanelIdForLibraryVizPanel instead of modifying getPanelIdForVizPanel here. So I think we can check if the vizPanel parent is LibraryVizPanel or not and call the appropriate function for it.

Comment on lines 33 to 37
// return parseInt(panel.state.key!.replace('panel-', ''), 10);

let key = ('panelKey' in panel.state ? panel.state.panelKey : panel.state.key) as string;

return parseInt(key.replace('panel-', ''), 10);
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 #87125 is enough / simpler fix

@Sergej-Vlasov Sergej-Vlasov changed the title DashboardScene: adjust lib panel as a datasource logic DashboardScene: adjust lib panel as a dashboard datasource refresh logic Apr 30, 2024
@Sergej-Vlasov Sergej-Vlasov marked this pull request as ready for review April 30, 2024 13:20
@Sergej-Vlasov Sergej-Vlasov requested a review from a team as a code owner April 30, 2024 13:20
Comment on lines 60 to 62
if (!panel.parent.isActive) {
panel.parent.activate();
}
Copy link
Member

Choose a reason for hiding this comment

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

need to call the deactivation function returned by activate (in the deactivation function for this behavior)

@Sergej-Vlasov Sergej-Vlasov added the backport v11.0.x Mark PR for automatic backport to v11.0.x label Apr 30, 2024
Copy link
Contributor

This PR must be merged before a backport PR will be created.

@ivanortegaalba
Copy link
Contributor

Tested and the problem is solved 💯

@Sergej-Vlasov Sergej-Vlasov merged commit afbd02c into main May 2, 2024
14 checks passed
@Sergej-Vlasov Sergej-Vlasov deleted the serge-lib-panel-as-datasource-fix branch May 2, 2024 13:20
grafana-delivery-bot bot pushed a commit that referenced this pull request May 2, 2024
…gic (#87120)

* activate library viz panel and adjust id extractor

* revert parts that are fixed in #87125

* clean up after activation handler

(cherry picked from commit afbd02c)
Sergej-Vlasov added a commit that referenced this pull request May 2, 2024
…refresh logic (#87232)

DashboardScene: adjust lib panel as a dashboard datasource refresh logic (#87120)

* activate library viz panel and adjust id extractor

* revert parts that are fixed in #87125

* clean up after activation handler

(cherry picked from commit afbd02c)

Co-authored-by: Sergej-Vlasov <37613182+Sergej-Vlasov@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend/library-panels area/frontend area/scenes backport v11.0.x Mark PR for automatic backport to v11.0.x internal for issues made by grafanistas no-changelog Skip including change in changelog/release notes type/bug
Projects
Status: 🚀 Done
Development

Successfully merging this pull request may close these issues.

Refreshing a panel in edit mode that has library panel as dashboard datasource does not load panel
4 participants