mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 11:01:37 -05:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96e2145931 | ||
|
|
5845135366 | ||
|
|
4b05fa9075 | ||
|
|
bd1f133ca5 | ||
|
|
944a8f9c72 | ||
|
|
441b57f3ca | ||
|
|
803b02be81 | ||
|
|
d76bba1458 | ||
|
|
9b40838ea3 | ||
|
|
6c98603979 | ||
|
|
0e2d1e515e | ||
|
|
bfb03d160e | ||
|
|
ff21a93e00 |
@@ -1,9 +1,26 @@
|
||||
# Database Admin Tool Extensions for Windows
|
||||
# Database Admin Tool Extensions for Windows *(preview)*
|
||||
|
||||
This adds Windows-specific functionality into Azure Data Studio.
|
||||
The Database Admin Tool Extensions for Windows adds Windows-specific functionality into Azure Data Studio. Currently this
|
||||
functionality includes the ability to launch a set of SQL Server Management Studio experiences directly from Azure Data Studio.
|
||||
|
||||
These experiences include:
|
||||
|
||||
* SSMS Property dialogs for select object types, such as Databases, Views, Stored Procedures and more
|
||||
* The [Generate Scripts Wizard](https://docs.microsoft.com/en-us/sql/ssms/scripting/generate-and-publish-scripts-wizard)
|
||||
|
||||
### How do I launch these experiences?
|
||||
|
||||
Both of these are available as menu items on the context menu for nodes in the Object Explorer tree. Right click on a node that supports one of the experiences and select the appropriate item.
|
||||
|
||||
**Properties** for the property dialogs of supported object types
|
||||
|
||||

|
||||
|
||||
**Generate Scripts...** for the Generate Scripts Wizard (only available on Database nodes)
|
||||
|
||||

|
||||
|
||||
## Code of Conduct
|
||||
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||
|
||||
## Privacy Statement
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
Distributable Code for Microsoft Visual Studio 2017 and Microsoft Visual Studio 2017 SDK (Includes Utilities & BuildServer Files)
|
||||
|
||||
For the latest version of this Redist file, please visit http://go.microsoft.com/fwlink/?LinkId=823098
|
||||
@@ -10,7 +10,7 @@
|
||||
"aiKey": "AIF-5574968e-856d-40d2-af67-c89a14e76412",
|
||||
"engines": {
|
||||
"vscode": "^1.30.1",
|
||||
"azdata": "*"
|
||||
"azdata": ">=1.8.0"
|
||||
},
|
||||
"activationEvents": [
|
||||
"*"
|
||||
|
||||
@@ -86,17 +86,9 @@
|
||||
"defaultValue": null,
|
||||
"objectType": null,
|
||||
"categoryValues": [
|
||||
{
|
||||
"displayName": "%cms.connectionOptions.authType.categoryValues.sqlLogin%",
|
||||
"name": "SqlLogin"
|
||||
},
|
||||
{
|
||||
"displayName": "%cms.connectionOptions.authType.categoryValues.integrated%",
|
||||
"name": "Integrated"
|
||||
},
|
||||
{
|
||||
"displayName": "%cms.connectionOptions.authType.categoryValues.azureMFA%",
|
||||
"name": "AzureMFA"
|
||||
}
|
||||
],
|
||||
"isRequired": true,
|
||||
|
||||
@@ -78,7 +78,7 @@ export class CmsResourceTreeNode extends CmsResourceTreeNodeBase {
|
||||
}
|
||||
}, (error) => {
|
||||
let errorText = localize('cms.errors.expandCmsFail', 'The Central Management Server {0} could not be found or is offline', this.name);
|
||||
this.appContext.apiWrapper.showErrorMessage(errorText);
|
||||
this.appContext.apiWrapper.showErrorMessage(error ? error : errorText);
|
||||
return [];
|
||||
});
|
||||
} catch {
|
||||
|
||||
@@ -143,9 +143,7 @@ export class CmsUtils {
|
||||
providerName: undefined,
|
||||
saveProfile: undefined,
|
||||
id: undefined,
|
||||
options: {
|
||||
authTypeChanged: true
|
||||
}
|
||||
options: {}
|
||||
};
|
||||
return this.openConnectionDialog([cmsProvider], initialProfile, { saveConnection: false }).then(async (connection) => {
|
||||
if (connection && connection.options) {
|
||||
|
||||
@@ -55,7 +55,8 @@
|
||||
"chai": "3.5.0",
|
||||
"mocha-junit-reporter": "^1.17.0",
|
||||
"mocha-multi-reporters": "^1.1.7",
|
||||
"vscode": "1.1.5"
|
||||
"vscode": "1.1.5",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"azure-keyvault": "^3.0.4",
|
||||
|
||||
@@ -10,6 +10,7 @@ import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import * as mssql from '../../mssql/src/api/mssqlapis';
|
||||
import * as utils from './utils';
|
||||
import * as uuid from 'uuid';
|
||||
import { context } from './testContext';
|
||||
import assert = require('assert');
|
||||
import { getStandaloneServer, TestServerProfile, getBdcServer } from './testConfig';
|
||||
@@ -19,6 +20,10 @@ let server: TestServerProfile;
|
||||
let connectionId: string;
|
||||
let ownerUri: string;
|
||||
const SERVER_CONNECTION_TIMEOUT: number = 3000;
|
||||
const TEST_CMS_NAME = `adsTestCms_${uuid.v4()}`;
|
||||
const TEST_CMS_GROUP = `adsTestCmsGroup_${uuid.v4()}`;
|
||||
const TEST_CMS_SERVER = `adsTestCmsServer_${uuid.v4()}`;
|
||||
const TEST_CMS_REG_SERVER = `adsTestCmsRegisteredServer_${uuid.v4()}`;
|
||||
|
||||
if (context.RunTest) {
|
||||
suite('CMS integration test suite', () => {
|
||||
@@ -45,9 +50,9 @@ if (context.RunTest) {
|
||||
|
||||
test('Create CMS Server', async function () {
|
||||
// Should fail
|
||||
let failedResult = await cmsService.createCmsServer(undefined, 'test_description', undefined, ownerUri);
|
||||
assert(failedResult === undefined, 'Cannot add a CMS server without a name or connection');
|
||||
|
||||
await utils.assertThrowsAsync(
|
||||
async () => await cmsService.createCmsServer(undefined, 'test_description', undefined, ownerUri),
|
||||
'Cannot add a CMS server without a name or connection');
|
||||
let connection = {
|
||||
serverName: server.serverName,
|
||||
userName: server.userName,
|
||||
@@ -60,39 +65,44 @@ if (context.RunTest) {
|
||||
options: {}
|
||||
};
|
||||
|
||||
// Should create a CMS Server
|
||||
let result = await cmsService.createCmsServer('test_cms', 'test_description', connection, ownerUri);
|
||||
assert(result !== undefined, 'CMS server created successfully');
|
||||
// Should create a CMS Server without an error
|
||||
await cmsService.createCmsServer(TEST_CMS_NAME, 'test_description', connection, ownerUri);
|
||||
});
|
||||
|
||||
test('Add and delete registered group to/from CMS server', async function () {
|
||||
// Should fail
|
||||
let failedResult = await cmsService.addServerGroup(ownerUri, '', undefined, 'test_description');
|
||||
assert(failedResult === undefined, 'Cannot add a server group without a name');
|
||||
await utils.assertThrowsAsync(
|
||||
async () => await cmsService.addServerGroup(ownerUri, '', undefined, 'test_description'),
|
||||
'Cannot add a server group without a name');
|
||||
|
||||
// Should create a server group
|
||||
let result = await cmsService.addServerGroup(ownerUri, '', 'test_group', 'test_description');
|
||||
assert(result === true, 'Server group added to CMS server successfully');
|
||||
let result = await cmsService.addServerGroup(ownerUri, '', TEST_CMS_GROUP, 'test_description');
|
||||
assert(result === true, `Server group ${TEST_CMS_GROUP} was not added to CMS server successfully`);
|
||||
|
||||
let existingRegisteredServerGroupCount = (await cmsService.getRegisteredServers(ownerUri, '')).registeredServerGroups.length;
|
||||
|
||||
// Shouldn't be able to create a new server group with same name
|
||||
let repeatResult = await cmsService.addServerGroup(ownerUri, '', 'test_group', 'test_description');
|
||||
assert(repeatResult === undefined, 'Cannot add a server group with existing name');
|
||||
await utils.assertThrowsAsync(
|
||||
async () => await cmsService.addServerGroup(ownerUri, '', TEST_CMS_GROUP, 'test_description'),
|
||||
'Cannot add a server group with existing name');
|
||||
|
||||
let cmsResources = await cmsService.getRegisteredServers(ownerUri, '');
|
||||
assert(cmsResources.registeredServerGroups.length === 1, 'A server group was added successfully');
|
||||
assert(cmsResources.registeredServerGroups.length === existingRegisteredServerGroupCount,
|
||||
`Unexpected number of Registered Server Groups after attempting to add group that already exists. Groups : [${cmsResources.registeredServerGroups.map(g => g.name).join(', ')}]`);
|
||||
|
||||
// Should remove the server group we added above
|
||||
let deleteResult = await cmsService.removeServerGroup(ownerUri, '', 'test_group');
|
||||
assert(deleteResult === true, 'Server group removed from CMS server successfully');
|
||||
let deleteResult = await cmsService.removeServerGroup(ownerUri, '', TEST_CMS_GROUP);
|
||||
assert(deleteResult === true, `Server group ${TEST_CMS_GROUP} was not removed successfully`);
|
||||
|
||||
cmsResources = await cmsService.getRegisteredServers(ownerUri, '');
|
||||
assert(cmsResources.registeredServerGroups.length === 0, 'The server group was removed successfully');
|
||||
assert(cmsResources.registeredServerGroups.find(g => g.name === TEST_CMS_GROUP) === undefined,
|
||||
`The server group ${TEST_CMS_GROUP} was not removed successfully. Groups : [${cmsResources.registeredServerGroups.map(g => g.name).join(', ')}]`);
|
||||
});
|
||||
|
||||
test('Add and delete registered server to/from CMS server', async function () {
|
||||
// Should fail
|
||||
let failedResult = await cmsService.addRegisteredServer(ownerUri, '', undefined, 'test_description', undefined);
|
||||
assert(failedResult === undefined, 'Cannot add a registered without a name or connection');
|
||||
|
||||
await utils.assertThrowsAsync(
|
||||
async () => cmsService.addRegisteredServer(ownerUri, '', undefined, 'test_description', undefined),
|
||||
'Cannot add a registered without a name or connection');
|
||||
|
||||
let bdcServer = await getBdcServer();
|
||||
let bdcConnection = {
|
||||
@@ -104,31 +114,33 @@ if (context.RunTest) {
|
||||
provider: bdcServer.provider,
|
||||
version: bdcServer.version,
|
||||
engineType: bdcServer.engineType,
|
||||
options: { }
|
||||
options: {}
|
||||
};
|
||||
|
||||
// Should create a registered server
|
||||
let result = await cmsService.addRegisteredServer(ownerUri, '', 'test_registered_server', 'test_description', bdcConnection);
|
||||
assert(result === true, 'Registered server added to CMS server successfully');
|
||||
let result = await cmsService.addRegisteredServer(ownerUri, '', TEST_CMS_SERVER, 'test_description', bdcConnection);
|
||||
assert(result === true, `Registered server ${TEST_CMS_SERVER} was not added to CMS server successfully`);
|
||||
|
||||
// Shouldn't be able to create a new registered server with same name
|
||||
let repeatResult = await cmsService.addRegisteredServer(ownerUri, '', 'test_registered_server', 'test_description', bdcConnection);
|
||||
assert(repeatResult === undefined, 'Cannot add a registered server with existing name');
|
||||
await utils.assertThrowsAsync(
|
||||
async () => await cmsService.addRegisteredServer(ownerUri, '', TEST_CMS_SERVER, 'test_description', bdcConnection),
|
||||
'Cannot add a registered server with existing name');
|
||||
|
||||
// Should remove the registered server we added above
|
||||
let deleteResult = await cmsService.removeRegisteredServer(ownerUri, '', 'test_registered_server');
|
||||
assert(deleteResult === true, 'Registered server added to CMS server successfully');
|
||||
let deleteResult = await cmsService.removeRegisteredServer(ownerUri, '', TEST_CMS_SERVER);
|
||||
assert(deleteResult === true, `Registered server ${TEST_CMS_SERVER} was not removed correctly`);
|
||||
});
|
||||
|
||||
test('Add and delete registered server to/from server group', async function () {
|
||||
|
||||
// Should create a server group
|
||||
let result = await cmsService.addServerGroup(ownerUri, '', 'test_group', 'test_description');
|
||||
assert(result === true, 'Server group added to CMS server successfully');
|
||||
let result = await cmsService.addServerGroup(ownerUri, '', TEST_CMS_GROUP, 'test_description');
|
||||
assert(result === true, `Server group ${TEST_CMS_GROUP} was not created successfully`);
|
||||
|
||||
// Make sure server group is created
|
||||
let cmsResources = await cmsService.getRegisteredServers(ownerUri, '');
|
||||
assert(cmsResources.registeredServerGroups.length === 1, 'The server group was added successfully');
|
||||
assert(cmsResources.registeredServerGroups.find(g => g.name === TEST_CMS_GROUP),
|
||||
`Registered Server Group ${TEST_CMS_GROUP} was not found after being added. Groups : [${cmsResources.registeredServerGroups.map(g => g.name).join(', ')}]`);
|
||||
|
||||
// Should create a registered server under the group
|
||||
let bdcServer = await getBdcServer();
|
||||
@@ -141,15 +153,16 @@ if (context.RunTest) {
|
||||
provider: bdcServer.provider,
|
||||
version: bdcServer.version,
|
||||
engineType: bdcServer.engineType,
|
||||
options: { }
|
||||
options: {}
|
||||
};
|
||||
let relativePath = cmsResources.registeredServerGroups[0].relativePath;
|
||||
result = await cmsService.addRegisteredServer(ownerUri, relativePath, 'test_registered_server_2', 'test_description', bdcConnection);
|
||||
assert(result === true, 'Registered server added to server group');
|
||||
|
||||
result = await cmsService.addRegisteredServer(ownerUri, relativePath, TEST_CMS_REG_SERVER, 'test_description', bdcConnection);
|
||||
assert(result === true, `Registered server ${TEST_CMS_REG_SERVER} was not added to server group successfully`);
|
||||
|
||||
// Should remove the server group we added above
|
||||
let deleteResult = await cmsService.removeServerGroup(ownerUri, '', 'test_group');
|
||||
assert(deleteResult === true, 'Server group deleted from CMS server successfully');
|
||||
let deleteResult = await cmsService.removeServerGroup(ownerUri, '', TEST_CMS_GROUP);
|
||||
assert(deleteResult === true, `Server group ${TEST_CMS_GROUP} was not deleted from CMS server successfully`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -75,4 +75,17 @@ export async function deleteDB(dbName: string, ownerUri: string): Promise<void>
|
||||
END CATCH`;
|
||||
|
||||
await queryProvider.runQueryAndReturn(ownerUri, query);
|
||||
}
|
||||
}
|
||||
|
||||
export async function assertThrowsAsync(fn: () => Promise<any>, msg: string): Promise<void> {
|
||||
let f = () => {
|
||||
// Empty
|
||||
};
|
||||
try {
|
||||
await fn();
|
||||
} catch (e) {
|
||||
f = () => { throw e; };
|
||||
} finally {
|
||||
assert.throws(f, msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import { ListRegisteredServersResult } from '../api/mssqlapis';
|
||||
export class CmsService {
|
||||
|
||||
constructor(private appContext: AppContext, private client: SqlOpsDataClient) {
|
||||
|
||||
this.appContext.registerService<CmsService>(constants.CmsService, this);
|
||||
}
|
||||
|
||||
@@ -30,7 +29,7 @@ export class CmsService {
|
||||
},
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.CreateCentralManagementServerRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
return Promise.reject(new Error(e.message));
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -43,7 +42,7 @@ export class CmsService {
|
||||
},
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.ListRegisteredServersRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
return Promise.reject(new Error(e.message));
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -56,7 +55,7 @@ export class CmsService {
|
||||
},
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.AddRegisteredServerRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
return Promise.reject(new Error(e.message));
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -69,7 +68,7 @@ export class CmsService {
|
||||
},
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.RemoveRegisteredServerRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
return Promise.reject(new Error(e.message));
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -82,7 +81,7 @@ export class CmsService {
|
||||
},
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.AddServerGroupRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
return Promise.reject(new Error(e.message));
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -95,7 +94,7 @@ export class CmsService {
|
||||
},
|
||||
e => {
|
||||
this.client.logFailedRequest(contracts.RemoveServerGroupRequest.type, e);
|
||||
return Promise.resolve(undefined);
|
||||
return Promise.reject(new Error(e.message));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||
"version": "1.5.0-alpha.98",
|
||||
"version": "1.5.0-alpha.99",
|
||||
"downloadFileNames": {
|
||||
"Windows_86": "win-x86-netcoreapp2.2.zip",
|
||||
"Windows_64": "win-x64-netcoreapp2.2.zip",
|
||||
|
||||
@@ -509,6 +509,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
for (let i = 0; i < this.viewItems.length; i++) {
|
||||
const item = this.viewItems[i];
|
||||
item.size = clamp(Math.round(this.proportions[i] * size), item.view.minimumSize, item.view.maximumSize);
|
||||
this.updateSize(item.view.id, size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -815,6 +816,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
|
||||
deltaUp -= viewDelta;
|
||||
item.size = size;
|
||||
this.updateSize(item.view.id, size);
|
||||
this.dirtyState = true;
|
||||
}
|
||||
|
||||
@@ -825,6 +827,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
|
||||
deltaDown += viewDelta;
|
||||
item.size = size;
|
||||
this.updateSize(item.view.id, size);
|
||||
this.dirtyState = true;
|
||||
}
|
||||
|
||||
@@ -842,6 +845,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
|
||||
emptyDelta -= viewDelta;
|
||||
item.size = size;
|
||||
this.updateSize(item.view.id, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -195,6 +195,7 @@ export class QueryResultsView extends Disposable {
|
||||
}
|
||||
|
||||
private setQueryRunner(runner: QueryRunner) {
|
||||
const activeTab = this._input.state.activeTab;
|
||||
if (runner.hasCompleted && !this.hasResults(runner)) {
|
||||
this.hideResults();
|
||||
} else {
|
||||
@@ -261,8 +262,8 @@ export class QueryResultsView extends Disposable {
|
||||
});
|
||||
}
|
||||
}));
|
||||
if (this.input.state.activeTab) {
|
||||
this._panelView.showTab(this.input.state.activeTab);
|
||||
if (activeTab) {
|
||||
this._panelView.showTab(activeTab);
|
||||
} else {
|
||||
this._panelView.showTab(this.resultsTab.identifier); // our default tab is the results view
|
||||
}
|
||||
@@ -272,14 +273,15 @@ export class QueryResultsView extends Disposable {
|
||||
this._input = input;
|
||||
dispose(this.runnerDisposables);
|
||||
this.runnerDisposables = [];
|
||||
|
||||
[this.resultsTab, this.messagesTab, this.qpTab, this.topOperationsTab, this.chartTab].forEach(t => t.clear());
|
||||
|
||||
this.resultsTab.view.state = this.input.state.gridPanelState;
|
||||
this.messagesTab.view.state = this.input.state.messagePanelState;
|
||||
this.qpTab.view.state = this.input.state.queryPlanState;
|
||||
this.topOperationsTab.view.state = this.input.state.topOperationsState;
|
||||
this.chartTab.view.state = this.input.state.chartState;
|
||||
|
||||
[this.resultsTab, this.messagesTab, this.qpTab, this.topOperationsTab, this.chartTab].forEach(t => t.clear());
|
||||
|
||||
let info = this.queryModelService._getQueryInfo(input.uri);
|
||||
if (info) {
|
||||
this.setQueryRunner(info.queryRunner);
|
||||
|
||||
@@ -257,13 +257,13 @@ export class GridPanel {
|
||||
|
||||
for (let set of resultSet) {
|
||||
let tableState: GridTableState;
|
||||
if (this._state) {
|
||||
if (this.state) {
|
||||
tableState = this.state.tableStates.find(e => e.batchId === set.batchId && e.resultId === set.id);
|
||||
}
|
||||
if (!tableState) {
|
||||
tableState = new GridTableState(set.id, set.batchId);
|
||||
if (this._state) {
|
||||
this._state.tableStates.push(tableState);
|
||||
if (this.state) {
|
||||
this.state.tableStates.push(tableState);
|
||||
}
|
||||
}
|
||||
let table = this.instantiationService.createInstance(GridTable, this.runner, set, tableState);
|
||||
@@ -295,13 +295,13 @@ export class GridPanel {
|
||||
|
||||
public clear() {
|
||||
this.reset();
|
||||
this.state = undefined;
|
||||
}
|
||||
|
||||
private reset() {
|
||||
for (let i = this.splitView.length - 1; i >= 0; i--) {
|
||||
this.splitView.removeView(i);
|
||||
}
|
||||
this._state = undefined;
|
||||
dispose(this.tables);
|
||||
dispose(this.tableDisposable);
|
||||
this.tableDisposable = [];
|
||||
@@ -336,15 +336,17 @@ export class GridPanel {
|
||||
|
||||
public set state(val: GridPanelState) {
|
||||
this._state = val;
|
||||
this.tables.map(t => {
|
||||
let state = this.state.tableStates.find(s => s.batchId === t.resultSet.batchId && s.resultId === t.resultSet.id);
|
||||
if (!state) {
|
||||
this.state.tableStates.push(t.state);
|
||||
}
|
||||
if (state) {
|
||||
t.state = state;
|
||||
}
|
||||
});
|
||||
if (this.state) {
|
||||
this.tables.map(t => {
|
||||
let state = this.state.tableStates.find(s => s.batchId === t.resultSet.batchId && s.resultId === t.resultSet.id);
|
||||
if (!state) {
|
||||
this.state.tableStates.push(t.state);
|
||||
}
|
||||
if (state) {
|
||||
t.state = state;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public get state() {
|
||||
|
||||
@@ -20,7 +20,6 @@ export class CmsConnectionController extends ConnectionController {
|
||||
connectionProperties: ConnectionProviderProperties,
|
||||
callback: IConnectionComponentCallbacks,
|
||||
providerName: string,
|
||||
authTypeChanged: boolean = false,
|
||||
@IInstantiationService _instantiationService: IInstantiationService) {
|
||||
super(connectionManagementService, connectionProperties, callback, providerName, _instantiationService);
|
||||
let specialOptions = this._providerOptions.filter(
|
||||
@@ -34,11 +33,11 @@ export class CmsConnectionController extends ConnectionController {
|
||||
serverName, authenticationType, userName, password).then(result => {
|
||||
return result;
|
||||
})
|
||||
}, providerName, authTypeChanged);
|
||||
}, providerName);
|
||||
}
|
||||
|
||||
public showUiComponent(container: HTMLElement, authTypeChanged: boolean = false): void {
|
||||
public showUiComponent(container: HTMLElement): void {
|
||||
this._databaseCache = new Map<string, string[]>();
|
||||
this._connectionWidget.createConnectionWidget(container, authTypeChanged);
|
||||
this._connectionWidget.createConnectionWidget(container);
|
||||
}
|
||||
}
|
||||
@@ -35,13 +35,12 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
||||
|
||||
private _serverDescriptionInputBox: InputBox;
|
||||
protected _authTypeMap: { [providerName: string]: AuthenticationType[] } = {
|
||||
[Constants.cmsProviderName]: [AuthenticationType.SqlLogin, AuthenticationType.Integrated, AuthenticationType.AzureMFA]
|
||||
[Constants.cmsProviderName]: [AuthenticationType.Integrated]
|
||||
};
|
||||
|
||||
constructor(options: azdata.ConnectionOption[],
|
||||
callbacks: IConnectionComponentCallbacks,
|
||||
providerName: string,
|
||||
authTypeChanged: boolean = false,
|
||||
@IThemeService _themeService: IThemeService,
|
||||
@IContextViewService _contextViewService: IContextViewService,
|
||||
@ILayoutService _layoutService: ILayoutService,
|
||||
@@ -54,14 +53,8 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
||||
super(options, callbacks, providerName, _themeService, _contextViewService, _connectionManagementService, _capabilitiesService,
|
||||
_clipboardService, _configurationService, _accountManagementService);
|
||||
let authTypeOption = this._optionsMaps[ConnectionOptionSpecialType.authType];
|
||||
if (authTypeOption) {
|
||||
if (OS === OperatingSystem.Windows || authTypeChanged) {
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(AuthenticationType.Integrated);
|
||||
} else {
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(AuthenticationType.SqlLogin);
|
||||
}
|
||||
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue, this._contextViewService, undefined, { ariaLabel: authTypeOption.displayName });
|
||||
}
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(AuthenticationType.Integrated);
|
||||
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue, this._contextViewService, undefined, { ariaLabel: authTypeOption.displayName });
|
||||
}
|
||||
|
||||
protected registerListeners(): void {
|
||||
@@ -71,12 +64,12 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
||||
}
|
||||
}
|
||||
|
||||
protected fillInConnectionForm(authTypeChanged: boolean = false): void {
|
||||
protected fillInConnectionForm(): void {
|
||||
// Server Name
|
||||
this.addServerNameOption();
|
||||
|
||||
// Authentication type
|
||||
this.addAuthenticationTypeOption(authTypeChanged);
|
||||
this.addAuthenticationTypeOption();
|
||||
|
||||
// Login Options
|
||||
this.addLoginOptions();
|
||||
@@ -91,25 +84,16 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
||||
this.addAdvancedOptions();
|
||||
}
|
||||
|
||||
protected addAuthenticationTypeOption(authTypeChanged: boolean = false): void {
|
||||
super.addAuthenticationTypeOption(authTypeChanged);
|
||||
protected addAuthenticationTypeOption(): void {
|
||||
super.addAuthenticationTypeOption();
|
||||
let authTypeOption = this._optionsMaps[ConnectionOptionSpecialType.authType];
|
||||
let newAuthTypes = authTypeOption.categoryValues;
|
||||
// True when opening a CMS dialog to add a registered server
|
||||
if (authTypeChanged) {
|
||||
// Registered Servers only support Integrated Auth
|
||||
newAuthTypes = authTypeOption.categoryValues.filter((option) => option.name === AuthenticationType.Integrated);
|
||||
this._authTypeSelectBox.setOptions(newAuthTypes.map(c => c.displayName), 0);
|
||||
authTypeOption.defaultValue = AuthenticationType.Integrated;
|
||||
} else {
|
||||
// CMS supports all auth types
|
||||
if (OS === OperatingSystem.Windows) {
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(AuthenticationType.Integrated);
|
||||
} else {
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(AuthenticationType.SqlLogin);
|
||||
}
|
||||
this._authTypeSelectBox.setOptions(authTypeOption.categoryValues.map(c => c.displayName), 1);
|
||||
}
|
||||
|
||||
// CMS only supports Integrated Auth
|
||||
newAuthTypes = authTypeOption.categoryValues.filter((option) => option.name === AuthenticationType.Integrated);
|
||||
this._authTypeSelectBox.setOptions(newAuthTypes.map(c => c.displayName), 0);
|
||||
authTypeOption.defaultValue = AuthenticationType.Integrated;
|
||||
this._authTypeSelectBox.setOptions(authTypeOption.categoryValues.map(c => c.displayName), 1);
|
||||
}
|
||||
|
||||
private addServerDescriptionOption(): void {
|
||||
@@ -123,10 +107,10 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public createConnectionWidget(container: HTMLElement, authTypeChanged: boolean = false): void {
|
||||
public createConnectionWidget(container: HTMLElement): void {
|
||||
this._container = DOM.append(container, DOM.$('div.connection-table'));
|
||||
this._tableContainer = DOM.append(this._container, DOM.$('table.connection-table-content'));
|
||||
this.fillInConnectionForm(authTypeChanged);
|
||||
this.fillInConnectionForm();
|
||||
this.registerListeners();
|
||||
if (this._authTypeSelectBox) {
|
||||
this.onAuthTypeSelected(this._authTypeSelectBox.value);
|
||||
|
||||
@@ -143,9 +143,6 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
if (filteredKeys && filteredKeys.length > 0) {
|
||||
defaultProvider = filteredKeys[0];
|
||||
}
|
||||
else {
|
||||
defaultProvider = keys[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!defaultProvider && this._configurationService) {
|
||||
@@ -284,7 +281,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
this._connectionManagementService,
|
||||
this._capabilitiesService.getCapabilities(providerName).connection, {
|
||||
onSetConnectButton: (enable: boolean) => this.handleSetConnectButtonEnable(enable)
|
||||
}, providerName, this._inputModel ? this._inputModel.options.authTypeChanged : false);
|
||||
}, providerName);
|
||||
} else {
|
||||
this._connectionControllerMap[providerName] =
|
||||
this._instantiationService.createInstance(ConnectionController,
|
||||
@@ -304,30 +301,27 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
private handleShowUiComponent(input: OnShowUIResponse) {
|
||||
if (input.selectedProviderType) {
|
||||
// If the call is for specific providers
|
||||
let isParamProvider: boolean = false;
|
||||
let isProviderInParams: boolean = false;
|
||||
if (this._params && this._params.providers) {
|
||||
this._params.providers.forEach((provider) => {
|
||||
if (input.selectedProviderType === this._providerNameToDisplayNameMap[provider]) {
|
||||
isParamProvider = true;
|
||||
isProviderInParams = true;
|
||||
this._currentProviderType = provider;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!isParamProvider) {
|
||||
if (!isProviderInParams) {
|
||||
this._currentProviderType = Object.keys(this._providerNameToDisplayNameMap).find((key) =>
|
||||
this._providerNameToDisplayNameMap[key] === input.selectedProviderType
|
||||
this._providerNameToDisplayNameMap[key] === input.selectedProviderType &&
|
||||
key !== Constants.cmsProviderName
|
||||
);
|
||||
}
|
||||
}
|
||||
this._model.providerName = this._currentProviderType;
|
||||
|
||||
this._model = new ConnectionProfile(this._capabilitiesService, this._model);
|
||||
if (this._inputModel && this._inputModel.options) {
|
||||
this.uiController.showUiComponent(input.container,
|
||||
this._inputModel.options.authTypeChanged);
|
||||
} else {
|
||||
this.uiController.showUiComponent(input.container);
|
||||
}
|
||||
this.uiController.showUiComponent(input.container);
|
||||
|
||||
}
|
||||
|
||||
private handleInitDialog() {
|
||||
|
||||
@@ -123,13 +123,13 @@ export class ConnectionWidget {
|
||||
this._providerName = providerName;
|
||||
}
|
||||
|
||||
public createConnectionWidget(container: HTMLElement, authTypeChanged: boolean = false): void {
|
||||
public createConnectionWidget(container: HTMLElement): void {
|
||||
this._serverGroupOptions = [this.DefaultServerGroup];
|
||||
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name, this._contextViewService, undefined, { ariaLabel: this._serverGroupDisplayString });
|
||||
this._previousGroupOption = this._serverGroupSelectBox.value;
|
||||
this._container = DOM.append(container, DOM.$('div.connection-table'));
|
||||
this._tableContainer = DOM.append(this._container, DOM.$('table.connection-table-content'));
|
||||
this.fillInConnectionForm(authTypeChanged);
|
||||
this.fillInConnectionForm();
|
||||
this.registerListeners();
|
||||
if (this._authTypeSelectBox) {
|
||||
this.onAuthTypeSelected(this._authTypeSelectBox.value);
|
||||
@@ -155,12 +155,12 @@ export class ConnectionWidget {
|
||||
}
|
||||
}
|
||||
|
||||
protected fillInConnectionForm(authTypeChanged: boolean = false): void {
|
||||
protected fillInConnectionForm(): void {
|
||||
// Server Name
|
||||
this.addServerNameOption();
|
||||
|
||||
// Authentication type
|
||||
this.addAuthenticationTypeOption(authTypeChanged);
|
||||
this.addAuthenticationTypeOption();
|
||||
|
||||
// Login Options
|
||||
this.addLoginOptions();
|
||||
@@ -178,7 +178,7 @@ export class ConnectionWidget {
|
||||
this.addAdvancedOptions();
|
||||
}
|
||||
|
||||
protected addAuthenticationTypeOption(authTypeChanged: boolean = false): void {
|
||||
protected addAuthenticationTypeOption(): void {
|
||||
if (this._optionsMaps[ConnectionOptionSpecialType.authType]) {
|
||||
let authType = DialogHelper.appendRow(this._tableContainer, this._optionsMaps[ConnectionOptionSpecialType.authType].displayName, 'connection-label', 'connection-input');
|
||||
DialogHelper.appendInputSelectBox(authType, this._authTypeSelectBox);
|
||||
|
||||
@@ -313,6 +313,12 @@ export class ExtensionService extends Disposable implements IExtensionService {
|
||||
}
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
// Forces a reload for CMS extension
|
||||
if (extension.name === 'cms') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user