mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Renable Strict TSLint (#5018)
* removes more builder references * remove builder from profiler * formatting * fix profiler dailog * remove builder from oatuhdialog * remove the rest of builder references * formatting * add more strict null checks to base * enable strict tslint rules * fix formatting * fix compile error * fix the rest of the hygeny issues and add pipeline step * fix pipeline files
This commit is contained in:
54
extensions/mssql/src/api/mssqlapis.d.ts
vendored
54
extensions/mssql/src/api/mssqlapis.d.ts
vendored
@@ -10,24 +10,17 @@ import * as vscode from 'vscode';
|
||||
|
||||
/**
|
||||
* The APIs provided by Mssql extension
|
||||
*
|
||||
* @export
|
||||
* @interface MssqlExtensionApi
|
||||
*/
|
||||
export interface MssqlExtensionApi {
|
||||
/**
|
||||
* Gets the object explorer API that supports querying over the connections supported by this extension
|
||||
*
|
||||
* @returns {IMssqlObjectExplorerBrowser}
|
||||
* @memberof IMssqlExtensionApi
|
||||
*/
|
||||
getMssqlObjectExplorerBrowser(): MssqlObjectExplorerBrowser;
|
||||
|
||||
/**
|
||||
* Get the Cms Service APIs to communicate with CMS connections supported by this extension
|
||||
*
|
||||
* @returns {Promise<CmsService>}
|
||||
* @memberof IMssqlExtensionApi
|
||||
*/
|
||||
getCmsServiceProvider(): Promise<CmsService>;
|
||||
}
|
||||
@@ -35,25 +28,16 @@ export interface MssqlExtensionApi {
|
||||
/**
|
||||
* A browser supporting actions over the object explorer connections provided by this extension.
|
||||
* Currently this is the
|
||||
*
|
||||
* @export
|
||||
* @interface MssqlObjectExplorerBrowser
|
||||
*/
|
||||
export interface MssqlObjectExplorerBrowser {
|
||||
/**
|
||||
* Gets the matching node given a context object, e.g. one from a right-click on a node in Object Explorer
|
||||
*
|
||||
* @param {azdata.ObjectExplorerContext} objectExplorerContext
|
||||
* @returns {Promise<T>}
|
||||
*/
|
||||
getNode<T extends ITreeNode>(objectExplorerContext: azdata.ObjectExplorerContext): Promise<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A tree node in the object explorer tree
|
||||
*
|
||||
* @export
|
||||
* @interface ITreeNode
|
||||
*/
|
||||
export interface ITreeNode {
|
||||
getNodeInfo(): azdata.NodeInfo;
|
||||
@@ -63,10 +47,6 @@ export interface ITreeNode {
|
||||
/**
|
||||
* A HDFS file node. This is a leaf node in the object explorer tree, and its contents
|
||||
* can be queried
|
||||
*
|
||||
* @export
|
||||
* @interface IFileNode
|
||||
* @extends {ITreeNode}
|
||||
*/
|
||||
export interface IFileNode extends ITreeNode {
|
||||
getFileContentsAsString(maxBytes?: number): Promise<string>;
|
||||
@@ -79,64 +59,31 @@ export interface IFileNode extends ITreeNode {
|
||||
export interface CmsService {
|
||||
/**
|
||||
* Connects to or creates a Central management Server
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {string} description
|
||||
* @param {azdata.ConnectionInfo} connectiondetails
|
||||
* @param {string} ownerUri
|
||||
* @returns {Thenable<azdata.ListRegisteredServersResult>}
|
||||
*/
|
||||
createCmsServer(name: string, description:string, connectiondetails: azdata.ConnectionInfo, ownerUri: string): Thenable<ListRegisteredServersResult>;
|
||||
|
||||
/**
|
||||
* gets all Registered Servers inside a CMS on a particular level
|
||||
*
|
||||
* @param {string} ownerUri
|
||||
* @param {string} relativePath
|
||||
* @returns {Thenable<azdata.ListRegisteredServersResult>}
|
||||
*/
|
||||
getRegisteredServers(ownerUri: string, relativePath: string): Thenable<ListRegisteredServersResult>;
|
||||
|
||||
/**
|
||||
* Adds a Registered Server inside a CMS on a particular level
|
||||
*
|
||||
* @param {string} ownerUri
|
||||
* @param {string} relativePath
|
||||
* @param {string} registeredServerName
|
||||
* @param {string} registeredServerDescription
|
||||
* @param {azdata.ConnectionInfo} connectiondetails
|
||||
* @returns {Thenable<boolean>>}
|
||||
*/
|
||||
addRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string, registeredServerDescription:string, connectionDetails:azdata.ConnectionInfo): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Removes a Registered Server inside a CMS on a particular level
|
||||
*
|
||||
* @param {string} ownerUri
|
||||
* @param {string} relativePath
|
||||
* @param {string} registeredServerName
|
||||
* @returns {Thenable<boolean>}
|
||||
*/
|
||||
removeRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Adds a Server Group inside a CMS on a particular level
|
||||
*
|
||||
* @param {string} ownerUri
|
||||
* @param {string} relativePath
|
||||
* @param {string} groupName
|
||||
* @param {string} groupDescription
|
||||
* @param {azdata.ConnectionInfo} connectiondetails
|
||||
*/
|
||||
addServerGroup (ownerUri: string, relativePath: string, groupName: string, groupDescription:string): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Removes a Server Group inside a CMS on a particular level
|
||||
*
|
||||
* @param {string} ownerUri
|
||||
* @param {string} relativePath
|
||||
* @param {string} groupName
|
||||
* @param {string} groupDescription
|
||||
*/
|
||||
removeServerGroup (ownerUri: string, relativePath: string, groupName: string): Thenable<boolean>;
|
||||
}
|
||||
@@ -162,4 +109,3 @@ export interface ListRegisteredServersResult {
|
||||
registeredServersList: Array<RegisteredServerResult>;
|
||||
registeredServerGroups: Array<RegisteredServerGroup>;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
@@ -13,7 +11,6 @@ import * as azdata from 'azdata';
|
||||
* this API from our code
|
||||
*
|
||||
* @export
|
||||
* @class ApiWrapper
|
||||
*/
|
||||
export class ApiWrapper {
|
||||
// Data APIs
|
||||
|
||||
@@ -20,9 +20,9 @@ export class CmsService {
|
||||
this.appContext.registerService<CmsService>(constants.CmsService, this);
|
||||
}
|
||||
|
||||
createCmsServer(name: string, description:string, connectiondetails: azdata.ConnectionInfo, ownerUri: string): Thenable<ListRegisteredServersResult> {
|
||||
createCmsServer(name: string, description: string, connectiondetails: azdata.ConnectionInfo, ownerUri: string): Thenable<ListRegisteredServersResult> {
|
||||
let connectparams: ConnectParams = { ownerUri: ownerUri, connection: connectiondetails };
|
||||
let cmsparams: contracts.CreateCentralManagementServerParams = { registeredServerName: name, registeredServerDescription: description, connectParams: connectparams};
|
||||
let cmsparams: contracts.CreateCentralManagementServerParams = { registeredServerName: name, registeredServerDescription: description, connectParams: connectparams };
|
||||
|
||||
return this.client.sendRequest(contracts.CreateCentralManagementServerRequest.type, cmsparams).then(
|
||||
r => {
|
||||
@@ -35,7 +35,7 @@ export class CmsService {
|
||||
);
|
||||
}
|
||||
|
||||
getRegisteredServers(ownerUri: string, relativePath: string): Thenable<ListRegisteredServersResult> {
|
||||
getRegisteredServers(ownerUri: string, relativePath: string): Thenable<ListRegisteredServersResult> {
|
||||
let params: contracts.ListRegisteredServersParams = { parentOwnerUri: ownerUri, relativePath: relativePath };
|
||||
return this.client.sendRequest(contracts.ListRegisteredServersRequest.type, params).then(
|
||||
r => {
|
||||
@@ -48,7 +48,7 @@ export class CmsService {
|
||||
);
|
||||
}
|
||||
|
||||
addRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string, registeredServerDescription:string, connectionDetails:azdata.ConnectionInfo): Thenable<boolean> {
|
||||
addRegisteredServer(ownerUri: string, relativePath: string, registeredServerName: string, registeredServerDescription: string, connectionDetails: azdata.ConnectionInfo): Thenable<boolean> {
|
||||
let params: contracts.AddRegisteredServerParams = { parentOwnerUri: ownerUri, relativePath: relativePath, registeredServerName: registeredServerName, registeredServerDescription: registeredServerDescription, registeredServerConnectionDetails: connectionDetails };
|
||||
return this.client.sendRequest(contracts.AddRegisteredServerRequest.type, params).then(
|
||||
r => {
|
||||
@@ -61,7 +61,7 @@ export class CmsService {
|
||||
);
|
||||
}
|
||||
|
||||
removeRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string): Thenable<boolean> {
|
||||
removeRegisteredServer(ownerUri: string, relativePath: string, registeredServerName: string): Thenable<boolean> {
|
||||
let params: contracts.RemoveRegisteredServerParams = { parentOwnerUri: ownerUri, relativePath: relativePath, registeredServerName: registeredServerName };
|
||||
return this.client.sendRequest(contracts.RemoveRegisteredServerRequest.type, params).then(
|
||||
r => {
|
||||
@@ -74,7 +74,7 @@ export class CmsService {
|
||||
);
|
||||
}
|
||||
|
||||
addServerGroup (ownerUri: string, relativePath: string, groupName: string, groupDescription:string): Thenable<boolean> {
|
||||
addServerGroup(ownerUri: string, relativePath: string, groupName: string, groupDescription: string): Thenable<boolean> {
|
||||
let params: contracts.AddServerGroupParams = { parentOwnerUri: ownerUri, relativePath: relativePath, groupName: groupName, groupDescription: groupDescription };
|
||||
return this.client.sendRequest(contracts.AddServerGroupRequest.type, params).then(
|
||||
r => {
|
||||
@@ -87,7 +87,7 @@ export class CmsService {
|
||||
);
|
||||
}
|
||||
|
||||
removeServerGroup (ownerUri: string, relativePath: string, groupName: string): Thenable<boolean> {
|
||||
removeServerGroup(ownerUri: string, relativePath: string, groupName: string): Thenable<boolean> {
|
||||
let params: contracts.RemoveServerGroupParams = { parentOwnerUri: ownerUri, relativePath: relativePath, groupName: groupName };
|
||||
return this.client.sendRequest(contracts.RemoveServerGroupRequest.type, params).then(
|
||||
r => {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { NotificationType, RequestType } from 'vscode-languageclient';
|
||||
import { ITelemetryEventProperties, ITelemetryEventMeasures } from './telemetry';
|
||||
@@ -377,37 +376,37 @@ export namespace GenerateDeployPlanRequest {
|
||||
|
||||
|
||||
export interface CreateCentralManagementServerParams {
|
||||
registeredServerName: string;
|
||||
registeredServerDescription : string;
|
||||
connectParams: ConnectParams;
|
||||
registeredServerName: string;
|
||||
registeredServerDescription: string;
|
||||
connectParams: ConnectParams;
|
||||
}
|
||||
|
||||
export interface ListRegisteredServersParams extends RegisteredServerParamsBase {
|
||||
// same as base
|
||||
// same as base
|
||||
}
|
||||
|
||||
export interface AddRegisteredServerParams extends RegisteredServerParamsBase {
|
||||
registeredServerName: string;
|
||||
registeredServerDescription : string;
|
||||
registeredServerConnectionDetails: azdata.ConnectionInfo;
|
||||
registeredServerName: string;
|
||||
registeredServerDescription: string;
|
||||
registeredServerConnectionDetails: azdata.ConnectionInfo;
|
||||
}
|
||||
|
||||
export interface RemoveRegisteredServerParams extends RegisteredServerParamsBase {
|
||||
registeredServerName: string;
|
||||
registeredServerName: string;
|
||||
}
|
||||
|
||||
export interface AddServerGroupParams extends RegisteredServerParamsBase {
|
||||
groupName: string;
|
||||
groupName: string;
|
||||
groupDescription: string;
|
||||
}
|
||||
|
||||
export interface RemoveServerGroupParams extends RegisteredServerParamsBase {
|
||||
groupName: string;
|
||||
groupName: string;
|
||||
}
|
||||
|
||||
export interface RegisteredServerParamsBase {
|
||||
parentOwnerUri: string;
|
||||
relativePath: string;
|
||||
parentOwnerUri: string;
|
||||
relativePath: string;
|
||||
}
|
||||
|
||||
export namespace CreateCentralManagementServerRequest {
|
||||
@@ -442,7 +441,7 @@ export interface SchemaCompareParams {
|
||||
taskExecutionMode: TaskExecutionMode;
|
||||
}
|
||||
|
||||
export interface SchemaCompareGenerateScriptParams {
|
||||
export interface SchemaCompareGenerateScriptParams {
|
||||
operationId: string;
|
||||
targetDatabaseName: string;
|
||||
scriptFilePath: string;
|
||||
@@ -453,7 +452,7 @@ export namespace SchemaCompareRequest {
|
||||
export const type = new RequestType<SchemaCompareParams, azdata.SchemaCompareResult, void, void>('schemaCompare/compare');
|
||||
}
|
||||
|
||||
export namespace SchemaCompareGenerateScriptRequest {
|
||||
export namespace SchemaCompareGenerateScriptRequest {
|
||||
export const type = new RequestType<SchemaCompareGenerateScriptParams, azdata.ResultStatus, void, void>('schemaCompare/generateScript');
|
||||
}
|
||||
// ------------------------------- <Schema Compare> -----------------------------
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
export default require('error-ex')('EscapeException');
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { SqlOpsDataClient, SqlOpsFeature } from 'dataprotocol-client';
|
||||
import { ClientCapabilities, StaticFeature, RPCMessageType, ServerCapabilities } from 'vscode-languageclient';
|
||||
@@ -12,7 +11,6 @@ import * as contracts from './contracts';
|
||||
import * as azdata from 'azdata';
|
||||
import * as Utils from './utils';
|
||||
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
|
||||
import { ConnectParams } from 'dataprotocol-client/lib/protocol';
|
||||
|
||||
export class TelemetryFeature implements StaticFeature {
|
||||
|
||||
@@ -170,7 +168,7 @@ export class SchemaCompareServicesFeature extends SqlOpsFeature<undefined> {
|
||||
let self = this;
|
||||
|
||||
let schemaCompare = (sourceEndpointInfo: azdata.SchemaCompareEndpointInfo, targetEndpointInfo: azdata.SchemaCompareEndpointInfo, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.SchemaCompareResult> => {
|
||||
let params: contracts.SchemaCompareParams = {sourceEndpointInfo: sourceEndpointInfo, targetEndpointInfo: targetEndpointInfo, taskExecutionMode: taskExecutionMode};
|
||||
let params: contracts.SchemaCompareParams = { sourceEndpointInfo: sourceEndpointInfo, targetEndpointInfo: targetEndpointInfo, taskExecutionMode: taskExecutionMode };
|
||||
return client.sendRequest(contracts.SchemaCompareRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
@@ -182,8 +180,8 @@ export class SchemaCompareServicesFeature extends SqlOpsFeature<undefined> {
|
||||
);
|
||||
};
|
||||
|
||||
let schemaCompareGenerateScript = (operationId: string, targetDatabaseName: string, scriptFilePath: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.DacFxResult> => {
|
||||
let params: contracts.SchemaCompareGenerateScriptParams = {operationId: operationId, targetDatabaseName: targetDatabaseName, scriptFilePath: scriptFilePath, taskExecutionMode: taskExecutionMode};
|
||||
let schemaCompareGenerateScript = (operationId: string, targetDatabaseName: string, scriptFilePath: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<azdata.DacFxResult> => {
|
||||
let params: contracts.SchemaCompareGenerateScriptParams = { operationId: operationId, targetDatabaseName: targetDatabaseName, scriptFilePath: scriptFilePath, taskExecutionMode: taskExecutionMode };
|
||||
return client.sendRequest(contracts.SchemaCompareGenerateScriptRequest.type, params).then(
|
||||
r => {
|
||||
return r;
|
||||
|
||||
@@ -24,4 +24,4 @@ export function sparkJobSubmissionYarnUIMessage(yarnUIURL: string): string { ret
|
||||
export function sparkJobSubmissionSparkHistoryLinkMessage(sparkHistoryLink: string): string { return localize('sparkJobSubmission_SparkHistoryLinkMessage', 'Spark History Url: {0} ', sparkHistoryLink); }
|
||||
export function sparkJobSubmissionGetApplicationIdFailed(err: string): string { return localize('sparkJobSubmission_GetApplicationIdFailed', 'Get Application Id Failed. {0}', err); }
|
||||
export function sparkJobSubmissionLocalFileNotExisted(path: string): string { return localize('sparkJobSubmission_LocalFileNotExisted', 'Local file {0} does not existed. ', path); }
|
||||
export const sparkJobSubmissionNoSqlBigDataClusterFound = localize('sparkJobSubmission_NoSqlBigDataClusterFound','No Sql Server Big Data Cluster found.');
|
||||
export const sparkJobSubmissionNoSqlBigDataClusterFound = localize('sparkJobSubmission_NoSqlBigDataClusterFound', 'No Sql Server Big Data Cluster found.');
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vscode-nls';
|
||||
@@ -74,7 +73,9 @@ export abstract class Command extends vscode.Disposable {
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.disposable && this.disposable.dispose();
|
||||
if (this.disposable) {
|
||||
this.disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected get apiWrapper(): ApiWrapper {
|
||||
|
||||
@@ -69,8 +69,8 @@ export class SqlClusterConnection {
|
||||
return FileSourceFactory.instance.createHdfsFileSource(options);
|
||||
}
|
||||
|
||||
public updatePassword(password : string): void{
|
||||
if(password){
|
||||
public updatePassword(password: string): void {
|
||||
if (password) {
|
||||
this._password = password;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ export class HdfsFileSource implements IFileSource {
|
||||
reject(error);
|
||||
} else {
|
||||
let hdfsFiles: IFile[] = files.map(file => {
|
||||
let hdfsFile = <IHdfsFileStatus> file;
|
||||
let hdfsFile = <IHdfsFileStatus>file;
|
||||
return new File(File.createPath(path, hdfsFile.pathSuffix), hdfsFile.type === 'DIRECTORY');
|
||||
});
|
||||
resolve(hdfsFiles);
|
||||
@@ -195,9 +195,9 @@ export class HdfsFileSource implements IFileSource {
|
||||
error = <HdfsError>err;
|
||||
if (error.message.includes('Stream exceeded specified max')) {
|
||||
// We have data > maxbytes, show we're truncating
|
||||
let previewNote: string = '#################################################################################################################### \r\n'+
|
||||
'########################### '+ localize('maxSizeNotice', "NOTICE: This file has been truncated at {0} for preview. ", bytes(maxBytes)) + '############################### \r\n' +
|
||||
'#################################################################################################################### \r\n';
|
||||
let previewNote: string = '#################################################################################################################### \r\n' +
|
||||
'########################### ' + localize('maxSizeNotice', "NOTICE: This file has been truncated at {0} for preview. ", bytes(maxBytes)) + '############################### \r\n' +
|
||||
'#################################################################################################################### \r\n';
|
||||
data.splice(0, 0, Buffer.from(previewNote, 'utf-8'));
|
||||
vscode.window.showWarningMessage(localize('maxSizeReached', "The file has been truncated at {0} for preview.", bytes(maxBytes)));
|
||||
resolve(Buffer.concat(data));
|
||||
@@ -236,15 +236,15 @@ export class HdfsFileSource implements IFileSource {
|
||||
lineReader.close();
|
||||
}
|
||||
})
|
||||
.on('error', (err) => {
|
||||
error = <HdfsError>err;
|
||||
reject(error);
|
||||
})
|
||||
.on('close', () => {
|
||||
if (!error) {
|
||||
resolve(Buffer.from(lineData.join(os.EOL)));
|
||||
}
|
||||
});
|
||||
.on('error', (err) => {
|
||||
error = <HdfsError>err;
|
||||
reject(error);
|
||||
})
|
||||
.on('close', () => {
|
||||
if (!error) {
|
||||
resolve(Buffer.from(lineData.join(os.EOL)));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ export class ErrorNode extends TreeNode {
|
||||
public static create(message: string, parent: TreeNode, errorCode?: number): ErrorNode {
|
||||
let node = new ErrorNode(message);
|
||||
node.parent = parent;
|
||||
if(errorCode){
|
||||
if (errorCode) {
|
||||
node.errorStatusCode = errorCode;
|
||||
}
|
||||
return node;
|
||||
|
||||
@@ -97,7 +97,7 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements azd
|
||||
}
|
||||
|
||||
private hasExpansionError(children: TreeNode[]): boolean {
|
||||
if(children.find(c => c.errorStatusCode > 0)){
|
||||
if (children.find(c => c.errorStatusCode > 0)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
|
||||
@@ -68,7 +68,7 @@ export abstract class TreeNode implements ITreeNode {
|
||||
if (children) {
|
||||
for (let child of children) {
|
||||
if (filter && filter(child)) {
|
||||
let childNode = await this.findNode(child, condition, filter, expandIfNeeded);
|
||||
let childNode = await this.findNode(child, condition, filter, expandIfNeeded);
|
||||
if (childNode) {
|
||||
return childNode;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export abstract class TreeNode implements ITreeNode {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public updateFileSource(connection: SqlClusterConnection): void{
|
||||
public updateFileSource(connection: SqlClusterConnection): void {
|
||||
this.fileSource = connection.createHdfsFileSource();
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,6 @@ import * as azdata from 'azdata';
|
||||
* A tree node in the object explorer tree
|
||||
*
|
||||
* @export
|
||||
* @interface ITreeNode
|
||||
*/
|
||||
export interface ITreeNode {
|
||||
getNodeInfo(): azdata.NodeInfo;
|
||||
@@ -22,9 +21,8 @@ export interface ITreeNode {
|
||||
* can be queried
|
||||
*
|
||||
* @export
|
||||
* @interface IFileNode
|
||||
* @extends {ITreeNode}
|
||||
*/
|
||||
export interface IFileNode extends ITreeNode {
|
||||
getFileContentsAsString(maxBytes?: number): Promise<string>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// This code is originally from https://github.com/harrisiirak/webhdfs
|
||||
// License: https://github.com/harrisiirak/webhdfs/blob/master/LICENSE
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as url from 'url';
|
||||
import * as fs from 'fs';
|
||||
import * as querystring from 'querystring';
|
||||
@@ -53,10 +51,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Generate WebHDFS REST API endpoint URL for given operation
|
||||
*
|
||||
* @param {string} operation WebHDFS operation name
|
||||
* @param {string} path
|
||||
* @param {object} params
|
||||
* @returns {string} WebHDFS REST API endpoint URL
|
||||
* @param operation WebHDFS operation name
|
||||
* @returns WebHDFS REST API endpoint URL
|
||||
*/
|
||||
private getOperationEndpoint(operation: string, path: string, params?: object): string {
|
||||
let endpoint = this._url;
|
||||
@@ -73,8 +69,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Gets localized status message for given status code
|
||||
*
|
||||
* @param {number} statusCode Http status code
|
||||
* @returns {string} status message
|
||||
* @param statusCode Http status code
|
||||
* @returns status message
|
||||
*/
|
||||
private toStatusMessage(statusCode: number): string {
|
||||
let statusMessage: string = undefined;
|
||||
@@ -93,9 +89,9 @@ export class WebHDFS {
|
||||
/**
|
||||
* Gets status message from response
|
||||
*
|
||||
* @param {request.Response} response response object
|
||||
* @param {boolean} strict If set true then RemoteException must be present in the body
|
||||
* @returns {string} Error message interpreted by status code
|
||||
* @param response response object
|
||||
* @param strict If set true then RemoteException must be present in the body
|
||||
* @returns Error message interpreted by status code
|
||||
*/
|
||||
private getStatusMessage(response: request.Response): string {
|
||||
if (!response) { return undefined; }
|
||||
@@ -107,8 +103,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Gets remote exception message from response body
|
||||
*
|
||||
* @param {any} responseBody response body
|
||||
* @returns {string} Error message interpreted by status code
|
||||
* @param responseBody response body
|
||||
* @returns Error message interpreted by status code
|
||||
*/
|
||||
private getRemoteExceptionMessage(responseBody: any): string {
|
||||
if (!responseBody) { return undefined; }
|
||||
@@ -128,10 +124,10 @@ export class WebHDFS {
|
||||
/**
|
||||
* Generates error message descriptive as much as possible
|
||||
*
|
||||
* @param {string} statusMessage status message
|
||||
* @param {string} [remoteExceptionMessage] remote exception message
|
||||
* @param {any} [error] error
|
||||
* @returns {string} error message
|
||||
* @param statusMessage status message
|
||||
* @param [remoteExceptionMessage] remote exception message
|
||||
* @param [error] error
|
||||
* @returns error message
|
||||
*/
|
||||
private getErrorMessage(statusMessage: string, remoteExceptionMessage?: string, error?: any): string {
|
||||
statusMessage = statusMessage === '' ? undefined : statusMessage;
|
||||
@@ -140,16 +136,16 @@ export class WebHDFS {
|
||||
return statusMessage && remoteExceptionMessage ?
|
||||
`${statusMessage} (${remoteExceptionMessage})` :
|
||||
statusMessage || remoteExceptionMessage || messageFromError ||
|
||||
localize('webhdfs.unknownError', 'Unknown Error');
|
||||
localize('webhdfs.unknownError', 'Unknown Error');
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse error state from response and return valid Error object
|
||||
*
|
||||
* @param {request.Response} response response object
|
||||
* @param {any} [responseBody] response body
|
||||
* @param {any} [error] error
|
||||
* @returns {HdfsError} HdfsError object
|
||||
* @param response response object
|
||||
* @param [responseBody] response body
|
||||
* @param [error] error
|
||||
* @returns HdfsError object
|
||||
*/
|
||||
private parseError(response: request.Response, responseBody?: any, error?: any): HdfsError {
|
||||
let statusMessage: string = this.getStatusMessage(response);
|
||||
@@ -165,8 +161,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Check if response is redirect
|
||||
*
|
||||
* @param {request.Response} response response object
|
||||
* @returns {boolean} if response is redirect
|
||||
* @param response response object
|
||||
* @returns if response is redirect
|
||||
*/
|
||||
private isRedirect(response: request.Response): boolean {
|
||||
return [301, 307].indexOf(response.statusCode) !== -1 &&
|
||||
@@ -176,8 +172,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Check if response is successful
|
||||
*
|
||||
* @param {request.Response} response response object
|
||||
* @returns {boolean} if response is successful
|
||||
* @param response response object
|
||||
* @returns if response is successful
|
||||
*/
|
||||
private isSuccess(response: request.Response): boolean {
|
||||
return [200, 201].indexOf(response.statusCode) !== -1;
|
||||
@@ -186,8 +182,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Check if response is error
|
||||
*
|
||||
* @param {request.Response} response response object
|
||||
* @returns {boolean} if response is error
|
||||
* @param response response object
|
||||
* @returns if response is error
|
||||
*/
|
||||
private isError(response: request.Response): boolean {
|
||||
return [400, 401, 402, 403, 404, 500].indexOf(response.statusCode) !== -1;
|
||||
@@ -196,10 +192,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Send a request to WebHDFS REST API
|
||||
*
|
||||
* @param {string} method HTTP method
|
||||
* @param {string} url
|
||||
* @param {object} opts Options for request
|
||||
* @param {(error: HdfsError, response: request.Response) => void} callback
|
||||
* @param method HTTP method
|
||||
* @param opts Options for request
|
||||
* @returns void
|
||||
*/
|
||||
private sendRequest(method: string, url: string, opts: object,
|
||||
@@ -234,10 +228,6 @@ export class WebHDFS {
|
||||
|
||||
/**
|
||||
* Change file permissions
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {string} mode
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public chmod(path: string, mode: string, callback: (error: HdfsError) => void): void {
|
||||
@@ -253,10 +243,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Change file owner
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {string} userId User name
|
||||
* @param {string} groupId Group name
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @param userId User name
|
||||
* @param groupId Group name
|
||||
* @returns void
|
||||
*/
|
||||
public chown(path: string, userId: string, groupId: string, callback: (error: HdfsError) => void): void {
|
||||
@@ -279,8 +267,6 @@ export class WebHDFS {
|
||||
/**
|
||||
* Read directory contents
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {(error: HdfsError, files: any[]) => void)} callback
|
||||
* @returns void
|
||||
*/
|
||||
public readdir(path: string, callback: (error: HdfsError, files: any[]) => void): void {
|
||||
@@ -305,10 +291,6 @@ export class WebHDFS {
|
||||
|
||||
/**
|
||||
* Make new directory
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {string} [permission=0755]
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public mkdir(path: string, permission: string = '0755', callback: (error: HdfsError) => void): void {
|
||||
@@ -327,10 +309,6 @@ export class WebHDFS {
|
||||
|
||||
/**
|
||||
* Rename path
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {string} destination
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public rename(path: string, destination: string, callback: (error: HdfsError) => void): void {
|
||||
@@ -350,9 +328,6 @@ export class WebHDFS {
|
||||
|
||||
/**
|
||||
* Get file status for given path
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {(error: HdfsError, fileStatus: any) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public stat(path: string, callback: (error: HdfsError, fileStatus: any) => void): void {
|
||||
@@ -376,8 +351,6 @@ export class WebHDFS {
|
||||
* Wraps stat method
|
||||
*
|
||||
* @see WebHDFS.stat
|
||||
* @param {string} path
|
||||
* @param {(error: HdfsError, exists: boolean) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public exists(path: string, callback: (error: HdfsError, exists: boolean) => void): void {
|
||||
@@ -392,12 +365,7 @@ export class WebHDFS {
|
||||
/**
|
||||
* Write data to the file
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {string | Buffer} data
|
||||
* @param {boolean} append If set to true then append data to the file
|
||||
* @param {object} opts
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns {fs.WriteStream}
|
||||
* @param append If set to true then append data to the file
|
||||
*/
|
||||
public writeFile(path: string, data: string | Buffer, append: boolean, opts: object,
|
||||
callback: (error: HdfsError) => void): fs.WriteStream {
|
||||
@@ -427,11 +395,6 @@ export class WebHDFS {
|
||||
* Append data to the file
|
||||
*
|
||||
* @see writeFile
|
||||
* @param {string} path
|
||||
* @param {string | Buffer} data
|
||||
* @param {object} opts
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns {fs.WriteStream}
|
||||
*/
|
||||
public appendFile(path: string, data: string | Buffer, opts: object, callback: (error: HdfsError) => void): fs.WriteStream {
|
||||
return this.writeFile(path, data, true, opts, callback);
|
||||
@@ -442,8 +405,6 @@ export class WebHDFS {
|
||||
*
|
||||
* @fires Request#data
|
||||
* @fires WebHDFS#finish
|
||||
* @param {path} path
|
||||
* @param {(error: HdfsError, buffer: Buffer) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public readFile(path: string, callback: (error: HdfsError, buffer: Buffer) => void): void {
|
||||
@@ -475,10 +436,7 @@ export class WebHDFS {
|
||||
* Create writable stream for given path
|
||||
*
|
||||
* @fires WebHDFS#finish
|
||||
* @param {string} path
|
||||
* @param {boolean} [append] If set to true then append data to the file
|
||||
* @param {object} [opts]
|
||||
* @returns {fs.WriteStream}
|
||||
* @param [append] If set to true then append data to the file
|
||||
*
|
||||
* @example
|
||||
* let hdfs = WebHDFS.createClient();
|
||||
@@ -593,9 +551,6 @@ export class WebHDFS {
|
||||
*
|
||||
* @fires Request#data
|
||||
* @fires WebHDFS#finish
|
||||
* @param {string} path
|
||||
* @param {object} [opts]
|
||||
* @returns {fs.ReadStream}
|
||||
*
|
||||
* @example
|
||||
* let hdfs = WebHDFS.createClient();
|
||||
@@ -677,10 +632,6 @@ export class WebHDFS {
|
||||
/**
|
||||
* Create symbolic link to the destination path
|
||||
*
|
||||
* @param {string} src
|
||||
* @param {string} destination
|
||||
* @param {boolean} [createParent=false]
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public symlink(src: string, destination: string, createParent: boolean = false, callback: (error: HdfsError) => void): void {
|
||||
@@ -702,9 +653,6 @@ export class WebHDFS {
|
||||
/**
|
||||
* Unlink path
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {boolean} [recursive=false]
|
||||
* @param {(error: any) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public unlink(path: string, recursive: boolean = false, callback: (error: HdfsError) => void): void {
|
||||
@@ -720,9 +668,6 @@ export class WebHDFS {
|
||||
|
||||
/**
|
||||
* @alias WebHDFS.unlink
|
||||
* @param {string} path
|
||||
* @param {boolean} [recursive=false]
|
||||
* @param {(error: any) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public rmdir(path: string, recursive: boolean = false, callback: (error: HdfsError) => void): void {
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ProgressIndicator {
|
||||
|
||||
constructor() {
|
||||
this._statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left);
|
||||
}
|
||||
}
|
||||
|
||||
private _tasks: string[] = [];
|
||||
public beginTask(task: string): void {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
|
||||
'use strict';
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import vscode = require('vscode');
|
||||
|
||||
@@ -56,7 +58,7 @@ export interface IPrompter {
|
||||
/**
|
||||
* Prompts for multiple questions
|
||||
*
|
||||
* @returns {[questionId: string]: T} Map of question IDs to results, or undefined if
|
||||
* @returns Map of question IDs to results, or undefined if
|
||||
* the user canceled the question session
|
||||
*/
|
||||
prompt<T>(questions: IQuestion[], ignoreFocusOut?: boolean): Promise<{ [questionId: string]: any }>;
|
||||
|
||||
@@ -18,9 +18,8 @@ export class OpenSparkYarnHistoryTask {
|
||||
async execute(sqlConnProfile: azdata.IConnectionProfile, isSpark: boolean): Promise<void> {
|
||||
try {
|
||||
let sqlClusterConnection = SqlClusterLookUp.findSqlClusterConnection(sqlConnProfile, this.appContext);
|
||||
if (!sqlClusterConnection)
|
||||
{
|
||||
let name = isSpark? 'Spark' : 'Yarn';
|
||||
if (!sqlClusterConnection) {
|
||||
let name = isSpark ? 'Spark' : 'Yarn';
|
||||
this.appContext.apiWrapper.showErrorMessage(`Please connect to the Spark cluster before View ${name} History.`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as childProcess from 'child_process';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as nls from 'vscode-nls';
|
||||
@@ -17,7 +15,7 @@ import * as Constants from '../constants';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export function getDropdownValue(dropdownValue: string | azdata.CategoryValue): string {
|
||||
if (typeof(dropdownValue) === 'string') {
|
||||
if (typeof (dropdownValue) === 'string') {
|
||||
return <string>dropdownValue;
|
||||
} else {
|
||||
return dropdownValue ? (<azdata.CategoryValue>dropdownValue).name : undefined;
|
||||
@@ -170,7 +168,7 @@ export function getOSPlatform(): Platform {
|
||||
}
|
||||
|
||||
export function getOSPlatformId(): string {
|
||||
var platformId = undefined;
|
||||
let platformId = undefined;
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
platformId = 'win-x64';
|
||||
|
||||
@@ -17,7 +17,7 @@ import { MssqlObjectExplorerNodeProvider } from './objectExplorerNodeProvider/ob
|
||||
|
||||
export function findSqlClusterConnection(
|
||||
obj: ICommandObjectExplorerContext | azdata.IConnectionProfile,
|
||||
appContext: AppContext) : SqlClusterConnection {
|
||||
appContext: AppContext): SqlClusterConnection {
|
||||
|
||||
if (!obj || !appContext) { return undefined; }
|
||||
|
||||
@@ -45,7 +45,7 @@ function findSqlClusterConnectionBySqlConnProfile(sqlConnProfile: azdata.IConnec
|
||||
let sqlClusterSession = sqlOeNodeProvider.findSqlClusterSessionBySqlConnProfile(sqlConnProfile);
|
||||
if (!sqlClusterSession) { return undefined; }
|
||||
|
||||
return sqlClusterSession.sqlClusterConnection;
|
||||
return sqlClusterSession.sqlClusterConnection;
|
||||
}
|
||||
|
||||
export async function getSqlClusterConnection(
|
||||
@@ -123,8 +123,7 @@ function connToConnectionParam(connection: azdata.connection.Connection): Connec
|
||||
return <ConnectionParam>result;
|
||||
}
|
||||
|
||||
class ConnectionParam implements azdata.connection.Connection, azdata.IConnectionProfile, azdata.ConnectionInfo
|
||||
{
|
||||
class ConnectionParam implements azdata.connection.Connection, azdata.IConnectionProfile, azdata.ConnectionInfo {
|
||||
public connectionName: string;
|
||||
public serverName: string;
|
||||
public databaseName: string;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import * as vscode from 'vscode';
|
||||
import * as opener from 'opener';
|
||||
import TelemetryReporter from 'vscode-extension-telemetry';
|
||||
@@ -138,7 +137,6 @@ export class Telemetry {
|
||||
|
||||
/**
|
||||
* Handle Language Service client errors
|
||||
* @class LanguageClientErrorHandler
|
||||
*/
|
||||
export class LanguageClientErrorHandler implements ErrorHandler {
|
||||
|
||||
@@ -160,11 +158,6 @@ export class LanguageClientErrorHandler implements ErrorHandler {
|
||||
/**
|
||||
* Callback for language service client error
|
||||
*
|
||||
* @param {Error} error
|
||||
* @param {Message} message
|
||||
* @param {number} count
|
||||
* @returns {ErrorAction}
|
||||
*
|
||||
* @memberOf LanguageClientErrorHandler
|
||||
*/
|
||||
error(error: Error, message: Message, count: number): ErrorAction {
|
||||
@@ -178,8 +171,6 @@ export class LanguageClientErrorHandler implements ErrorHandler {
|
||||
/**
|
||||
* Callback for language service client closed
|
||||
*
|
||||
* @returns {CloseAction}
|
||||
*
|
||||
* @memberOf LanguageClientErrorHandler
|
||||
*/
|
||||
closed(): CloseAction {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
@@ -163,7 +162,7 @@ export function generateGuid(): string {
|
||||
}
|
||||
|
||||
export function verifyPlatform(): Thenable<boolean> {
|
||||
if (os.platform() === 'darwin' && parseFloat(os.release()) < 16.0) {
|
||||
if (os.platform() === 'darwin' && parseFloat(os.release()) < 16) {
|
||||
return Promise.resolve(false);
|
||||
} else {
|
||||
return Promise.resolve(true);
|
||||
|
||||
Reference in New Issue
Block a user