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(connections-navigation): connect in new window via connect split-button COMPASS-8473 #6577

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

kraenhansen
Copy link
Contributor

@kraenhansen kraenhansen commented Dec 19, 2024

Description

Merging this PR will:

  • Adjust the "connect button" in the sidebar to display a SplitButton with a dropdown menu, containing options to "Connect Here" and "Connect in a New Window".
  • Adding the concept of the ItemActionControls being "hideable" (through the setHideable callback) allowing children (the ConnectButton in particular) to prevent the controls from being hidden once the cursor leaves the connection row. I use this to prevent controls (hence SplitButton and it's Menu) to be removed from the tree as the cursor is moved out of the ConnectButton, across and into the menu: If the menu is opened, the controls stay visible.
  • Propagate events through "connection actions" → "connections Redux store" → "globalAppRegistry" → Main IPC → Window Manager to finally create a new window and ultimately storing a "connection id" in main-process state associated with this window.
  • Auto-connect the newly created window from the associated state.
  • For consistency, I added auto-connect when invoked as a CLI and a connection ID is passed.
connect-in-new-window-1.mov

TODOs

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

  • I did add support for passing a connection id as positional argument when invoked via the CLI, but is this desirable?

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@kraenhansen kraenhansen self-assigned this Dec 19, 2024
@github-actions github-actions bot added the feat label Dec 19, 2024
@@ -63,6 +63,7 @@
"@leafygreen-ui/search-input": "^4.0.0",
"@leafygreen-ui/segmented-control": "^9.0.0",
"@leafygreen-ui/select": "^13.0.0",
"@leafygreen-ui/split-button": "../../../leafygreen-ui/packages/split-button/leafygreen-ui-split-button-v3.0.0.tgz",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a temporary workaround and needs to be updated once my proposed changes merge and release.

@kraenhansen kraenhansen force-pushed the kh/connect-in-new-window branch from 9bbdf1c to 1dcbbfb Compare December 19, 2024 23:04
@@ -39,7 +33,7 @@ export type ItemActionControlsProps<Action extends string> = {
'data-testid'?: string;
};

export function ItemActionControls<Action extends string>({
export function ItemActionControls<Action extends string = string>({
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL that you can have a default

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah – it usually just reduces type safety, though, because then consumers are likely to omit the type (and the default is typically the most generic type available).

This also seems to be one of those cases where type safety goes away – I don't seen an obvious reason for that in the rest of the code, though, so maybe in this particular case we could reconsider?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🙂 TBH, it's likely not strictly needed here, since we'll always be using this in a way that can infer the type of this type parameter from the props.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That being said - those changes are actually a part of #6560 (which needs to be reviewed and merged first).

@kraenhansen kraenhansen force-pushed the kh/connect-in-new-window branch 2 times, most recently from c432c5a to cffbfbb Compare December 20, 2024 14:53
@kraenhansen kraenhansen force-pushed the kh/connect-in-new-window branch from cffbfbb to ddc2f45 Compare December 20, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants