Skip to content

Conversation

alenakhineika
Copy link
Contributor

@alenakhineika alenakhineika commented Jul 23, 2020

Description

Use code lenses to connect to the new or saved connection:

  • If a user is not connected show code lenses with a disconnected message. The code lenses' message is a link that opens a command palette with a list of saved connections started with the 'Add new connection' item.
  • Clicking on the 'Add new connection' item opens a quick input to enter a new connection string.
  • Clicking on any other connection item starts the connection process to the selected connection.
  • After connecting the code lenses message shows the current connection host and port.
  • If the user is connected and click on the code lenses again the same connection will be shown to allow the user select another connection or create a new connection.

Checklist

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

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

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)

@alenakhineika alenakhineika requested a review from Anemy July 24, 2020 09:39
Copy link
Member

@Anemy Anemy left a comment

Choose a reason for hiding this comment

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

Nice!!! This will be some nice new functionality for playgrounds. Added comments on adding connections / vs reusing existing connections and a thought on possibly improving some of the messaging.


return this._connectionController.parseNewConnectionAndConnect(
selectedQuickPickItem.data.connectionModel
);
Copy link
Member

@Anemy Anemy Jul 27, 2020

Choose a reason for hiding this comment

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

How do you feel about this code living in the connectionController vs playgroundController?

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 don't have a strong opinion about it, so I don't mind moving it to the connection controller!

const message = `Currently connected to ${name}`;
const message = activeConnection
? `Currently connected to ${this._connectionController.getActiveConnectionName()}. Click here to change connection.`
: 'Disconnected. Click here to add connection.';
Copy link
Member

Choose a reason for hiding this comment

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

Maybe Disconnected. Click here to connect. ? I'm also thinking we could give the user some feedback while they're connecting. Maybe we can add a case for if the connection controller is currently connecting?

let message;
if (this._connectionController.isConnecting()) {
  message = 'Connecting...'
} else if (this._connectionController.getActiveDataService()) {
  message = `Currently connected to ${this._connectionController.getActiveConnectionName()}. Click here to change connection.`;
} else {
  message = 'Disconnected. Click here to connect.';
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current message is from design, but I like your option more! I will change it then and later show Claudia to double-check with her. Also, I like the idea of showing 'Connecting...' message, will add it as well 👍

}

return this._connectionController.parseNewConnectionAndConnect(
selectedQuickPickItem.data.connectionModel
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this creates a new connection with each connection. I think when the user clicks on an existing connection we want to connect to that connection and not recreate a saved connection.

Maybe we can use connectWithConnectionId on the connectionController instead?

return this._connectionController.parseNewConnectionAndConnect(
  selectedQuickPickItem.data.connectionId
);

and above we can change the data property to connectionId instead of connectionModel.

@alenakhineika
Copy link
Contributor Author

@Anemy thanks for such good comments in the review! Pushed updates ✔️

Copy link
Member

@Anemy Anemy left a comment

Choose a reason for hiding this comment

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

Good work - one small thing on the sorting then lgtm!

I think having the code in connectionController might help us if we want to reuse it somewhere (maybe with the new connect screen?) nice move.

};

return codeLens;
return [codeLens];
Copy link
Member

@Anemy Anemy Jul 28, 2020

Choose a reason for hiding this comment

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

cool! I didn't know we could skip the resolve code lens

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Me too! But I wanted to have all data preparation in provideCodeLenses for testing purposes and it worked! :)

return -1;
}
if (collectionA.name > collectionB.name) {
return 1;
Copy link
Member

@Anemy Anemy Jul 28, 2020

Choose a reason for hiding this comment

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

I think this sort might be doing not quite what we expect:
Screen Shot 2020-07-28 at 10 24 31 AM

Looks like we're comparing name when the object builds the name into label, I think if we use label in the comparison it should be good.

  • edit I'm also not sure if this comparison is case insensitive - maybe we want to use localeCompare:
(collectionA.label || '').localeCompare(collectionB.label || '')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting. I wanted it to be sorted the same way as in the sidebar. I assumed that it happens in databaseTreeItem.ts in the getChildren method that sorts by name. Is it some different list? Where we sort sidebar connections in code?

Copy link
Member

Choose a reason for hiding this comment

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

Ah looks like collections aren't case insensitive also:
Screen Shot 2020-07-28 at 11 28 11 AM
I think most of the collections I have are lower case and never noticed it!
If you are up for fixing that as well that would be 🔥 we can also do it another time though.
Nice catch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Np I will fix both places!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed updates, now connection quick pics and collections are case insensitive.

Copy link
Member

@Anemy Anemy left a comment

Choose a reason for hiding this comment

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

🔥 🔥

@alenakhineika alenakhineika merged commit 8a404ed into master Jul 28, 2020
@alenakhineika alenakhineika deleted the VSCODE-97-connect-with-code-lenses branch July 28, 2020 18:29
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.

2 participants