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

Dashboard: Store original JSON in DashboardModel #73881

Merged
merged 7 commits into from
Aug 29, 2023
Merged

Conversation

Clarity-89
Copy link
Contributor

@Clarity-89 Clarity-89 commented Aug 28, 2023

What is this feature?

Save the original dashboard JSON inside the DashboardModel instead of making an extra API request to fetch it when saving.

Why do we need this feature?

Removes an extra API request for fetching dashboard JSON when checking if there were any changes to the dashboard on save.

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.

@Clarity-89 Clarity-89 added this to the 10.2.x milestone Aug 28, 2023
@Clarity-89 Clarity-89 self-assigned this Aug 28, 2023
@Clarity-89 Clarity-89 requested review from a team as code owners August 28, 2023 06:03
@torkelo torkelo requested review from dprokop, ivanortegaalba and kaydelaney and removed request for ashharrison90 and JoaoSilvaGrafana August 28, 2023 06:11
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.

Looks good.

Thought - do we need to save in in Store? For the sake of simplicity, maybe just having it as a private property with a getter on DashboardModel would be sufficient, given the original dashboard is already passed in there via constructor, and dashboard model is available downstream the components on Dashboard page.

@Clarity-89
Copy link
Contributor Author

Thought - do we need to save in in Store? For the sake of simplicity, maybe just having it as a private property with a getter on DashboardModel would be sufficient, given the original dashboard is already passed in there via constructor, and dashboard model is available downstream the components on Dashboard page.

That's a good point and should make the code a bit simpler.

@Clarity-89 Clarity-89 changed the title Dashboard: Store original JSON in store Dashboard: Store original JSON in DashboardModel Aug 29, 2023
@Clarity-89 Clarity-89 merged commit c9323e3 into main Aug 29, 2023
10 checks passed
@Clarity-89 Clarity-89 deleted the dashboard/store-copy branch August 29, 2023 11:56
chauchausoup pushed a commit to chauchausoup/grafana that referenced this pull request Sep 15, 2023
* Dashboard: Save original JSON to state

* Dashboards: Update tests

* Dashboards: Fix original json access

* Dashboard: Save original to the DashboardModel

* Dashboard: Cleanup tests

* Remove original db setter
@zerok zerok modified the milestones: 10.2.x, 10.2.0 Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants