mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 17:23:05 -05:00
Change hardcoded MSSQL provider name to use constant instead (#5953)
This commit is contained in:
@@ -7,6 +7,7 @@ import { IMainContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ExtHostQueryEditorShape, SqlMainContext, MainThreadQueryEditorShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
|
||||
import * as azdata from 'azdata';
|
||||
import { IQueryEvent } from 'sql/platform/query/common/queryModel';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
|
||||
class ExtHostQueryDocument implements azdata.queryeditor.QueryDocument {
|
||||
constructor(
|
||||
@@ -57,13 +58,13 @@ export class ExtHostQueryEditor implements ExtHostQueryEditorShape {
|
||||
let listener: azdata.queryeditor.QueryEventListener = this._queryListeners[handle];
|
||||
if (listener) {
|
||||
let planXml = event.params ? event.params.planXml : undefined;
|
||||
listener.onQueryEvent(event.type, new ExtHostQueryDocument('MSSQL', fileUri, this._proxy), planXml);
|
||||
listener.onQueryEvent(event.type, new ExtHostQueryDocument(mssqlProviderName, fileUri, this._proxy), planXml);
|
||||
}
|
||||
}
|
||||
|
||||
public $getQueryDocument(fileUri: string): Thenable<azdata.queryeditor.QueryDocument> {
|
||||
return new Promise((resolve) => {
|
||||
resolve(new ExtHostQueryDocument('MSSQL', fileUri, this._proxy));
|
||||
resolve(new ExtHostQueryDocument(mssqlProviderName, fileUri, this._proxy));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ import { ExtHostStorage } from 'vs/workbench/api/common/extHostStorage';
|
||||
import * as extHostTypes from 'vs/workbench/api/common/extHostTypes';
|
||||
import { ISchemeTransformer } from 'vs/workbench/api/common/extHostLanguageFeatures';
|
||||
import { AzureResource } from 'sql/platform/accounts/common/interfaces';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
|
||||
export interface ISqlExtensionApiFactory {
|
||||
vsCodeFactory(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
|
||||
@@ -460,7 +461,7 @@ export function createApiFactory(
|
||||
},
|
||||
|
||||
registerQueryEventListener(listener: azdata.queryeditor.QueryEventListener): void {
|
||||
extHostQueryEditor.$registerQueryInfoListener('MSSQL', listener);
|
||||
extHostQueryEditor.$registerQueryInfoListener(mssqlProviderName, listener);
|
||||
},
|
||||
|
||||
getQueryDocument(fileUri: string): Thenable<azdata.queryeditor.QueryDocument> {
|
||||
|
||||
@@ -46,6 +46,7 @@ import { IOEShimService } from 'sql/workbench/parts/objectExplorer/common/object
|
||||
import { equalsIgnoreCase } from 'vs/base/common/strings';
|
||||
import { NodeContextKey } from 'sql/workbench/parts/dataExplorer/common/nodeContext';
|
||||
import { fillInActionBarActions, fillInContextMenuActions, ContextAwareMenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
|
||||
class TitleMenus implements IDisposable {
|
||||
|
||||
@@ -612,7 +613,7 @@ class TreeRenderer implements IRenderer {
|
||||
}
|
||||
|
||||
getTemplateId(tree: ITree, element: ITreeItem): string {
|
||||
return equalsIgnoreCase(element.providerHandle, 'mssql') ? TreeRenderer.MSSQL_TREE_TEMPLATE_ID : TreeRenderer.TREE_TEMPLATE_ID;
|
||||
return element.providerHandle === mssqlProviderName ? TreeRenderer.MSSQL_TREE_TEMPLATE_ID : TreeRenderer.TREE_TEMPLATE_ID;
|
||||
}
|
||||
|
||||
renderTemplate(tree: ITree, templateId: string, container: HTMLElement): ITreeExplorerTemplateData {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
|
||||
export class DashboardInput extends EditorInput {
|
||||
|
||||
@@ -93,7 +94,7 @@ export class DashboardInput extends EditorInput {
|
||||
}
|
||||
|
||||
private isMasterMssql(): boolean {
|
||||
return this.connectionProfile.providerName.toLowerCase() === 'mssql'
|
||||
return this.connectionProfile.providerName === mssqlProviderName
|
||||
&& this.connectionProfile.databaseName.toLowerCase() === 'master';
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
|
||||
export class ServerDashboardPage extends DashboardPage implements OnInit {
|
||||
protected propertiesWidget: WidgetConfig = {
|
||||
@@ -53,7 +54,7 @@ export class ServerDashboardPage extends DashboardPage implements OnInit {
|
||||
|
||||
// special-case handling for MSSQL data provider
|
||||
const connInfo = this.dashboardService.connectionManagementService.connectionInfo;
|
||||
if (connInfo && connInfo.providerId === 'MSSQL') {
|
||||
if (connInfo && connInfo.providerId === mssqlProviderName) {
|
||||
// revert back to default database
|
||||
this._letDashboardPromise = this.dashboardService.connectionManagementService.changeDatabase('master').then();
|
||||
} else {
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
|
||||
import { ProviderProperties } from './propertiesWidget.component';
|
||||
import * as nls from 'vs/nls';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
|
||||
const azureEditionDisplayName = nls.localize('azureEdition', 'Edition');
|
||||
const azureType = nls.localize('azureType', 'Type');
|
||||
|
||||
export const properties: Array<ProviderProperties> = [
|
||||
{
|
||||
provider: 'MSSQL',
|
||||
provider: mssqlProviderName,
|
||||
flavors: [
|
||||
{
|
||||
flavor: 'on_prem',
|
||||
|
||||
@@ -21,6 +21,7 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { localize } from 'vs/nls';
|
||||
import { NotebookModel } from 'sql/workbench/parts/notebook/models/notebookModel';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
|
||||
export interface IClientSessionOptions {
|
||||
notebookUri: URI;
|
||||
@@ -527,7 +528,7 @@ export interface ICellMagicMapper {
|
||||
|
||||
export namespace notebookConstants {
|
||||
export const SQL = 'SQL';
|
||||
export const SQL_CONNECTION_PROVIDER = 'MSSQL';
|
||||
export const SQL_CONNECTION_PROVIDER = mssqlProviderName;
|
||||
export const sqlKernel: string = localize('sqlKernel', 'SQL');
|
||||
export const sqlKernelSpec: nb.IKernelSpec = ({
|
||||
name: sqlKernel,
|
||||
|
||||
@@ -10,13 +10,13 @@ import { IDefaultConnection, notebookConstants } from 'sql/workbench/parts/noteb
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
|
||||
export class NotebookContexts {
|
||||
private static MSSQL_PROVIDER = 'MSSQL';
|
||||
|
||||
private static get DefaultContext(): IDefaultConnection {
|
||||
let defaultConnection: ConnectionProfile = <any>{
|
||||
providerName: NotebookContexts.MSSQL_PROVIDER,
|
||||
providerName: mssqlProviderName,
|
||||
id: '-1',
|
||||
serverName: localize('selectConnection', 'Select Connection')
|
||||
};
|
||||
@@ -30,7 +30,7 @@ export class NotebookContexts {
|
||||
|
||||
private static get LocalContext(): IDefaultConnection {
|
||||
let localConnection: ConnectionProfile = <any>{
|
||||
providerName: NotebookContexts.MSSQL_PROVIDER,
|
||||
providerName: mssqlProviderName,
|
||||
id: '-1',
|
||||
serverName: localize('localhost', 'localhost')
|
||||
};
|
||||
|
||||
@@ -23,6 +23,7 @@ import Severity from 'vs/base/common/severity';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
|
||||
export interface ISqlProviderEntry extends IQuickPickItem {
|
||||
providerId: string;
|
||||
@@ -45,7 +46,7 @@ class SqlProviderEntry implements ISqlProviderEntry {
|
||||
// Note: consider adding API to connection management service to
|
||||
// support getting display name for provider so this is consistent
|
||||
switch (this.providerId) {
|
||||
case 'MSSQL':
|
||||
case mssqlProviderName:
|
||||
return 'MSSQL';
|
||||
default:
|
||||
return this.providerId;
|
||||
@@ -192,7 +193,7 @@ export class ChangeFlavorAction extends Action {
|
||||
// TODO #1334 use connectionManagementService.GetProviderNames here. The challenge is that the credentials provider is returned
|
||||
// so we need a way to filter this using a capabilities check, with isn't yet implemented
|
||||
const ProviderOptions: ISqlProviderEntry[] = [
|
||||
new SqlProviderEntry('MSSQL')
|
||||
new SqlProviderEntry(mssqlProviderName)
|
||||
];
|
||||
|
||||
// TODO: select the current language flavor
|
||||
|
||||
@@ -21,6 +21,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { Memento } from 'vs/workbench/common/memento';
|
||||
import { ProfilerFilterDialog } from 'sql/workbench/parts/profiler/browser/profilerFilterDialog';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
|
||||
class TwoWayMap<T, K> {
|
||||
private forwardMap: Map<T, K>;
|
||||
@@ -157,13 +158,7 @@ export class ProfilerService implements IProfilerService {
|
||||
}
|
||||
|
||||
private _runAction<T>(id: ProfilerSessionID, action: (handler: azdata.ProfilerProvider) => Thenable<T>): Thenable<T> {
|
||||
// let providerId = this._connectionService.getProviderIdFromUri(this._idMap.get(id));
|
||||
let providerId = 'MSSQL';
|
||||
|
||||
if (!providerId) {
|
||||
return Promise.reject(new Error('Connection is required in order to interact with queries'));
|
||||
}
|
||||
let handler = this._providers.get(providerId);
|
||||
let handler = this._providers.get(mssqlProviderName);
|
||||
if (handler) {
|
||||
return action(handler);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user