mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
setting selected db name in drop down to current connection db name (#11912)
This commit is contained in:
@@ -170,16 +170,18 @@ export class InstalledPackagesTab {
|
||||
component = view.modelBuilder.text().withProperties({
|
||||
value: locations[0].displayName
|
||||
}).component();
|
||||
} else if (locations) {
|
||||
} else if (locations && locations.length > 1) {
|
||||
let dropdownValues = locations.map(x => {
|
||||
return {
|
||||
name: x.name,
|
||||
displayName: x.displayName
|
||||
};
|
||||
});
|
||||
const currentLocation = await dialog.model.getCurrentLocation();
|
||||
const selectedLocation = dropdownValues.find(x => x.name === currentLocation);
|
||||
let locationDropDown = view.modelBuilder.dropDown().withProperties({
|
||||
values: dropdownValues,
|
||||
value: dropdownValues[0]
|
||||
value: selectedLocation || dropdownValues[0]
|
||||
}).component();
|
||||
|
||||
locationDropDown.onValueChanged(async () => {
|
||||
|
||||
@@ -213,7 +213,9 @@ export class ManagePackagesDialogModel {
|
||||
* Changes the current location
|
||||
*/
|
||||
public changeLocation(location: string): void {
|
||||
this._currentLocation = location;
|
||||
if (location) {
|
||||
this._currentLocation = location;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,6 +242,19 @@ export class ManagePackagesDialogModel {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current location for current provider
|
||||
*/
|
||||
public async getCurrentLocation(): Promise<string | undefined> {
|
||||
if (!this._currentLocation) {
|
||||
let provider = this.currentPackageManageProvider;
|
||||
if (provider) {
|
||||
return await provider.getCurrentLocation();
|
||||
}
|
||||
}
|
||||
return Promise.resolve(this._currentLocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* UnInstalls given packages using current provider
|
||||
* @param packages Packages to install
|
||||
|
||||
Reference in New Issue
Block a user