setting selected db name in drop down to current connection db name (#11912)

This commit is contained in:
Leila Lali
2020-08-31 14:44:08 -07:00
committed by GitHub
parent 81e81f1c49
commit 22c88cdd2e
8 changed files with 95 additions and 16 deletions

View File

@@ -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 () => {

View File

@@ -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