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

Connection dialog: dropdown for databases #489

Closed
wants to merge 8 commits into from
Closed

Conversation

abist
Copy link
Contributor

@abist abist commented Jan 16, 2018

Fixes #22

Functionality is similar to SSDT's functionality. I've attached some screenshots -

  1. Dropdown when a supported server name is populated

screen shot 2018-01-16 at 6 19 49 pm

  1. UI when a connection is made to a server (Loading in database input)

screen shot 2018-01-16 at 6 20 11 pm

  1. Error thrown when trying to fetch databases from a server that doesn't exist

screen shot 2018-01-16 at 6 20 27 pm

  1. Dropdown populated when a connection is picked from the recent list

screen shot 2018-01-16 at 6 21 09 pm

Copy link
Contributor

@MattIrv MattIrv left a comment

Choose a reason for hiding this comment

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

I left a couple minor code comments, but I have some bigger comments on the overall design that I think need to be figured out before getting this merged:

Thanks for the comments @MattIrv ! These are very helpful! This was an open-ended design, so I went with a few assumptions, definitely wanted a few opinions. I've addressed the points you made in this comment itself so it's easier to read.

  • What's the correct behavior for non-integrated auth? Right now it just seems to always show <Default>, which isn't very helpful. Additionally the first time I opened the connection dialog on Mac, where the default auth type is SQL Login, it showed "undefined" as the database name, though I didn't see an error in the developer console
    I'll look into this

  • Can we do this in a way where users can still type in database names? This could be useful if the connection is slow, for example, and may also help address some of my other concerns here
    I did dig into this, and found that the Dropdown class supported this, however the UI looked way out of place, so I went ahead with SelectBox for now. I can switch to using Dropdown if we all agree to it.

  • The behavior when a user clicks a recent or saved connection is a bit weird right now because the saved database shows up in the drop-down, but can't be changed
    Agreed, this is a flaw which can be rectified by using the Dropdown I mentioned above. But to make the UI consistent, I had to use SelectBox.

  • Is there a better way to show error messages? It might be best to just silently fail, assuming the subsequent connection will also fail and display an error. Right now if the error message pops up it's not entirely clear what user action caused the error message to show up or how the user needs to fix it
    SSDT shows the same error, and I tried to adhere what they were doing. Would just blocking the input boxes until the connection fails suffice, or do you have another idea?

  • Am I correct from looking at the code that this requires users to have access to master to make the initial connection to list databases? It's not necessarily the case that all users will have access is it?
    I'm not sure about this yet.

@@ -51,14 +53,28 @@ export class ConnectionWidget {
[Constants.mssqlProviderName]: [new AuthenticationType(Constants.integrated, false), new AuthenticationType(Constants.sqlLogin, true)]
};
private _saveProfile: boolean;
private _defaultDatabaseName : string = '<Default>';
Copy link
Contributor

Choose a reason for hiding this comment

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

The call to localize should be here, instead of on each use of it

this._updateDatabaseNames();
} else {

this._databaseNameInputBox.setOptions([this.DefaultDatabaseGroup].map(d => d.name), 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

extra blank lines

@anthonydresser
Copy link
Contributor

anthonydresser commented Jan 16, 2018

How does a user activate the connection being made? sssms specifically tells you it will make a connection then opens a new dialog. The problem is we shouldn't be making connections to servers unless it explicit that thats what we are doing. Before @kburtram and I were thinking of a refresh icon next to the database input that would then populate it, perhaps a yes/no/always message that pops up before making the connection.
The refresh button seems like a good idea. I agree that there are unnecessary connection attempts when fetching the list of databases.

@abist abist changed the title Conn dialog/dropdown Connection dialog: dropdown for databases Jan 16, 2018
@kburtram
Copy link
Member

SSMS explicitly prompts, but SSDT will try to connect automatically. I'm fine with either approach, assuming the auto-connect doesn't freeze up the UI or otherwise harm the scenario. We should probably outline the two approaches and get PM and UX to provide guidance.


In reply to: 358081856 [](ancestors = 358081856)

@kburtram
Copy link
Member

Regarding this previous comment...

  • Can we do this in a way where users can still type in database names? This could be useful if the connection is slow, for example, and may also help address some of my other concerns here
    I did dig into this, and found that the Dropdown class supported this, however the UI looked way out of place, so I went ahead with SelectBox for now. I can switch to using Dropdown if we all agree to it.

...we must continue to support allowing the user to type in the database name. Many people will know what they want DB to connect to and requiring a separate connection to populate the dropdown will be a cumbersome experience.

@@ -54,6 +57,29 @@ export class ConnectionController implements IConnectionComponentController {
});
}

private updateDatabaseNames(serverName : string): Promise<string[]> {
let tempProfile = this._model;
tempProfile.authenticationType = Constants.integrated;
Copy link
Member

Choose a reason for hiding this comment

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

tempProfile.authenticationType = Constants.integrated; [](start = 2, length = 54)

why are we doing this? Shouldn't we try to connect with what ever authentication type and credentials the user provided?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SSDT only does it for Integrated Auth, because it does it automatically. If we're going the SSMS way, then it can support both auth types.

if (this.serverName) {
// connect to server and fetch database names
if (this.authenticationType === Constants.integrated) {
this._databaseNameInputBox.setOptions(['Loading...'], 0);
Copy link
Member

Choose a reason for hiding this comment

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

'Loading... [](start = 43, length = 11)

should this be localized?

private _updateDatabaseNames() : void {
if (this.serverName) {
// connect to server and fetch database names
if (this.authenticationType === Constants.integrated) {
Copy link
Member

Choose a reason for hiding this comment

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

this.authenticationType === Constants.integrated [](start = 7, length = 48)

why?

} else {
this._databaseNameInputBox.setOptions([this.DefaultDatabaseGroup, this.LoadingDatabaseGroup].map(d => d.name), 0);
}
this._serverNameInputBox.enable();
Copy link
Member

Choose a reason for hiding this comment

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

this._serverNameInputBox [](start = 5, length = 24)

is there any concern that the dialog may be closed while this async task is running? i.e., have you verified this task is properly canceled in this scenario?

}

public connect(model: IConnectionProfile): boolean {
let validInputs = this.validateInputs();
if (validInputs) {
model.serverName = this.serverName;
model.databaseName = this.databaseName;
model.databaseName = this.databaseName === this._defaultDatabaseName ? 'master' : this.databaseName;
Copy link
Member

Choose a reason for hiding this comment

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

this._defaultDatabaseName ? 'master' [](start = 46, length = 36)

the default DB won't always be master, so I think this is incorrect. Can we go back to the previous behavior where a blank value means default and we let the server fill in what the default DB is once it connects?

Copy link
Member

@kburtram kburtram left a comment

Choose a reason for hiding this comment

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

There are a few minor fixes that should be made and some design decisions that need to be discussed. Could you please aggregate all the design issues and start an email thread to drive to resolution? Thanks!

@abist
Copy link
Contributor Author

abist commented Jan 30, 2018

Closing this PR because a newer one available here - #583

@abist abist closed this Jan 30, 2018
@abist abist deleted the connDialog/dropdown branch February 10, 2018 00:13
anthonydresser pushed a commit to anthonydresser/azuredatastudio that referenced this pull request Mar 15, 2019
aleklj pushed a commit to aleklj/azuredatastudio that referenced this pull request Oct 28, 2019
* Multi-thread server lookup to increase perf for multiple subscriptions

* Use parallel execution for listsubscriptions
- Also refactored parallel execution code to be a bit more generic
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.

4 participants