mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fix several regressions in master (#613)
* Fix service option type enum * Fix broken Explain button and Actual plan command
This commit is contained in:
@@ -4,7 +4,7 @@ import * as types from './types';
|
||||
|
||||
export interface Ic2p {
|
||||
asConnectionParams(connectionUri: string, connectionInfo: data.ConnectionInfo): proto.ConnectParams;
|
||||
asExecutionPlanOptions(planOptions: data.ExecutionPlanOptions): data.ExecutionPlanOptions;
|
||||
asExecutionPlanOptions(planOptions: data.ExecutionPlanOptions): types.ExecutionPlanOptions;
|
||||
asScriptingParams(connectionUri: string, operation: data.ScriptOperation, metadata: data.ObjectMetadata, paramDetails: data.ScriptingParamDetails): types.ScriptingParams;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ function asConnectionParams(ownerUri: string, connInfo: data.ConnectionInfo): pr
|
||||
};
|
||||
}
|
||||
|
||||
function asExecutionPlanOptions(planOptions: data.ExecutionPlanOptions): data.ExecutionPlanOptions {
|
||||
function asExecutionPlanOptions(planOptions: data.ExecutionPlanOptions): types.ExecutionPlanOptions {
|
||||
return {
|
||||
displayEstimatedQueryPlan: planOptions ? planOptions.displayEstimatedQueryPlan : undefined,
|
||||
displayActualQueryPlan: planOptions ? planOptions.displayActualQueryPlan : undefined
|
||||
includeEstimatedExecutionPlanXml: planOptions ? planOptions.displayEstimatedQueryPlan : undefined,
|
||||
includeActualExecutionPlanXml: planOptions ? planOptions.displayActualQueryPlan : undefined
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ class CapabilitiesFeature extends SqlOpsFeature<undefined> {
|
||||
|
||||
let getServerCapabilities = (cap: data.DataProtocolClientCapabilities): Thenable<data.DataProtocolServerCapabilities> => {
|
||||
return client.sendRequest(protocol.CapabiltiesDiscoveryRequest.type, cap).then(
|
||||
r => r.capabilities,
|
||||
client.sqlp2c.asServerCapabilities,
|
||||
e => {
|
||||
client.logFailedRequest(protocol.CapabiltiesDiscoveryRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
@@ -310,7 +310,7 @@ class QueryFeature extends SqlOpsFeature<undefined> {
|
||||
protected registerProvider(options: undefined): Disposable {
|
||||
const client = this._client;
|
||||
let runQuery = (ownerUri: string, querySelection: data.ISelectionData, executionPlanOptions?: data.ExecutionPlanOptions): Thenable<void> => {
|
||||
let params: data.QueryExecuteParams = {
|
||||
let params: types.QueryExecuteParams = {
|
||||
ownerUri,
|
||||
querySelection,
|
||||
executionPlanOptions: client.sqlc2p.asExecutionPlanOptions(executionPlanOptions)
|
||||
|
||||
@@ -335,7 +335,7 @@ export namespace QueryExecuteMessageNotification {
|
||||
|
||||
// ------------------------------- < Query Execution Request > ------------------------------------
|
||||
export namespace QueryExecuteRequest {
|
||||
export const type = new RequestType<data.QueryExecuteParams, QueryExecuteResult, void, void>('query/executeDocumentSelection');
|
||||
export const type = new RequestType<types.QueryExecuteParams, QueryExecuteResult, void, void>('query/executeDocumentSelection');
|
||||
}
|
||||
|
||||
export interface QueryExecuteResult { }
|
||||
|
||||
@@ -3,6 +3,8 @@ import * as types from './types';
|
||||
|
||||
export interface Ip2c {
|
||||
asProviderMetadata(params: types.MetadataQueryResult): data.ProviderMetadata;
|
||||
|
||||
asServerCapabilities(result: types.CapabiltiesDiscoveryResult): data.DataProtocolServerCapabilities;
|
||||
}
|
||||
|
||||
function asProviderMetadata(params: types.MetadataQueryResult): data.ProviderMetadata {
|
||||
@@ -45,6 +47,152 @@ function asProviderMetadata(params: types.MetadataQueryResult): data.ProviderMet
|
||||
};
|
||||
}
|
||||
|
||||
function asServiceOptionType(val: string): data.ServiceOptionType {
|
||||
if (val === 'string') {
|
||||
return data.ServiceOptionType.string;
|
||||
} else if (val === 'multistring') {
|
||||
return data.ServiceOptionType.multistring;
|
||||
} else if (val === 'password') {
|
||||
return data.ServiceOptionType.password;
|
||||
} else if (val === 'number') {
|
||||
return data.ServiceOptionType.number;
|
||||
} else if (val === 'boolean') {
|
||||
return data.ServiceOptionType.boolean;
|
||||
} else if (val === 'category') {
|
||||
return data.ServiceOptionType.category;
|
||||
} else if (val === 'object') {
|
||||
return data.ServiceOptionType.object;
|
||||
}
|
||||
|
||||
// assume string for unknown value types
|
||||
return data.ServiceOptionType.string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function buildServiceOption(srcOption: types.ServiceOption): data.ServiceOption {
|
||||
return {
|
||||
name: srcOption.name,
|
||||
displayName: srcOption.displayName ? srcOption.displayName : srcOption.name,
|
||||
description: srcOption.description,
|
||||
groupName: srcOption.groupName,
|
||||
defaultValue: srcOption.defaultValue,
|
||||
categoryValues: srcOption.categoryValues,
|
||||
isRequired: srcOption.isRequired,
|
||||
isArray: srcOption.isArray,
|
||||
objectType: srcOption.objectType,
|
||||
valueType: asServiceOptionType(srcOption.valueType),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function asServerCapabilities(result: types.CapabiltiesDiscoveryResult): data.DataProtocolServerCapabilities {
|
||||
let capabilities: data.DataProtocolServerCapabilities = {
|
||||
protocolVersion: result.capabilities.protocolVersion,
|
||||
providerName: result.capabilities.providerName,
|
||||
providerDisplayName: result.capabilities.providerDisplayName,
|
||||
connectionProvider: undefined,
|
||||
adminServicesProvider: undefined,
|
||||
features: []
|
||||
};
|
||||
|
||||
if (result.capabilities.adminServicesProvider) {
|
||||
capabilities.adminServicesProvider = <data.AdminServicesOptions>{
|
||||
databaseInfoOptions: new Array<data.ServiceOption>(),
|
||||
databaseFileInfoOptions: new Array<data.ServiceOption>(),
|
||||
fileGroupInfoOptions: new Array<data.ServiceOption>()
|
||||
};
|
||||
|
||||
if (result.capabilities.adminServicesProvider.databaseInfoOptions
|
||||
&& result.capabilities.adminServicesProvider.databaseInfoOptions.length > 0) {
|
||||
for (let i = 0; i < result.capabilities.adminServicesProvider.databaseInfoOptions.length; ++i) {
|
||||
let srcOption: any = result.capabilities.adminServicesProvider.databaseInfoOptions[i];
|
||||
let descOption: data.ServiceOption = buildServiceOption(srcOption);
|
||||
capabilities.adminServicesProvider.databaseInfoOptions.push(descOption);
|
||||
}
|
||||
}
|
||||
|
||||
if (result.capabilities.adminServicesProvider.databaseFileInfoOptions
|
||||
&& result.capabilities.adminServicesProvider.databaseFileInfoOptions.length > 0) {
|
||||
for (let i = 0; i < result.capabilities.adminServicesProvider.databaseFileInfoOptions.length; ++i) {
|
||||
//let srcOption: types.ServiceOption = result.capabilities.adminServicesProvider.databaseFileInfoOptions[i];
|
||||
let srcOption: any = result.capabilities.adminServicesProvider.databaseFileInfoOptions[i];
|
||||
let descOption: data.ServiceOption = buildServiceOption(srcOption);
|
||||
capabilities.adminServicesProvider.databaseFileInfoOptions.push(descOption);
|
||||
}
|
||||
}
|
||||
|
||||
if (result.capabilities.adminServicesProvider.fileGroupInfoOptions
|
||||
&& result.capabilities.adminServicesProvider.fileGroupInfoOptions.length > 0) {
|
||||
for (let i = 0; i < result.capabilities.adminServicesProvider.fileGroupInfoOptions.length; ++i) {
|
||||
//let srcOption: types.ServiceOption = result.capabilities.adminServicesProvider.fileGroupInfoOptions[i];
|
||||
let srcOption: any = result.capabilities.adminServicesProvider.fileGroupInfoOptions[i];
|
||||
let descOption: data.ServiceOption = buildServiceOption(srcOption);
|
||||
capabilities.adminServicesProvider.fileGroupInfoOptions.push(descOption);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result.capabilities.connectionProvider
|
||||
&& result.capabilities.connectionProvider.options
|
||||
&& result.capabilities.connectionProvider.options.length > 0) {
|
||||
capabilities.connectionProvider = <data.ConnectionProviderOptions>{
|
||||
options: new Array<data.ConnectionOption>()
|
||||
};
|
||||
for (let i = 0; i < result.capabilities.connectionProvider.options.length; ++i) {
|
||||
let srcOption: any = result.capabilities.connectionProvider.options[i];
|
||||
let descOption: data.ConnectionOption = {
|
||||
name: srcOption.name,
|
||||
displayName: srcOption.displayName ? srcOption.displayName : srcOption.name,
|
||||
description: srcOption.description,
|
||||
groupName: srcOption.groupName,
|
||||
defaultValue: srcOption.defaultValue,
|
||||
categoryValues: srcOption.categoryValues,
|
||||
isIdentity: srcOption.isIdentity,
|
||||
isRequired: srcOption.isRequired,
|
||||
valueType: asServiceOptionType(srcOption.valueType),
|
||||
specialValueType: undefined
|
||||
};
|
||||
|
||||
if (srcOption.specialValueType === 'serverName') {
|
||||
descOption.specialValueType = data.ConnectionOptionSpecialType.serverName;
|
||||
} else if (srcOption.specialValueType === 'databaseName') {
|
||||
descOption.specialValueType = data.ConnectionOptionSpecialType.databaseName;
|
||||
} else if (srcOption.specialValueType === 'authType') {
|
||||
descOption.specialValueType = data.ConnectionOptionSpecialType.authType;
|
||||
} else if (srcOption.specialValueType === 'userName') {
|
||||
descOption.specialValueType = data.ConnectionOptionSpecialType.userName;
|
||||
} else if (srcOption.specialValueType === 'password') {
|
||||
descOption.specialValueType = data.ConnectionOptionSpecialType.password;
|
||||
} else if (srcOption.specialValueType === 'appName') {
|
||||
descOption.specialValueType = data.ConnectionOptionSpecialType.appName;
|
||||
}
|
||||
|
||||
capabilities.connectionProvider.options.push(descOption);
|
||||
}
|
||||
}
|
||||
|
||||
if (result.capabilities.features
|
||||
&& result.capabilities.features.length > 0) {
|
||||
result.capabilities.features.forEach(feature => {
|
||||
let descFeature: data.FeatureMetadataProvider = {
|
||||
enabled: feature.enabled,
|
||||
featureName: feature.featureName,
|
||||
optionsMetadata: []
|
||||
};
|
||||
capabilities.features.push(descFeature);
|
||||
if (feature.optionsMetadata) {
|
||||
feature.optionsMetadata.forEach(srcOption => {
|
||||
descFeature.optionsMetadata.push(buildServiceOption(<any>srcOption));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
export const p2c: Ip2c = {
|
||||
asProviderMetadata
|
||||
asProviderMetadata,
|
||||
asServerCapabilities
|
||||
};
|
||||
|
||||
@@ -509,6 +509,17 @@ export interface IResultMessage {
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface ExecutionPlanOptions {
|
||||
includeEstimatedExecutionPlanXml?: boolean;
|
||||
includeActualExecutionPlanXml?: boolean;
|
||||
}
|
||||
|
||||
export interface QueryExecuteParams {
|
||||
ownerUri: string;
|
||||
querySelection: data.ISelectionData;
|
||||
executionPlanOptions?: ExecutionPlanOptions;
|
||||
}
|
||||
|
||||
export enum EditRowState {
|
||||
clean = 0,
|
||||
dirtyInsert = 1,
|
||||
|
||||
Reference in New Issue
Block a user