superset icon indicating copy to clipboard operation
superset copied to clipboard

feat(embedded-dashboard): Share Switchboard State for Sending Events from Plugins

Open sinhashubham95 opened this issue 3 years ago • 9 comments

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

  • [ ] Has associated issue:
  • [ ] Required feature flags:
  • [ ] Changes UI
  • [ ] Includes DB Migration (follow approval process in SIP-59)
    • [ ] Migration is atomic, supports rollback & is backwards-compatible
    • [ ] Confirm DB migration upgrade and downgrade tested
    • [ ] Runtime estimates and downtime expectations provided
  • [x] Introduces new feature or API
  • [ ] Removes existing feature or API

sinhashubham95 avatar Sep 03 '22 08:09 sinhashubham95

Codecov Report

Merging #21319 (08d611b) into master (61bd696) will decrease coverage by 0.01%. The diff coverage is 75.00%.

@@            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     
Flag Coverage Δ
javascript 53.18% <75.00%> (-0.02%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset-frontend/src/embedded/index.tsx 0.00% <0.00%> (ø)
...ackages/superset-ui-switchboard/src/switchboard.ts 100.00% <100.00%> (ø)
...rd/components/nativeFilters/FilterBar/keyValue.tsx 18.51% <0.00%> (-22.23%) :arrow_down:
...board/components/nativeFilters/FilterBar/index.tsx 60.43% <0.00%> (-5.76%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Sep 03 '22 21:09 codecov[bot]

@villebro can you please check this feature request?

sinhashubham95 avatar Sep 03 '22 21:09 sinhashubham95

@stephenLYZ @villebro can you please check?

sinhashubham95 avatar Sep 04 '22 08:09 sinhashubham95

@stephenLYZ @villebro can you guys please check?

sinhashubham95 avatar Sep 05 '22 09:09 sinhashubham95

@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. Besides, if you want to use the singleton pattern, superset-ui-core provides a makeSingleton method to use.

stephenLYZ avatar Sep 05 '22 09:09 stephenLYZ

Thanks for your comment @stephenLYZ. I am aware of the makeSingleton function in the superset-ui-core package, but it still does not provide a way to share the instance across packages. That's why I took this route.

sinhashubham95 avatar Sep 05 '22 15:09 sinhashubham95

@suddjian @villebro can you please check this pr?

sinhashubham95 avatar Sep 05 '22 15:09 sinhashubham95

@stephenLYZ @villebro @suddjian @rusackas can you guys please help review this pr?

sinhashubham95 avatar Sep 06 '22 16:09 sinhashubham95

@stephenLYZ @villebro @suddjian @rusackas can you please check this? It has been open since long.

sinhashubham95 avatar Sep 18 '22 11:09 sinhashubham95

@lilykuang

jayakrishnankk avatar Sep 29 '22 21:09 jayakrishnankk

@suddjian @villebro @stephenLYZ @rusackas @lilykuang anyone can help with this pr? This has been open for around a month now.

sinhashubham95 avatar Oct 01 '22 05:10 sinhashubham95

@sinhashubham95 sorry for the delayed review. I'm not super familiar with this area, but I will review this in the coming days.

villebro avatar Oct 01 '22 07:10 villebro

Thanks @villebro

sinhashubham95 avatar Oct 01 '22 07:10 sinhashubham95

@villebro any update?

sinhashubham95 avatar Oct 06 '22 13:10 sinhashubham95

@villebro can we merge this?

sinhashubham95 avatar Oct 10 '22 13:10 sinhashubham95