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

Move connections pane into core positron #4967

Merged
merged 51 commits into from
Oct 16, 2024
Merged

Conversation

dfalbel
Copy link
Contributor

@dfalbel dfalbel commented Oct 9, 2024

Addresses #4874

Needs codicons from: https://github.com/posit-dev/positron-codicons/pull/6
Needs ark side: posit-dev/ark#589

This PR is an initial implementation of the connections pane into Positron core. It's still missing a lot of functionality, but will eventually be equivalent to the current positron-connections extension.

TODO:

  • Workspace storage of previous connections
  • Setting to opt-in for the new implementation
  • Button to open data explorer for a Table or View
  • Codicons for most common DB data types (schema, collections, etc) and for creating a new connection
  • Review event listeners disposing
  • Implement Python side of new GetMetadata RPC
  • Implement refresh connections
  • Display the field type
  • Display the language for each connection
  • Review error handling
  • Fix smoke tests (smoke tests are passing locally)
  • Fix integration tests
  • Rename 'Connections Core' to just 'Connections'
  • Support for the focus event

Demo:

Screen.Recording.2024-10-15.at.14.30.50.mov

Must be enabled with:

image

softwarenerd
softwarenerd previously approved these changes Oct 15, 2024
Copy link
Contributor

@softwarenerd softwarenerd left a comment

Choose a reason for hiding this comment

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

Some nits. A couple of thoughts and a few questions.

setItems(entries);
}));
// First entries refresh - on component mount.
props.connectionsService.refreshConnectionEntries();
Copy link
Contributor

Choose a reason for hiding this comment

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

refreshConnectionEntries is not awaited? Makes me wonder if that's actually OK.

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 starts an event that will eventually execute setItems because of the observer:

disposableStore.add(props.connectionsService.onDidChangeEntries((entries) => {
setItems(entries);
}));

It seems fine to not wait for it here in the useEffect() call. But maybe there's a better pattern for this, like useCallback()?

In 3c29b1b I added some error handling to make sure that the user is notified if something goes wrong before this event is called. Although there's already error handling at the RPC boundaries so we shoould display the entries marked with a special error icons if something goes wrong.

const itemProps = items[props.index];

return (
<PositronConnectionsItem
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps:

		return (
			<PositronConnectionsItem
				{...itemProps}
				selected={itemProps.id === selectedId}
				onSelectedHandler={() => setSelectedId(itemProps.id)}
				style={props.style}>
			</PositronConnectionsItem>
		);

Just a thought.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried this and it doesn't work. I have no idea why :S
I just changed to c34d6c7 which looks slightly better, I think!

@dfalbel dfalbel merged commit 67cf79b into main Oct 16, 2024
23 checks passed
@dfalbel dfalbel deleted the feature/connections-core branch October 16, 2024 18:39
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants