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

feat: Widget plugins #1564

Merged
merged 15 commits into from
Oct 19, 2023
Merged

feat: Widget plugins #1564

merged 15 commits into from
Oct 19, 2023

Conversation

mattrunyon
Copy link
Collaborator

@mattrunyon mattrunyon commented Oct 10, 2023

Fixes #1455
Fixes #1167 by allowing widget plugins to advertise their supported types. Dashboard plugins don't make as much sense supporting specific types and all of our existing dashboard plugins that open widgets from the server could be converted to widget plugins.

I debated making supportedTypes have a type of string | { type: string, icon: Icon } (+ array version), but felt it complicated things unnecessarily for our current types/icons. We can always add it in the future, but for now each widget plugin could support multiple types, but have 1 icon for the console.

I converted the pandas plugin as a test of widget plugins. Confirmed that if I create a dataframe and apply a sort/filter those persist across page refreshes.

Example code to make a dataframe

from deephaven import empty_table
from deephaven.pandas import to_pandas
t = empty_table(40000).update(["Timestamp=epochMillisToInstant(i)","x=(double)i", "y=i%12==11?null:Math.sin(i)"])
df = to_pandas(t)

Still needed

  • Wrapping in panel component
  • Config option to not automatically wrap

@mattrunyon mattrunyon requested a review from mofojed October 10, 2023 17:34
@mattrunyon mattrunyon self-assigned this Oct 10, 2023
@mattrunyon mattrunyon marked this pull request as draft October 10, 2023 17:35
packages/dashboard-core-plugins/src/WidgetLoaderPlugin.tsx Outdated Show resolved Hide resolved
Comment on lines +86 to +89
/**
* Listen for panel open events so we know when to open a panel
*/
useListener(layout.eventHub, PanelEvent.OPEN, handlePanelOpen);
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should deprecate the PanelEvent.OPEN, and change it to like WidgetEvent.OPEN or something. Since one widget can open multiple panels (defined with ui.panel). Re-hydrating the children panels will be interested as well.

packages/dashboard/src/DashboardLayout.tsx Outdated Show resolved Hide resolved
@mattrunyon mattrunyon requested a review from mofojed October 12, 2023 21:29
@mattrunyon mattrunyon marked this pull request as ready for review October 12, 2023 21:29
@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Attention: 26 lines in your changes are missing coverage. Please review.

Comparison is base (876a6ac) 46.44% compared to head (74a62ae) 46.65%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1564      +/-   ##
==========================================
+ Coverage   46.44%   46.65%   +0.20%     
==========================================
  Files         572      575       +3     
  Lines       36082    36189     +107     
  Branches     9035     9063      +28     
==========================================
+ Hits        16759    16883     +124     
+ Misses      19271    19254      -17     
  Partials       52       52              
Flag Coverage Δ
unit 46.65% <81.29%> (+0.20%) ⬆️

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

Files Coverage Δ
packages/app-utils/src/components/AppBootstrap.tsx 87.50% <ø> (ø)
...ages/app-utils/src/components/PluginsBootstrap.tsx 94.11% <ø> (ø)
packages/code-studio/src/index.tsx 0.00% <ø> (ø)
...ges/console/src/console-history/ConsoleHistory.tsx 100.00% <100.00%> (ø)
...console/src/console-history/ConsoleHistoryItem.tsx 52.72% <100.00%> (ø)
...s/dashboard-core-plugins/src/PandasPluginConfig.ts 100.00% <100.00%> (ø)
.../dashboard-core-plugins/src/WidgetLoaderPlugin.tsx 100.00% <100.00%> (ø)
...board-core-plugins/src/WidgetLoaderPluginConfig.ts 100.00% <100.00%> (ø)
...ckages/dashboard-core-plugins/src/panels/Panel.tsx 69.87% <100.00%> (+11.31%) ⬆️
.../dashboard-core-plugins/src/panels/WidgetPanel.tsx 54.23% <ø> (+3.38%) ⬆️
... and 9 more

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packages/jsapi-types/src/dh.types.ts Outdated Show resolved Hide resolved
packages/plugin/src/PluginTypes.ts Show resolved Hide resolved
mofojed
mofojed previously approved these changes Oct 18, 2023
@mattrunyon mattrunyon merged commit 94cc82c into deephaven:main Oct 19, 2023
5 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 19, 2023
@mattrunyon mattrunyon deleted the widget-plugin branch October 19, 2023 03:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for WidgetPlugins Allow dashboard plugins to advertise what type of objects they support
2 participants