mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 01:25:38 -05:00
Remove all Big Data Cluster features (#21369)
This commit is contained in:
@@ -464,7 +464,7 @@ export class RunParametersAction extends TooltipFromLabelAction {
|
||||
return;
|
||||
}
|
||||
const editor = this._notebookService.findNotebookEditor(context);
|
||||
// Only run action for kernels that are supported (Python, PySpark, PowerShell)
|
||||
// Only run action for kernels that are supported (Python, PowerShell)
|
||||
let supportedKernels: string[] = [KernelsLanguage.Python, KernelsLanguage.PowerShell];
|
||||
if (!supportedKernels.includes(editor.model.languageInfo.name)) {
|
||||
// If the kernel is not supported indicate to user to use supported kernels
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
export namespace constants {
|
||||
export const userPropName = 'user';
|
||||
export const knoxPortPropName = 'knoxport';
|
||||
export const clusterPropName = 'clustername';
|
||||
export const passwordPropName = 'password';
|
||||
export const defaultKnoxPort = '30443';
|
||||
}
|
||||
/**
|
||||
* This is a temporary connection definition, with known properties for Knox gateway connections.
|
||||
* Long term this should be refactored to an extension contribution
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export class NotebookConnection {
|
||||
private _host: string;
|
||||
private _knoxPort: string;
|
||||
|
||||
constructor(private _connectionProfile: IConnectionProfile) {
|
||||
if (!this._connectionProfile) {
|
||||
throw new Error(localize('connectionInfoMissing', "connectionInfo is required"));
|
||||
}
|
||||
}
|
||||
|
||||
public get connectionProfile(): IConnectionProfile {
|
||||
return this._connectionProfile;
|
||||
}
|
||||
|
||||
|
||||
public get host(): string {
|
||||
if (!this._host) {
|
||||
this.ensureHostAndPort();
|
||||
}
|
||||
return this._host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets host and port values, using any ',' or ':' delimited port in the hostname in
|
||||
* preference to the built in port.
|
||||
*/
|
||||
private ensureHostAndPort(): void {
|
||||
this._host = this.connectionProfile.serverName;
|
||||
this._knoxPort = NotebookConnection.getKnoxPortOrDefault(this.connectionProfile);
|
||||
// determine whether the host has either a ',' or ':' in it
|
||||
this.setHostAndPort(',');
|
||||
this.setHostAndPort(':');
|
||||
}
|
||||
|
||||
// set port and host correctly after we've identified that a delimiter exists in the host name
|
||||
private setHostAndPort(delimeter: string): void {
|
||||
let originalHost = this._host;
|
||||
let index = originalHost.indexOf(delimeter);
|
||||
if (index > -1) {
|
||||
this._host = originalHost.slice(0, index);
|
||||
this._knoxPort = originalHost.slice(index + 1);
|
||||
}
|
||||
}
|
||||
|
||||
public get user(): string {
|
||||
return this._connectionProfile.options[constants.userPropName];
|
||||
}
|
||||
|
||||
public get password(): string {
|
||||
return this._connectionProfile.options[constants.passwordPropName];
|
||||
}
|
||||
|
||||
public get knoxport(): string {
|
||||
if (!this._knoxPort) {
|
||||
this.ensureHostAndPort();
|
||||
}
|
||||
return this._knoxPort;
|
||||
}
|
||||
|
||||
private static getKnoxPortOrDefault(connectionProfile: IConnectionProfile): string {
|
||||
let port = connectionProfile.options[constants.knoxPortPropName];
|
||||
if (!port) {
|
||||
port = constants.defaultKnoxPort;
|
||||
}
|
||||
return port;
|
||||
}
|
||||
}
|
||||
@@ -472,7 +472,7 @@ suite('Notebook Actions', function (): void {
|
||||
});
|
||||
|
||||
test('Should inform user kernel is not supported if Run with Parameters Action is run with unsupported kernels', async function (): Promise<void> {
|
||||
// Kernels that are supported (Python, PySpark, PowerShell)
|
||||
// Kernels that are supported (Python, PowerShell)
|
||||
|
||||
const testContents: azdata.nb.INotebookContents = {
|
||||
cells: [{
|
||||
@@ -517,7 +517,7 @@ suite('Notebook Actions', function (): void {
|
||||
});
|
||||
|
||||
test('Should inform user that run with parameters is not supported for untitled notebooks', async function (): Promise<void> {
|
||||
// Kernels that are supported (Python, PySpark, PowerShell)
|
||||
// Kernels that are supported (Python, PowerShell)
|
||||
const untitledUri = URI.parse('untitled:Notebook-0');
|
||||
const testContents: azdata.nb.INotebookContents = {
|
||||
cells: [{
|
||||
|
||||
@@ -95,23 +95,6 @@ suite('Cell Model', function (): void {
|
||||
assert.strictEqual(cell.language, 'python');
|
||||
});
|
||||
|
||||
test('Should set cell language to python if defined as pyspark in languageInfo', async function (): Promise<void> {
|
||||
let cellData: nb.ICellContents = {
|
||||
cell_type: CellTypes.Code,
|
||||
source: 'print(\'1\')',
|
||||
metadata: { language: 'python' },
|
||||
execution_count: 1
|
||||
};
|
||||
|
||||
let notebookModel = new NotebookModelStub({
|
||||
name: 'pyspark',
|
||||
version: '',
|
||||
mimetype: ''
|
||||
});
|
||||
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
|
||||
assert.strictEqual(cell.language, 'python');
|
||||
});
|
||||
|
||||
test('Should keep cell language as python if cell has language override', async function (): Promise<void> {
|
||||
let cellData: nb.ICellContents = {
|
||||
cell_type: CellTypes.Code,
|
||||
@@ -121,7 +104,7 @@ suite('Cell Model', function (): void {
|
||||
};
|
||||
|
||||
let notebookModel = new NotebookModelStub({
|
||||
name: 'scala',
|
||||
name: 'powershell',
|
||||
version: '',
|
||||
mimetype: ''
|
||||
});
|
||||
@@ -560,7 +543,7 @@ suite('Cell Model', function (): void {
|
||||
notebook: new NotebookModelStub({
|
||||
name: '',
|
||||
version: '',
|
||||
mimetype: 'x-scala'
|
||||
mimetype: ''
|
||||
}),
|
||||
isTrusted: false
|
||||
});
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
import * as assert from 'assert';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
|
||||
import { nb, ServerInfo } from 'azdata';
|
||||
import { getHostAndPortFromEndpoint, isStream, getProvidersForFileName, asyncForEach, clusterEndpointsProperty, getClusterEndpoints, RawEndpoint, IEndpoint, getStandardKernelsForProvider, IStandardKernelWithProvider, rewriteUrlUsingRegex } from 'sql/workbench/services/notebook/browser/models/notebookUtils';
|
||||
import { nb } from 'azdata';
|
||||
import { isStream, getProvidersForFileName, asyncForEach, getStandardKernelsForProvider, IStandardKernelWithProvider } from 'sql/workbench/services/notebook/browser/models/notebookUtils';
|
||||
import { INotebookService, DEFAULT_NOTEBOOK_PROVIDER, SQL_NOTEBOOK_PROVIDER } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { NotebookServiceStub } from 'sql/workbench/contrib/notebook/test/stubs';
|
||||
import { tryMatchCellMagic, extractCellMagicCommandPlusArgs } from 'sql/workbench/services/notebook/browser/utils';
|
||||
@@ -209,80 +209,6 @@ suite('notebookUtils', function (): void {
|
||||
await asyncForEach([1, 2, 3, 4], undefined);
|
||||
});
|
||||
|
||||
test('getClusterEndpoints Test', async function (): Promise<void> {
|
||||
let serverInfo = <ServerInfo>{
|
||||
options: {}
|
||||
};
|
||||
|
||||
serverInfo.options[clusterEndpointsProperty] = undefined;
|
||||
let result = getClusterEndpoints(serverInfo);
|
||||
assert.deepStrictEqual(result, []);
|
||||
|
||||
serverInfo.options[clusterEndpointsProperty] = [];
|
||||
result = getClusterEndpoints(serverInfo);
|
||||
assert.deepStrictEqual(result, []);
|
||||
|
||||
let testEndpoint = <RawEndpoint>{
|
||||
serviceName: 'testName',
|
||||
description: 'testDescription',
|
||||
endpoint: 'testEndpoint',
|
||||
protocol: 'testProtocol',
|
||||
ipAddress: 'testIpAddress',
|
||||
port: 1433
|
||||
};
|
||||
serverInfo.options[clusterEndpointsProperty] = [testEndpoint];
|
||||
result = getClusterEndpoints(serverInfo);
|
||||
assert.deepStrictEqual(result, [<IEndpoint>{
|
||||
serviceName: testEndpoint.serviceName,
|
||||
description: testEndpoint.description,
|
||||
endpoint: testEndpoint.endpoint,
|
||||
protocol: testEndpoint.protocol
|
||||
}]);
|
||||
|
||||
testEndpoint.endpoint = undefined;
|
||||
result = getClusterEndpoints(serverInfo);
|
||||
assert.deepStrictEqual(result, [<IEndpoint>{
|
||||
serviceName: testEndpoint.serviceName,
|
||||
description: testEndpoint.description,
|
||||
endpoint: 'https://testIpAddress:1433',
|
||||
protocol: testEndpoint.protocol
|
||||
}]);
|
||||
});
|
||||
|
||||
test('getHostAndPortFromEndpoint Test', async function (): Promise<void> {
|
||||
let result = getHostAndPortFromEndpoint('https://localhost:1433');
|
||||
assert.strictEqual(result.host, 'localhost');
|
||||
assert.strictEqual(result.port, '1433');
|
||||
|
||||
result = getHostAndPortFromEndpoint('tcp://localhost,12345');
|
||||
assert.strictEqual(result.host, 'localhost');
|
||||
assert.strictEqual(result.port, '12345');
|
||||
|
||||
result = getHostAndPortFromEndpoint('tcp://localhost');
|
||||
assert.strictEqual(result.host, 'localhost');
|
||||
assert.strictEqual(result.port, undefined);
|
||||
|
||||
result = getHostAndPortFromEndpoint('localhost');
|
||||
assert.strictEqual(result.host, '');
|
||||
assert.strictEqual(result.port, undefined);
|
||||
|
||||
result = getHostAndPortFromEndpoint('localhost:1433');
|
||||
assert.strictEqual(result.host, '');
|
||||
assert.strictEqual(result.port, undefined);
|
||||
});
|
||||
|
||||
test('rewriteUrlUsingRegex Test', async function (): Promise<void> {
|
||||
// Give a URL that should be rewritten
|
||||
let html = '<a target="_blank" href="https://sparkhead-0.sparkhead-svc:8090/proxy/application_1/“>Link</a>';
|
||||
let result = rewriteUrlUsingRegex(/(https?:\/\/sparkhead.*\/proxy)(.*)/g, html, '1.1.1.1', ':999', '/gateway/default/yarn/proxy');
|
||||
assert.strictEqual(result, '<a target="_blank" href="https://1.1.1.1:999/gateway/default/yarn/proxy/application_1/“>Link</a>', 'Target URL does not match after substitution');
|
||||
|
||||
// Give a URL that should not be rewritten
|
||||
html = '<a target="_blank" href="https://storage-0-0.storage-0-svc.mssql-cluster.svc.cluster.local:8044/node/containerlogs/container_7/root“>Link</a>';
|
||||
result = rewriteUrlUsingRegex(/(https?:\/\/sparkhead.*\/proxy)(.*)/g, html, '1.1.1.1', ':999', '/gateway/default/yarn/proxy');
|
||||
assert.strictEqual(result, '<a target="_blank" href="https://storage-0-0.storage-0-svc.mssql-cluster.svc.cluster.local:8044/node/containerlogs/container_7/root“>Link</a>', 'Target URL should not have been edited');
|
||||
});
|
||||
|
||||
test('EditStack test', async function (): Promise<void> {
|
||||
let maxStackSize = 200;
|
||||
let stack = new RichTextEditStack(maxStackSize);
|
||||
|
||||
Reference in New Issue
Block a user