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 all 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
7 changes: 6 additions & 1 deletion packages/dashboard-core-plugins/src/panels/ChartPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,12 @@ export class ChartPanel extends Component<ChartPanelProps, ChartPanelState> {
pending: Pending;

initModel(): void {
this.setState({ isLoading: true, isLoaded: false, error: undefined });
this.setState({
isLoading: true,
isLoaded: false,
error: undefined,
isDisconnected: false,
});

const { makeModel } = this.props;

Expand Down
7 changes: 6 additions & 1 deletion packages/dashboard-core-plugins/src/panels/IrisGridPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,12 @@ export class IrisGridPanel extends PureComponent<
);

initModel(): void {
this.setState({ isModelReady: false, isLoading: true, error: null });
this.setState({
isModelReady: false,
isLoading: true,
error: null,
isDisconnected: false,
});
const { makeModel } = this.props;
if (this.modelPromise != null) {
this.modelPromise.cancel();
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,
type ResolvableContextAction,
Tooltip,
} from '@deephaven/components';
import {
Expand Down Expand Up @@ -64,7 +65,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 @@ -297,7 +298,7 @@ class Panel extends PureComponent<CorePanelProps, PanelState> {

getAdditionalActions = memoize(
(
actions: readonly ContextAction[],
actions: readonly ResolvableContextAction[],
isClonable: boolean,
isRenamable: boolean
) => {
Expand Down
11 changes: 6 additions & 5 deletions packages/dashboard-core-plugins/src/panels/PanelContextMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React, { PureComponent, type ReactElement } from 'react';
import { type ContextAction, ContextActions } from '@deephaven/components';
import {
ContextActions,
type ResolvableContextAction,
} from '@deephaven/components';
import type { Container, EventEmitter, Tab } from '@deephaven/golden-layout';
import {
type CustomizableWorkspace,
Expand All @@ -15,7 +18,7 @@ import {
} from '@deephaven/dashboard';

interface PanelContextMenuProps {
additionalActions: ContextAction[];
additionalActions: ResolvableContextAction[];
glContainer: Container;
glEventHub: EventEmitter;
workspace: CustomizableWorkspace;
Expand Down Expand Up @@ -136,9 +139,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, type ReactElement } from 'react';
import classNames from 'classnames';
import memoize from 'memoize-one';
import {
type ContextAction,
ContextActions,
createXComponent,
type 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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $tooltip-container-width: 300px;
.tab-tooltip-name-wrapper {
display: flex;
flex-wrap: nowrap;
align-items: first baseline;
align-items: center;
gap: $spacer-1;
}

Expand Down
Loading