Skip to content

Commit 3e60e6b

Browse files
committed
fix: Fixes for nested dashboards/deephaven.ui
- Add a class name for widgets loaded from the widget-loader so we know what kind of panel it is - Allows specific styling to be applied for panels loaded with widget-loader - Add metadata to widget component props type - It's already gets passed through, just adding it to the type
1 parent dc84a67 commit 3e60e6b

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

packages/dashboard-core-plugins/src/WidgetLoaderPlugin.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ export function WrapWidgetPlugin(
3737
};
3838

3939
const hasRef = canHaveRef(C);
40+
const className = `widget-loader-${panelDescriptor.type}`;
4041

4142
return (
4243
<WidgetPanel
4344
descriptor={panelDescriptor}
45+
className={className}
4446
// eslint-disable-next-line react/jsx-props-no-spreading
4547
{...props}
4648
>

packages/plugin/src/PluginTypes.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
import type { dh } from '@deephaven/jsapi-types';
77
import type { IconDefinition } from '@fortawesome/fontawesome-common-types';
88
import type { TablePluginComponent } from './TablePlugin';
9+
import { WidgetDescriptor } from 'packages/dashboard/src/PanelEvent';
910

1011
export const PluginType = Object.freeze({
1112
AUTH_PLUGIN: 'AuthPlugin',
@@ -124,6 +125,11 @@ export interface WidgetComponentProps<T = unknown> {
124125
* @returns A promise that resolves to the widget data.
125126
*/
126127
fetch: () => Promise<T>;
128+
129+
/**
130+
* Descriptor of the widget, which may contain information such as the type and name of the widget.
131+
*/
132+
metadata?: WidgetDescriptor;
127133
/**
128134
* A unique identifier for the widget.
129135
* dh.ui uses this to identify widgets within a dashboard or panel.

0 commit comments

Comments
 (0)