|
| 1 | +import type { WidgetDescriptor } from '@deephaven/dashboard'; |
1 | 2 | import { type WidgetPlugin, PluginType } from '@deephaven/plugin'; |
2 | 3 | import { vsGraph } from '@deephaven/icons'; |
3 | 4 | import type { dh } from '@deephaven/jsapi-types'; |
4 | 5 | import { DASHBOARD_ELEMENT, WIDGET_ELEMENT } from './widget/WidgetUtils'; |
5 | 6 | import PortalPanel from './layout/PortalPanel'; |
6 | 7 | import UIWidget from './UIWidget'; |
7 | 8 |
|
| 9 | +export const DASHBOARD_PLUGIN_NAME = '@deephaven/js-plugin-ui.DashboardPlugin'; |
| 10 | + |
8 | 11 | /** |
9 | 12 | * Plugin for rendering deephaven.ui widgets, such as Element or Dashboard. |
10 | 13 | * PortalPanels are registered as they are used by the legacy DashboardPlugin to render elements. |
11 | 14 | */ |
12 | | -export const UIWidgetPlugin: WidgetPlugin<dh.Widget> = { |
| 15 | +export const UIWidgetPlugin: WidgetPlugin<dh.Widget> & { |
| 16 | + // TODO: Remove these extra types when it's updated in web-client-ui |
| 17 | + dashboardTypes: string[]; |
| 18 | + createDashboardPayload: (widget: WidgetDescriptor) => unknown; |
| 19 | +} = { |
13 | 20 | name: '@deephaven/js-plugin-ui', |
14 | 21 | type: PluginType.WIDGET_PLUGIN, |
15 | 22 | supportedTypes: [WIDGET_ELEMENT, DASHBOARD_ELEMENT, PortalPanel.displayName], |
16 | 23 | component: UIWidget, |
17 | 24 | icon: vsGraph, |
| 25 | + |
| 26 | + dashboardTypes: [DASHBOARD_ELEMENT], |
| 27 | + createDashboardPayload: (widget: WidgetDescriptor) => ({ |
| 28 | + pluginId: DASHBOARD_PLUGIN_NAME, |
| 29 | + title: widget?.name ?? 'Untitled', |
| 30 | + data: { openWidgets: { [DASHBOARD_PLUGIN_NAME]: { descriptor: widget } } }, |
| 31 | + }), |
18 | 32 | }; |
19 | 33 |
|
20 | 34 | export default UIWidgetPlugin; |
0 commit comments