-
Notifications
You must be signed in to change notification settings - Fork 907
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
Conversation
There was a problem hiding this 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>'; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra blank lines
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. |
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) |
Regarding this previous comment...
...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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this 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!
Closing this PR because a newer one available here - #583 |
* 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
Fixes #22
Functionality is similar to SSDT's functionality. I've attached some screenshots -