Skip to content

Commit 8251180

Browse files
mofojedmattrunyon
andauthored
feat: Refactor console objects menu (#2013)
- Split ConsoleMenu up so objects is it's own component ConsoleObjectsMenu - Convert to functional component - Display all widgets in the menu - Add a flag to hide the menu, which we set for DHC, but will not be set in DHE so current behaviour is not broken there - Fixes #1884 --------- Co-authored-by: Matthew Runyon <matthewrunyon@deephaven.io>
1 parent 5f9cf7f commit 8251180

8 files changed

Lines changed: 234 additions & 410 deletions

File tree

packages/components/src/SearchInput.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ class SearchInput extends PureComponent<SearchInputProps> {
5555
this.inputField.current?.focus();
5656
}
5757

58+
select(): void {
59+
this.inputField.current?.select();
60+
}
61+
5862
inputField: React.RefObject<HTMLInputElement>;
5963

6064
searchChangeSelection: React.RefObject<HTMLDivElement>;

packages/console/src/Console.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
CommandHistoryStorage,
3535
CommandHistoryStorageItem,
3636
} from './command-history';
37+
import ConsoleObjectsMenu from './ConsoleObjectsMenu';
3738

3839
const log = Log.module('Console');
3940

@@ -51,7 +52,13 @@ const DEFAULT_SETTINGS: Settings = {
5152

5253
interface ConsoleProps {
5354
dh: typeof DhType;
55+
56+
/** Additional children to show in the status bar */
5457
statusBarChildren: ReactNode;
58+
59+
/** Show the objects menu in the status bar. Defaults to true. */
60+
showObjectsMenu?: boolean;
61+
5562
settings: Partial<Settings>;
5663
focusCommandHistory: () => void;
5764

@@ -141,6 +148,7 @@ export class Console extends PureComponent<ConsoleProps, ConsoleState> {
141148
unzip: null,
142149
supportsType: defaultSupportsType,
143150
iconForType: defaultIconForType,
151+
showObjectsMenu: true,
144152
};
145153

146154
static LOG_THROTTLE = 500;
@@ -905,9 +913,8 @@ export class Console extends PureComponent<ConsoleProps, ConsoleState> {
905913
}
906914

907915
getObjects = memoize(
908-
(objectMap: Map<string, DhType.ide.VariableDefinition>) => [
909-
...objectMap.values(),
910-
]
916+
(objectMap: Map<string, DhType.ide.VariableDefinition>) =>
917+
Array.from(objectMap.values())
911918
);
912919

913920
getContextActions = memoize(
@@ -990,6 +997,7 @@ export class Console extends PureComponent<ConsoleProps, ConsoleState> {
990997
unzip,
991998
supportsType,
992999
iconForType,
1000+
showObjectsMenu,
9931001
} = this.props;
9941002
const {
9951003
consoleHeight,
@@ -1016,10 +1024,14 @@ export class Console extends PureComponent<ConsoleProps, ConsoleState> {
10161024
dh={dh}
10171025
session={session}
10181026
overflowActions={this.handleOverflowActions}
1019-
openObject={openObject}
1020-
objects={consoleMenuObjects}
10211027
>
10221028
{statusBarChildren}
1029+
{showObjectsMenu === true && (
1030+
<ConsoleObjectsMenu
1031+
openObject={openObject}
1032+
objects={consoleMenuObjects}
1033+
/>
1034+
)}
10231035
</ConsoleStatusBar>
10241036
<div
10251037
className="console-csv-container"

packages/console/src/ConsoleMenu.tsx

Lines changed: 0 additions & 271 deletions
This file was deleted.

0 commit comments

Comments
 (0)