mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 01:25:38 -05:00
Add changes for flavor selection (#8419)
* Add changes for flavor selection * Use getDefaultProviderId method * Update default engine user setting description * Add back check for codeEditor * Add test for multiple providers * Removing extra merge line * Add an attribute to ConnectionProviderProperties for language flavor Adding a boolean property to ConnectionProviderProperties for providers that are language flavors. When it is set to true, the provider will be part of drop down for changing SQL language flavor. * Update variable name * Put logic for removing CMS at one place and remove flag for flavor provider * Using keys instead of entries Using Object.keys instead of entries as doing [0] can be error prone if no provider matches. * Adding logic to check from params * Updating variable names * Rename dedup map * Fix action
This commit is contained in:
@@ -37,6 +37,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { entries } from 'sql/base/common/collections';
|
||||
|
||||
export interface OnShowUIResponse {
|
||||
selectedProviderDisplayName: string;
|
||||
@@ -116,21 +117,21 @@ export class ConnectionDialogWidget extends Modal {
|
||||
}
|
||||
|
||||
public refresh(): void {
|
||||
let filteredProviderDisplayNames = this.providerDisplayNameOptions;
|
||||
|
||||
let filteredProviderMap = this.providerNameToDisplayNameMap;
|
||||
if (this._newConnectionParams && this._newConnectionParams.providers) {
|
||||
const validProviderNames = Object.keys(this.providerNameToDisplayNameMap).filter(x => this.includeProvider(x, this._newConnectionParams));
|
||||
if (validProviderNames && validProviderNames.length > 0) {
|
||||
filteredProviderDisplayNames = filteredProviderDisplayNames.filter(x => validProviderNames.some(
|
||||
v => this.providerNameToDisplayNameMap[v] === x) !== undefined
|
||||
);
|
||||
const validProviderMap = entries(this.providerNameToDisplayNameMap).filter(x => this.includeProvider(x[0], this._newConnectionParams));
|
||||
if (validProviderMap && validProviderMap.length > 0) {
|
||||
let map: { [providerDisplayName: string]: string } = {};
|
||||
validProviderMap.forEach(v => {
|
||||
map[v[0]] = v[1];
|
||||
});
|
||||
filteredProviderMap = map;
|
||||
}
|
||||
}
|
||||
|
||||
this._providerTypeSelectBox.setOptions(filteredProviderDisplayNames.filter((providerDisplayName, index) =>
|
||||
// Remove duplicate listings (CMS uses the same display name)
|
||||
filteredProviderDisplayNames.indexOf(providerDisplayName) === index)
|
||||
);
|
||||
// Remove duplicate listings (CMS uses the same display name)
|
||||
let uniqueProvidersMap = this._connectionManagementService.getUniqueConnectionProvidersByNameMap(filteredProviderMap);
|
||||
this._providerTypeSelectBox.setOptions(Object.keys(uniqueProvidersMap).map(k => uniqueProvidersMap[k]));
|
||||
}
|
||||
|
||||
private includeProvider(providerName: string, params?: INewConnectionParams): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user