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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mofojed
Copy link
Member

@mofojed mofojed commented May 14, 2024

  • 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 deephaven.ui widgets do not appear in Console dropdowns #1884

- 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
@mofojed mofojed requested a review from mattrunyon May 14, 2024 17:57
@mofojed mofojed self-assigned this May 14, 2024
Comment on lines +59 to +60
/** Hide the objects menu in the status bar. Defaults to false. */
hideObjectsMenu?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer showObjectsMenu defaulting to true to avoid the double negative. Also I think this should this have a defaultProps value?

Comment on lines +63 to +65
onClick={() => {
// no-op: click is handled in `DropdownMenu`
}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use EMPTY_FUNCTION

};
const filteredObjects = filterText
? objects.filter(
({ title }: { title?: string }) =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think you need to specify the type here. The JSAPI types say it's always defined and the source looks to confirm that

packages/console/src/ConsoleObjectsMenu.tsx Outdated Show resolved Hide resolved
<DropdownMenu
actions={actions}
onMenuOpened={() => searchRef.current?.focus()}
onMenuClosed={() => setFilterText('')}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should leave the filter and just have the search select the search text when it's reopened. I guess if this is the behavior it has always been and nobody has complained then it's inconsequential. I was just thinking if I'm searching maybe I wanted to open several matching the same search or something

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, could have it on a timer to reset it to blank after a few seconds. I could have sworn we had that logic on the query widget list on Enterprise, but I can't find it.

I'll just have it select text on open, that's how the QueryWidgetList behaves on Enterprise now.

Comment on lines +43 to +44
} catch (error) {
// No-op, fall through
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change to the logic here? Previously looks like we did something w/ the error

Comment on lines +69 to +77
if (isCommandRunning) {
// Connected, Pending
statusIconClass = 'console-status-icon-pending';
tooltipText = 'Worker is busy';
} else {
// Connected, Idle
statusIconClass = 'console-status-icon-idle';
tooltipText = 'Worker is idle';
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No disconnected state after the refactor? This component is consumed by DHE, but I'm not sure how to test/get the disconnected state there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah crap that's right. That's part of the reason I did the whole XComponent thing in the first place... I considered also porting over ConsoleContainer and all the disconnect/reconnect logic, then just having DHE replace the ConsoleCreator with it's own component... I think I might just do that, seems like it'd be more robust.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually nevermind, isDisconnected isn't used at all in this component. It's always false, and it never gets set anywhere. That's why I removed it, it was never used.

Comment on lines +96 to +98
onClick={() => {
// no-op: click is handled in `DropdownMenu`
}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EMPTY_FUNCTION

Co-authored-by: Matthew Runyon <mattrunyonstuff@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deephaven.ui widgets do not appear in Console dropdowns
2 participants