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

feat: Refactor console objects menu #2013

Merged
merged 6 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 4 additions & 0 deletions packages/components/src/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ class SearchInput extends PureComponent<SearchInputProps> {
this.inputField.current?.focus();
}

select(): void {
this.inputField.current?.select();
}

inputField: React.RefObject<HTMLInputElement>;

searchChangeSelection: React.RefObject<HTMLDivElement>;
Expand Down
22 changes: 17 additions & 5 deletions packages/console/src/Console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
CommandHistoryStorage,
CommandHistoryStorageItem,
} from './command-history';
import ConsoleObjectsMenu from './ConsoleObjectsMenu';

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

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

interface ConsoleProps {
dh: typeof DhType;

/** Additional children to show in the status bar */
statusBarChildren: ReactNode;

/** Show the objects menu in the status bar. Defaults to true. */
showObjectsMenu?: boolean;

settings: Partial<Settings>;
focusCommandHistory: () => void;

Expand Down Expand Up @@ -141,6 +148,7 @@ export class Console extends PureComponent<ConsoleProps, ConsoleState> {
unzip: null,
supportsType: defaultSupportsType,
iconForType: defaultIconForType,
showObjectsMenu: true,
};

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

getObjects = memoize(
(objectMap: Map<string, DhType.ide.VariableDefinition>) => [
...objectMap.values(),
]
(objectMap: Map<string, DhType.ide.VariableDefinition>) =>
Array.from(objectMap.values())
);

getContextActions = memoize(
Expand Down Expand Up @@ -990,6 +997,7 @@ export class Console extends PureComponent<ConsoleProps, ConsoleState> {
unzip,
supportsType,
iconForType,
showObjectsMenu,
} = this.props;
const {
consoleHeight,
Expand All @@ -1016,10 +1024,14 @@ export class Console extends PureComponent<ConsoleProps, ConsoleState> {
dh={dh}
session={session}
overflowActions={this.handleOverflowActions}
openObject={openObject}
objects={consoleMenuObjects}
>
{statusBarChildren}
{showObjectsMenu === true && (
<ConsoleObjectsMenu
openObject={openObject}
objects={consoleMenuObjects}
/>
)}
</ConsoleStatusBar>
<div
className="console-csv-container"
Expand Down
271 changes: 0 additions & 271 deletions packages/console/src/ConsoleMenu.tsx

This file was deleted.

Loading
Loading