mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-08 01:28:26 -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,
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
"reflect-metadata": "^0.1.8",
|
||||
"rxjs": "5.4.0",
|
||||
"semver": "4.3.6",
|
||||
"slickgrid": "github:anthonydresser/SlickGrid#2.3.12",
|
||||
"slickgrid": "github:anthonydresser/SlickGrid#2.3.7",
|
||||
"spdlog": "0.3.7",
|
||||
"svg.js": "^2.2.5",
|
||||
"systemjs": "0.19.40",
|
||||
|
||||
@@ -14,7 +14,7 @@ import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import data = require('data');
|
||||
import { localize } from 'vs/nls';
|
||||
import { ServiceOptionType, ServiceOptionTypeNames } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
|
||||
export interface IOptionElement {
|
||||
optionWidget: any;
|
||||
@@ -31,8 +31,7 @@ export function createOptionElement(option: data.ServiceOption, rowContainer: Bu
|
||||
let missingErrorMessage = localize('missingRequireField', ' is required.');
|
||||
let invalidInputMessage = localize('invalidInput', 'Invalid input. Numeric value expected.');
|
||||
|
||||
let typeName: string = option.valueType.toString();
|
||||
if (typeName === ServiceOptionTypeNames.number) {
|
||||
if (option.valueType === ServiceOptionType.number) {
|
||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
validation: (value: string) => {
|
||||
@@ -48,11 +47,11 @@ export function createOptionElement(option: data.ServiceOption, rowContainer: Bu
|
||||
});
|
||||
optionWidget.value = optionValue;
|
||||
inputElement = this.findElement(rowContainer, 'input');
|
||||
} else if (typeName === ServiceOptionTypeNames.category || typeName === ServiceOptionTypeNames.boolean) {
|
||||
} else if (option.valueType === ServiceOptionType.category || option.valueType === ServiceOptionType.boolean) {
|
||||
optionWidget = new SelectBox(possibleInputs, optionValue.toString());
|
||||
DialogHelper.appendInputSelectBox(rowContainer, optionWidget);
|
||||
inputElement = this.findElement(rowContainer, 'select-box');
|
||||
} else if (typeName === ServiceOptionTypeNames.string || typeName === ServiceOptionTypeNames.password) {
|
||||
} else if (option.valueType === ServiceOptionType.string || option.valueType === ServiceOptionType.password) {
|
||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
validation: (value: string) => (!value && option.isRequired) ? ({ type: MessageType.ERROR, content: option.displayName + missingErrorMessage }) : null
|
||||
@@ -70,11 +69,10 @@ export function createOptionElement(option: data.ServiceOption, rowContainer: Bu
|
||||
|
||||
export function getOptionValueAndCategoryValues(option: data.ServiceOption, options: { [optionName: string]: any }, possibleInputs: string[]): any {
|
||||
|
||||
let valueTypeName:string = option.valueType.toString();
|
||||
var optionValue = option.defaultValue;
|
||||
if (options[option.name]) {
|
||||
// if the value type is boolean, the option value can be either boolean or string
|
||||
if (valueTypeName === ServiceOptionTypeNames.boolean) {
|
||||
if (option.valueType === ServiceOptionType.boolean) {
|
||||
if (options[option.name] === true || options[option.name] === this.trueInputValue) {
|
||||
optionValue = this.trueInputValue;
|
||||
} else {
|
||||
@@ -85,13 +83,13 @@ export function getOptionValueAndCategoryValues(option: data.ServiceOption, opti
|
||||
}
|
||||
}
|
||||
|
||||
if (valueTypeName === ServiceOptionTypeNames.boolean || valueTypeName === ServiceOptionTypeNames.category) {
|
||||
if (option.valueType === ServiceOptionType.boolean || option.valueType === ServiceOptionType.category) {
|
||||
// If the option is not required, the empty string should be add at the top of possible choices
|
||||
if (!option.isRequired) {
|
||||
possibleInputs.push('');
|
||||
}
|
||||
|
||||
if (valueTypeName === ServiceOptionTypeNames.boolean) {
|
||||
if (option.valueType === ServiceOptionType.boolean) {
|
||||
possibleInputs.push(this.trueInputValue, this.falseInputValue);
|
||||
} else {
|
||||
option.categoryValues.map(c => possibleInputs.push(c.name));
|
||||
@@ -111,9 +109,9 @@ export function validateInputs(optionsMap: { [optionName: string]: IOptionElemen
|
||||
for (var optionName in optionsMap) {
|
||||
var optionElement: IOptionElement = optionsMap[optionName];
|
||||
var widget = optionElement.optionWidget;
|
||||
var isInputBox = (optionElement.option.valueType.toString() === ServiceOptionTypeNames.string ||
|
||||
optionElement.option.valueType.toString() === ServiceOptionTypeNames.password ||
|
||||
optionElement.option.valueType.toString() === ServiceOptionTypeNames.number);
|
||||
var isInputBox = (optionElement.option.valueType === ServiceOptionType.string ||
|
||||
optionElement.option.valueType === ServiceOptionType.password ||
|
||||
optionElement.option.valueType === ServiceOptionType.number);
|
||||
|
||||
if (isInputBox) {
|
||||
if (!widget.validate()) {
|
||||
|
||||
6
src/sql/data.d.ts
vendored
6
src/sql/data.d.ts
vendored
@@ -661,12 +661,6 @@ declare module 'data' {
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
export interface QueryExecuteParams {
|
||||
ownerUri: string;
|
||||
querySelection: ISelectionData;
|
||||
executionPlanOptions?: ExecutionPlanOptions;
|
||||
}
|
||||
|
||||
export interface QueryExecuteSubsetParams {
|
||||
ownerUri: string;
|
||||
batchIndex: number;
|
||||
|
||||
@@ -68,10 +68,9 @@ export class ConnectionConfig implements IConnectionConfig {
|
||||
allGroups = allGroups.concat(userGroups);
|
||||
}
|
||||
allGroups = allGroups.map(g => {
|
||||
// @SQLTODO
|
||||
// if (g.parentId === '' || !g.parentId) {
|
||||
// g.parentId = undefined;
|
||||
// }
|
||||
if (g.parentId === '' || !g.parentId) {
|
||||
g.parentId = undefined;
|
||||
}
|
||||
return g;
|
||||
});
|
||||
return allGroups;
|
||||
|
||||
@@ -15,17 +15,6 @@ export enum ServiceOptionType {
|
||||
object = 6
|
||||
}
|
||||
|
||||
// SQL added extension host types
|
||||
export enum ServiceOptionTypeNames {
|
||||
string = 'string',
|
||||
multistring = 'multistring',
|
||||
password = 'password',
|
||||
number = 'number',
|
||||
category = 'category',
|
||||
boolean = 'boolean',
|
||||
object = 'object'
|
||||
}
|
||||
|
||||
export enum ConnectionOptionSpecialType {
|
||||
serverName = 'serverName',
|
||||
databaseName = 'databaseName',
|
||||
|
||||
@@ -10,7 +10,7 @@ import data = require('data');
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as assert from 'assert';
|
||||
import { ServiceOptionType, ServiceOptionTypeNames } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
|
||||
suite('Advanced options helper tests', () => {
|
||||
var possibleInputs: string[];
|
||||
@@ -41,7 +41,7 @@ suite('Advanced options helper tests', () => {
|
||||
],
|
||||
defaultValue: null,
|
||||
isRequired: false,
|
||||
valueType: <any>ServiceOptionTypeNames.category,
|
||||
valueType: ServiceOptionType.category,
|
||||
objectType: undefined,
|
||||
isArray: undefined
|
||||
};
|
||||
@@ -54,7 +54,7 @@ suite('Advanced options helper tests', () => {
|
||||
categoryValues: null,
|
||||
defaultValue: null,
|
||||
isRequired: false,
|
||||
valueType: <any>ServiceOptionTypeNames.boolean,
|
||||
valueType: ServiceOptionType.boolean,
|
||||
objectType: undefined,
|
||||
isArray: undefined
|
||||
};
|
||||
@@ -67,7 +67,7 @@ suite('Advanced options helper tests', () => {
|
||||
categoryValues: null,
|
||||
defaultValue: '15',
|
||||
isRequired: false,
|
||||
valueType: <any>ServiceOptionTypeNames.number,
|
||||
valueType: ServiceOptionType.number,
|
||||
objectType: undefined,
|
||||
isArray: undefined
|
||||
};
|
||||
@@ -80,7 +80,7 @@ suite('Advanced options helper tests', () => {
|
||||
categoryValues: null,
|
||||
defaultValue: null,
|
||||
isRequired: false,
|
||||
valueType: <any>ServiceOptionTypeNames.string,
|
||||
valueType: ServiceOptionType.string,
|
||||
objectType: undefined,
|
||||
isArray: undefined
|
||||
};
|
||||
@@ -93,7 +93,7 @@ suite('Advanced options helper tests', () => {
|
||||
categoryValues: null,
|
||||
defaultValue: null,
|
||||
isRequired: false,
|
||||
valueType: <any>ServiceOptionTypeNames.string,
|
||||
valueType: ServiceOptionType.string,
|
||||
objectType: undefined,
|
||||
isArray: undefined
|
||||
};
|
||||
|
||||
@@ -5173,9 +5173,9 @@ slice-ansi@0.0.4:
|
||||
version "0.0.4"
|
||||
resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35"
|
||||
|
||||
"slickgrid@github:anthonydresser/SlickGrid#2.3.12":
|
||||
version "2.3.12"
|
||||
resolved "https://codeload.github.com/anthonydresser/SlickGrid/tar.gz/5610e05166cd7068dcf196498ae20054382b1684"
|
||||
"slickgrid@github:anthonydresser/SlickGrid#2.3.7":
|
||||
version "2.3.4"
|
||||
resolved "https://codeload.github.com/anthonydresser/SlickGrid/tar.gz/fa7911c34b5449f9ce1e7148480fbc24fd20743a"
|
||||
dependencies:
|
||||
jquery ">=1.8.0"
|
||||
jquery-ui ">=1.8.0"
|
||||
|
||||
Reference in New Issue
Block a user