-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
feat(embedded-dashboard): Share Switchboard State for Sending Events from Plugins #21319
feat(embedded-dashboard): Share Switchboard State for Sending Events from Plugins #21319
Conversation
Codecov Report
@@ Coverage Diff @@
## master #21319 +/- ##
==========================================
- Coverage 66.85% 66.83% -0.02%
==========================================
Files 1798 1798
Lines 68827 68844 +17
Branches 7333 7339 +6
==========================================
+ Hits 46011 46014 +3
- Misses 20931 20951 +20
+ Partials 1885 1879 -6
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@villebro can you please check this feature request? |
@stephenLYZ @villebro can you please check? |
@stephenLYZ @villebro can you guys please check? |
@sinhashubham95 Hi. I think it's a nice feature but I don't have enough context for this. So It would be great if @suddjian can help with this. |
Thanks for your comment @stephenLYZ. I am aware of the |
@stephenLYZ @villebro @suddjian @rusackas can you guys please help review this pr? |
@stephenLYZ @villebro @suddjian @rusackas can you please check this? It has been open since long. |
@suddjian @villebro @stephenLYZ @rusackas @lilykuang anyone can help with this pr? This has been open for around a month now. |
@sinhashubham95 sorry for the delayed review. I'm not super familiar with this area, but I will review this in the coming days. |
Thanks @villebro |
@villebro any update? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one nit. I much prefer switching to a singleton, but I would be curious to hear if there were motivations for keeping it multiton. I'll leave this open for a few days and ping some other people, and if there are no objections I'll go ahead with merging.
name: string; | ||
name = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change needed? I feel like the previous one was cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to Ville's comment, I'd prefer string
as well ... and rest of the file does it that way too!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is added because there can be instances of logging the error even when Switchboard is not initialised, which will lead to logging undefined if this change is not made. It's just like providing a default initial value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, it should be name: string = '';
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's automatically detected in typescript based on the value assigned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sinhashubham95 makes sense, I hadn't thought of that 👍
@villebro can we merge this? |
SUMMARY
This is a new feature where we can have a shared switchboard singleton instance available. The idea is to be able to send the interactions happening from the embedded dashboard back to the parent loading the iframe. Another thing is to be able to send any details or data like what filters are selected by the user back to the parent loading the iframe. Now for that we need to have a shared state maintained which can be accessed from the plugins which are actually rendered into the dashboards. For this, a singleton instance of Switchboard which can be lazily initialised has been added. Now the embedded dashboard will use this singleton instance instead of initialising its own.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Embedded dashboards should render without any issue like before.
ADDITIONAL INFORMATION