Skip to content

Commit

Permalink
fix: TablePlugin needs to know table name and selected range (#2181)
Browse files Browse the repository at this point in the history
Resolves #2093
  • Loading branch information
AkshatJawne committed Aug 15, 2024
1 parent 949118e commit 0b37477
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions packages/dashboard-core-plugins/src/panels/IrisGridPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ export class IrisGridPanel extends PureComponent<
}

// TODO #2093: Find a better way to handle deprecated panel prop
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const deprecatedProps = {
panel: this,
};
Expand All @@ -436,10 +437,10 @@ export class IrisGridPanel extends PureComponent<
fetchColumns={this.handlePluginFetchColumns}
model={model}
table={model.table}
tableName={this.getTableName()}
selectedRanges={this.irisGrid.current?.state.selectedRanges}
onStateChange={this.handlePluginStateChange}
pluginState={pluginState}
// eslint-disable-next-line react/jsx-props-no-spreading
{...deprecatedProps}
/>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions packages/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"dependencies": {
"@deephaven/components": "file:../components",
"@deephaven/golden-layout": "file:../golden-layout",
"@deephaven/grid": "file:../grid",
"@deephaven/icons": "file:../icons",
"@deephaven/iris-grid": "file:../iris-grid",
"@deephaven/jsapi-types": "^1.0.0-dev0.34.0",
Expand Down
11 changes: 11 additions & 0 deletions packages/plugin/src/TablePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
IrisGridContextMenuData,
IrisGridModel,
} from '@deephaven/iris-grid';
import { GridRange } from '@deephaven/grid';
import type { ResolvableContextAction } from '@deephaven/components';
import type { dh } from '@deephaven/jsapi-types';

Expand Down Expand Up @@ -35,6 +36,16 @@ export interface TablePluginProps<S = unknown> {
*/
table: dh.Table;

/**
* The name of the table this plugin is associated with.
*/
tableName: string;

/**
* The currently selected ranges in the table.
*/
selectedRanges: readonly GridRange[] | undefined;

/**
* Notify of a state change in the plugin state. Will be saved with the panel data.
* Should be an object that can be serialized to JSON.
Expand Down

0 comments on commit 0b37477

Please sign in to comment.