Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions packages/console/src/Console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,7 @@ export class Console extends PureComponent<ConsoleProps, ConsoleState> {
>
<div className="console-pane" ref={this.consolePane}>
<ConsoleStatusBar
dh={dh}
Comment thread
vbabich marked this conversation as resolved.
session={session}
overflowActions={this.handleOverflowActions}
openObject={openObject}
Expand Down
9 changes: 6 additions & 3 deletions packages/console/src/ConsoleMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ import {
vsTriangleDown,
} from '@deephaven/icons';
import Log from '@deephaven/log';
import type { VariableDefinition } from '@deephaven/jsapi-types';
import type { dh as DhType, VariableDefinition } from '@deephaven/jsapi-types';
import memoize from 'memoize-one';
import './ConsoleMenu.scss';
import ConsoleUtils from './common/ConsoleUtils';

const log = Log.module('ConsoleMenu');

interface ConsoleMenuProps {
dh: DhType;
openObject: (object: VariableDefinition) => void;
objects: VariableDefinition[];
overflowActions: () => DropdownAction[];
Expand Down Expand Up @@ -103,8 +104,9 @@ class ConsoleMenu extends PureComponent<ConsoleMenuProps, ConsoleMenuState> {
filterText: string,
openObject: (object: VariableDefinition) => void
): DropdownAction[] => {
const { dh } = this.props;
const tables = objects.filter(object =>
ConsoleUtils.isTableType(object.type)
ConsoleUtils.isTableType(dh, object.type)
);
return ConsoleMenu.makeItemActions(
tables,
Expand All @@ -124,8 +126,9 @@ class ConsoleMenu extends PureComponent<ConsoleMenuProps, ConsoleMenuState> {
filterText: string,
openObject: (object: VariableDefinition) => void
): DropdownAction[] => {
const { dh } = this.props;
const widgets = objects.filter(object =>
ConsoleUtils.isWidgetType(object.type)
ConsoleUtils.isWidgetType(dh, object.type)
);
return ConsoleMenu.makeItemActions(
widgets,
Expand Down
1 change: 1 addition & 0 deletions packages/console/src/ConsoleStatusBar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function makeConsoleStatusBarWrapper(
const session = new (dh as any).IdeSession('test');
const wrapper = render(
<ConsoleStatusBar
dh={dh}
session={session}
openObject={() => undefined}
objects={[]}
Expand Down
15 changes: 10 additions & 5 deletions packages/console/src/ConsoleStatusBar.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import React, { PureComponent, ReactElement, ReactNode } from 'react';
import classNames from 'classnames';
import dh from '@deephaven/jsapi-shim';
import type { IdeSession, VariableDefinition } from '@deephaven/jsapi-types';
import type {
dh as DhType,
IdeSession,
VariableDefinition,
} from '@deephaven/jsapi-types';
import { DropdownAction, Tooltip } from '@deephaven/components';
import { CanceledPromiseError, Pending } from '@deephaven/utils';
import ConsoleMenu from './ConsoleMenu';
import './ConsoleStatusBar.scss';

interface ConsoleStatusBarProps {
children: ReactNode;
dh: DhType;
session: IdeSession;
openObject: (object: VariableDefinition) => void;
objects: VariableDefinition[];
Expand Down Expand Up @@ -54,15 +58,15 @@ export class ConsoleStatusBar extends PureComponent<
pending: Pending;

startListening(): void {
const { session } = this.props;
const { dh, session } = this.props;
session.addEventListener(
dh.IdeSession.EVENT_COMMANDSTARTED,
this.handleCommandStarted
);
}

stopListening(): void {
const { session } = this.props;
const { dh, session } = this.props;
session.removeEventListener(
dh.IdeSession.EVENT_COMMANDSTARTED,
this.handleCommandStarted
Expand Down Expand Up @@ -96,7 +100,7 @@ export class ConsoleStatusBar extends PureComponent<
}

render(): ReactElement {
const { children, openObject, overflowActions, objects } = this.props;
const { children, dh, openObject, overflowActions, objects } = this.props;
const { isDisconnected, isCommandRunning } = this.state;

let statusIconClass = null;
Expand All @@ -123,6 +127,7 @@ export class ConsoleStatusBar extends PureComponent<
</div>
{children}
<ConsoleMenu
dh={dh}
overflowActions={overflowActions}
openObject={openObject}
objects={objects}
Expand Down
17 changes: 9 additions & 8 deletions packages/console/src/common/ConsoleUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ShellQuote, { ParseEntry, ControlOperator } from 'shell-quote';
import dh from '@deephaven/jsapi-shim';
import type { VariableTypeUnion } from '@deephaven/jsapi-types';
import type { dh as DhType, VariableTypeUnion } from '@deephaven/jsapi-types';

class ConsoleUtils {
static hasComment(arg: ParseEntry): arg is { comment: string } {
Expand Down Expand Up @@ -53,31 +52,33 @@ class ConsoleUtils {
return `${hours}:${minutes}:${seconds}.${milliseconds}`;
}

static isTableType(type: VariableTypeUnion): boolean {
static isTableType(dh: DhType, type: VariableTypeUnion): boolean {
return (
type === dh.VariableType.TABLE ||
type === dh.VariableType.TREETABLE ||
type === dh.VariableType.HIERARCHICALTABLE
);
}

static isWidgetType(type: VariableTypeUnion): boolean {
static isWidgetType(dh: DhType, type: VariableTypeUnion): boolean {
return (
type === dh.VariableType.FIGURE ||
type === dh.VariableType.OTHERWIDGET ||
type === dh.VariableType.PANDAS
);
}

static isOpenableType(type: VariableTypeUnion): boolean {
return ConsoleUtils.isTableType(type) || ConsoleUtils.isWidgetType(type);
static isOpenableType(dh: DhType, type: VariableTypeUnion): boolean {
return (
ConsoleUtils.isTableType(dh, type) || ConsoleUtils.isWidgetType(dh, type)
);
}

static isFigureType(type: VariableTypeUnion): boolean {
static isFigureType(dh: DhType, type: VariableTypeUnion): boolean {
return type === dh.VariableType.FIGURE;
}

static isPandas(type: VariableTypeUnion): boolean {
static isPandas(dh: DhType, type: VariableTypeUnion): boolean {
return type === dh.VariableType.PANDAS;
}
}
Expand Down