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

fix: Widget panel fixes #2227

Merged
merged 6 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type ResolvableContextAction =
export type MenuItem = ContextAction | Promise<ContextAction[]>;

export interface ContextAction {
title?: string;
title?: string | JSX.Element;
description?: string;
action?: (event: Event) => void;
actions?: ResolvableContextAction[];
Expand Down
5 changes: 3 additions & 2 deletions packages/dashboard-core-plugins/src/panels/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ContextActions,
createXComponent,
LoadingOverlay,
ResolvableContextAction,
Tooltip,
} from '@deephaven/components';
import { LayoutUtils, PanelComponent, PanelEvent } from '@deephaven/dashboard';
Expand Down Expand Up @@ -60,7 +61,7 @@ export type CorePanelProps = {
onTabBlur?: (...args: unknown[]) => void;
onTabFocus?: (...args: unknown[]) => void;
renderTabTooltip?: () => ReactNode;
additionalActions?: ContextAction[];
additionalActions?: ResolvableContextAction[];
errorMessage?: string;
isLoading?: boolean;
isLoaded?: boolean;
Expand Down Expand Up @@ -293,7 +294,7 @@ class Panel extends PureComponent<CorePanelProps, PanelState> {

getAdditionalActions = memoize(
(
actions: readonly ContextAction[],
actions: readonly ResolvableContextAction[],
isClonable: boolean,
isRenamable: boolean
) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { PureComponent, ReactElement } from 'react';
import { ContextAction, ContextActions } from '@deephaven/components';
import { ContextActions, ResolvableContextAction } from '@deephaven/components';
import type { Container, EventEmitter, Tab } from '@deephaven/golden-layout';
import {
CustomizableWorkspace,
Expand All @@ -11,7 +11,7 @@ import { connect } from 'react-redux';
import { ClosedPanel, LayoutUtils, PanelEvent } from '@deephaven/dashboard';

interface PanelContextMenuProps {
additionalActions: ContextAction[];
additionalActions: ResolvableContextAction[];
glContainer: Container;
glEventHub: EventEmitter;
workspace: CustomizableWorkspace;
Expand Down Expand Up @@ -132,9 +132,7 @@ class PanelContextMenu extends PureComponent<
render(): ReactElement {
const { additionalActions, glContainer } = this.props;

const contextActions: (ContextAction | (() => ContextAction))[] = [
...additionalActions,
];
const contextActions = [...additionalActions];

contextActions.push(() => ({
title: 'Re-open closed panel',
Expand Down
4 changes: 2 additions & 2 deletions packages/dashboard-core-plugins/src/panels/WidgetPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React, { PureComponent, ReactElement } from 'react';
import classNames from 'classnames';
import memoize from 'memoize-one';
import {
ContextAction,
ContextActions,
createXComponent,
ResolvableContextAction,
} from '@deephaven/components';
import type { dh } from '@deephaven/jsapi-types';
import { copyToClipboard, EMPTY_ARRAY } from '@deephaven/utils';
Expand Down Expand Up @@ -97,7 +97,7 @@ class WidgetPanel extends PureComponent<WidgetPanelProps, WidgetPanelState> {
getCachedActions = memoize(
(
descriptor: WidgetPanelDescriptor,
propsAdditionalActions: readonly ContextAction[] = EMPTY_ARRAY
propsAdditionalActions: readonly ResolvableContextAction[] = EMPTY_ARRAY
) => [
...propsAdditionalActions,
{
Expand Down
Loading