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

EmbedPanel: Add a postMessage to embedded panel #86012

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

Mochi009
Copy link

@Mochi009 Mochi009 commented Apr 12, 2024

What is this feature?

In Grafana, embed a panel is a massive feature but it's not possible to interact with it. With this implementation of a postMessage, the time for the update of a panel in an iframe is much shorter.

Why do we need this feature?

This feature helps to minimize the time to update an embed panel using a postMessage instead of reloading all panel.

Who is this feature for?

All user that use grafana for the embedding can use it.

This functionality has been added within the files GrafanaRoute, SoloPanelPage, DashboardPanel, and PanelStateWrapper, which handle the creation of panels. In GrafanaRoute, the receiveMessage function takes a panelId as input, which is used to update the queryParams passed to SoloPanelPage, consequently updating the displayed panel. In PanelStateWrapper, on the other hand, the receiveMessage is designed to receive an array of key/value objects representing the variables to be updated for re-rendering the panel. All updates are performed using functions already present in Grafana.
This new functionality is helpfull when someone wants to update the variables the displayed panel uses. Instead of reloading all of its content, just the API for new data is triggered to display the new panel with new data.

Mochi988 and others added 8 commits April 8, 2024 15:29
…PanelPage, DashboardPanel, and PanelStateWrapper, which handle the creation of panels. In GrafanaRoute, the receiveMessage function takes a panelId as input, which is used to update the queryParams passed to SoloPanelPage, consequently updating the displayed panel. In PanelStateWrapper, on the other hand, the receiveMessage is designed to receive an array of key/value objects representing the variables to be updated for re-rendering the panel. All updates are performed using functions already present in Grafana.
@CLAassistant
Copy link

CLAassistant commented Apr 12, 2024

CLA assistant check
All committers have signed the CLA.

@grafana-pr-automation grafana-pr-automation bot added area/frontend pr/external This PR is from external contributor labels Apr 12, 2024
@Mochi009 Mochi009 marked this pull request as ready for review April 15, 2024 08:55
@Mochi009 Mochi009 requested review from a team as code owners April 15, 2024 08:55
@Mochi009 Mochi009 requested review from oscarkilhed, mdvictor, Clarity-89 and eledobleefe and removed request for a team April 15, 2024 08:55
@Mochi009 Mochi009 changed the title EmbedPanel: add a postMessage to embedded panel EmbedPanel: Add a postMessage to embedded panel Apr 15, 2024
@Mochi009 Mochi009 marked this pull request as draft April 15, 2024 09:06
@Mochi009 Mochi009 marked this pull request as ready for review April 15, 2024 09:06
@Mochi009
Copy link
Author

I want to add lables abount changelog and milestone but i can't. Any advice? Thanks!

@aangelisc aangelisc added this to the 11.1.x milestone Apr 29, 2024
@aangelisc
Copy link
Contributor

Hi @Mochi009, I've added the required label and the milestone. Please could you remove the changes to the CHANGELOG file?

@Mochi009
Copy link
Author

Thanks @aangelisc. Can you help me with the other test that is blocked right now?

@aangelisc
Copy link
Contributor

Hi @Mochi009,

Apologies for the delay. There are a couple failures preventing this from being mergeable.

  • In GrafanaRoute.tsx and PanelStateWrapper.tsx you've add any types which our betterer configuration doesn't permit. Is it possible to type these correctly? I've commented the exact locations.
  • The lint is falling, are you able to run yarn lint:fix
  • Could you also merge main please?

Thanks!

@Mochi009
Copy link
Author

Mochi009 commented May 1, 2024

Thanks @aangelisc. I fix problems with any type and lint. I also sync my repository with grafana main branch.
EDIT: if i run yarn lint:fix i don't have problems but the builder in grafana says that i have problems in two file. Can you help me? Thanks!

@baldm0mma
Copy link
Contributor

Unblocked the Drone continuous-integration/drone/pr build step.

@baldm0mma
Copy link
Contributor

@Mochi009 since you're not a member of the Grafana team, you don't have auth for interacting with enterprise content, so anything with enterprise-clone will fail, but it looks like you're having some linting issues still. Can you see the details for continuous-integration/drone/pr?

@Mochi009
Copy link
Author

Mochi009 commented May 1, 2024

Hi @baldm0mma. I'm working on that error. I will update you when i make a fix for it. Thanks!

@Mochi009
Copy link
Author

Mochi009 commented May 1, 2024

@baldm0mma i fix lint bug but i have problems with betterer-frontend and verify-i18n
Can you help me? Thanks again!

@Mochi009 Mochi009 requested a review from grafanabot as a code owner May 1, 2024 20:44
@Mochi009 Mochi009 requested a review from aangelisc May 7, 2024 13:40
Copy link
Contributor

github-actions bot commented Jun 7, 2024

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update or ping for review. Thank you for your contributions!

@github-actions github-actions bot added the stale Issue with no recent activity label Jun 7, 2024
@Mochi009
Copy link
Author

@aangelisc do you have any news? Thanks!

@github-actions github-actions bot removed the stale Issue with no recent activity label Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add to changelog area/frontend pr/external This PR is from external contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants