use STS to process the requests (#17358)

This commit is contained in:
Alan Ren
2021-10-14 13:36:46 -07:00
committed by GitHub
parent f126c998d2
commit af8611455c
3 changed files with 18 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ import * as path from 'path';
import { getCommonLaunchArgsAndCleanupOldLogFiles, getOrDownloadServer } from './utils'; import { getCommonLaunchArgsAndCleanupOldLogFiles, getOrDownloadServer } from './utils';
import { Telemetry, LanguageClientErrorHandler } from './telemetry'; import { Telemetry, LanguageClientErrorHandler } from './telemetry';
import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client'; import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client';
import { TelemetryFeature, AgentServicesFeature, SerializationFeature, AccountFeature, SqlAssessmentServicesFeature, ProfilerFeature } from './features'; import { TelemetryFeature, AgentServicesFeature, SerializationFeature, AccountFeature, SqlAssessmentServicesFeature, ProfilerFeature, TableDesignerFeature } from './features';
import { CredentialStore } from './credentialstore/credentialstore'; import { CredentialStore } from './credentialstore/credentialstore';
import { AzureResourceProvider } from './resourceProvider/resourceProvider'; import { AzureResourceProvider } from './resourceProvider/resourceProvider';
import { SchemaCompareService } from './schemaCompare/schemaCompareService'; import { SchemaCompareService } from './schemaCompare/schemaCompareService';
@@ -163,6 +163,7 @@ function getClientOptions(context: AppContext): ClientOptions {
NotebookConvertService.asFeature(context), NotebookConvertService.asFeature(context),
ProfilerFeature, ProfilerFeature,
SqlMigrationService.asFeature(context), SqlMigrationService.asFeature(context),
TableDesignerFeature
], ],
outputChannel: new CustomOutputChannel() outputChannel: new CustomOutputChannel()
}; };

View File

@@ -10,10 +10,12 @@ import { sqlProviderName } from '../constants';
export function registerTableDesignerCommands(appContext: AppContext) { export function registerTableDesignerCommands(appContext: AppContext) {
appContext.extensionContext.subscriptions.push(vscode.commands.registerCommand('mssql.newTable', async (context: azdata.ObjectExplorerContext) => { appContext.extensionContext.subscriptions.push(vscode.commands.registerCommand('mssql.newTable', async (context: azdata.ObjectExplorerContext) => {
const connectionUri = await azdata.connection.getUriForConnection(context.connectionProfile.id);
await azdata.designers.openTableDesigner(sqlProviderName, { await azdata.designers.openTableDesigner(sqlProviderName, {
server: context.connectionProfile.serverName, server: context.connectionProfile.serverName,
database: context.connectionProfile.databaseName, database: context.connectionProfile.databaseName,
isNewTable: true isNewTable: true,
connectionUri: connectionUri
}); });
})); }));
@@ -22,13 +24,15 @@ export function registerTableDesignerCommands(appContext: AppContext) {
const database = context.connectionProfile.databaseName; const database = context.connectionProfile.databaseName;
const schema = context.nodeInfo.metadata.schema; const schema = context.nodeInfo.metadata.schema;
const name = context.nodeInfo.metadata.name; const name = context.nodeInfo.metadata.name;
const connectionUri = await azdata.connection.getUriForConnection(context.connectionProfile.id);
await azdata.designers.openTableDesigner(sqlProviderName, { await azdata.designers.openTableDesigner(sqlProviderName, {
server: server, server: server,
database: database, database: database,
isNewTable: false, isNewTable: false,
name: name, name: name,
schema: schema, schema: schema,
id: `${server}|${database}|${schema}|${name}` id: `${server}|${database}|${schema}|${name}`,
connectionUri: connectionUri
}); });
})); }));

View File

@@ -290,6 +290,9 @@ export class Designer extends Disposable implements IThemable {
case DesignerEditType.Update: case DesignerEditType.Update:
if (typeof edit.property === 'string') { if (typeof edit.property === 'string') {
// if the type of the property is string then the property is a top level property // if the type of the property is string then the property is a top level property
if (!data[edit.property]) {
data[edit.property] = {};
}
const componentData = data[edit.property]; const componentData = data[edit.property];
const componentType = this._componentMap.get(edit.property).defintion.componentType; const componentType = this._componentMap.get(edit.property).defintion.componentType;
this.setComponentData(componentType, componentData, edit.value); this.setComponentData(componentType, componentData, edit.value);
@@ -297,6 +300,9 @@ export class Designer extends Disposable implements IThemable {
const columnPropertyName = edit.property.property; const columnPropertyName = edit.property.property;
const tableInfo = this._componentMap.get(edit.property.parentProperty).defintion.componentProperties as DesignerTableProperties; const tableInfo = this._componentMap.get(edit.property.parentProperty).defintion.componentProperties as DesignerTableProperties;
const tableProperties = data[edit.property.parentProperty] as DesignerTableProperties; const tableProperties = data[edit.property.parentProperty] as DesignerTableProperties;
if (!tableProperties.data[edit.property.index][columnPropertyName]) {
tableProperties.data[edit.property.index][columnPropertyName] = {};
}
const componentData = tableProperties.data[edit.property.index][columnPropertyName]; const componentData = tableProperties.data[edit.property.index][columnPropertyName];
const itemProperty = tableInfo.itemProperties.find(property => property.propertyName === columnPropertyName); const itemProperty = tableInfo.itemProperties.find(property => property.propertyName === columnPropertyName);
if (itemProperty) { if (itemProperty) {
@@ -335,6 +341,10 @@ export class Designer extends Disposable implements IThemable {
} }
private setComponentValue(definition: DesignerDataPropertyInfo, component: DesignerUIComponent, data: DesignerData): void { private setComponentValue(definition: DesignerDataPropertyInfo, component: DesignerUIComponent, data: DesignerData): void {
// Skip the property if it is not in the data model
if (!data[definition.propertyName]) {
return;
}
this._supressEditProcessing = true; this._supressEditProcessing = true;
switch (definition.componentType) { switch (definition.componentType) {
case 'input': case 'input':