mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Clean up some of the extensions (#8267)
* 💄
* prune unused code
* more cleanup
* remove abunch of used code
This commit is contained in:
@@ -74,6 +74,7 @@
|
|||||||
"vscode-nls": "^3.2.1"
|
"vscode-nls": "^3.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/node": "10",
|
||||||
"mocha-junit-reporter": "^1.17.0",
|
"mocha-junit-reporter": "^1.17.0",
|
||||||
"mocha-multi-reporters": "^1.1.7",
|
"mocha-multi-reporters": "^1.1.7",
|
||||||
"should": "^13.2.3",
|
"should": "^13.2.3",
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
"@types/node@10":
|
||||||
|
version "10.17.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.4.tgz#8993a4fe3c4022fda66bf4ea660d615fc5659c6f"
|
||||||
|
integrity sha512-F2pgg+LcIr/elguz+x+fdBX5KeZXGUOp7TV8M0TVIrDezYLFRNt8oMTyps0VQ1kj5WGGoR18RdxnRDHXrIFHMQ==
|
||||||
|
|
||||||
"ads-extension-telemetry@github:Charles-Gagnon/ads-extension-telemetry#0.1.0":
|
"ads-extension-telemetry@github:Charles-Gagnon/ads-extension-telemetry#0.1.0":
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://codeload.github.com/Charles-Gagnon/ads-extension-telemetry/tar.gz/70c2fea10e9ff6e329c4c5ec0b77017ada514b6d"
|
resolved "https://codeload.github.com/Charles-Gagnon/ads-extension-telemetry/tar.gz/70c2fea10e9ff6e329c4c5ec0b77017ada514b6d"
|
||||||
|
|||||||
@@ -1,61 +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 * as vscode from 'vscode';
|
|
||||||
import * as data from 'azdata';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wrapper class to act as a facade over VSCode and Data APIs and allow us to test / mock callbacks into
|
|
||||||
* this API from our code
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
*/
|
|
||||||
export class ApiWrapper {
|
|
||||||
// Data APIs
|
|
||||||
|
|
||||||
public registerWebviewProvider(widgetId: string, handler: (webview: data.DashboardWebview) => void): void {
|
|
||||||
return data.dashboard.registerWebviewProvider(widgetId, handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public registerControlHostProvider(widgetId: string, handler: (webview: data.DashboardWebview) => void): void {
|
|
||||||
return data.dashboard.registerWebviewProvider(widgetId, handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the configuration for a extensionName
|
|
||||||
* @param extensionName The string name of the extension to get the configuration for
|
|
||||||
* @param resource The optional URI, as a URI object or a string, to use to get resource-scoped configurations
|
|
||||||
*/
|
|
||||||
public getConfiguration(extensionName: string, resource?: vscode.Uri | string): vscode.WorkspaceConfiguration {
|
|
||||||
if (typeof resource === 'string') {
|
|
||||||
try {
|
|
||||||
resource = this.parseUri(resource);
|
|
||||||
} catch (e) {
|
|
||||||
resource = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return vscode.workspace.getConfiguration(extensionName, resource as vscode.Uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse uri
|
|
||||||
*/
|
|
||||||
public parseUri(uri: string): vscode.Uri {
|
|
||||||
return vscode.Uri.parse(uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
public showOpenDialog(options: vscode.OpenDialogOptions): Thenable<vscode.Uri[] | undefined> {
|
|
||||||
return vscode.window.showOpenDialog(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
public showErrorMessage(message: string, ...items: string[]): Thenable<string | undefined> {
|
|
||||||
return vscode.window.showErrorMessage(message, ...items);
|
|
||||||
}
|
|
||||||
|
|
||||||
public get workspaceRootPath(): string {
|
|
||||||
return vscode.workspace.rootPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +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 * as azdata from 'azdata';
|
|
||||||
import { AgentUtils } from '../agentUtils';
|
|
||||||
import { IAgentDialogData, AgentDialogMode } from '../interfaces';
|
|
||||||
|
|
||||||
export class ScheduleData implements IAgentDialogData {
|
|
||||||
public dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
|
|
||||||
public ownerUri: string;
|
|
||||||
public schedules: azdata.AgentJobScheduleInfo[];
|
|
||||||
public selectedSchedule: azdata.AgentJobScheduleInfo;
|
|
||||||
|
|
||||||
constructor(ownerUri: string) {
|
|
||||||
this.ownerUri = ownerUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async initialize() {
|
|
||||||
let agentService = await AgentUtils.getAgentService();
|
|
||||||
let result = await agentService.getJobSchedules(this.ownerUri);
|
|
||||||
if (result && result.success) {
|
|
||||||
this.schedules = result.schedules;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async save() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,94 +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 * as nls from 'vscode-nls';
|
|
||||||
import * as azdata from 'azdata';
|
|
||||||
import * as vscode from 'vscode';
|
|
||||||
import { ScheduleData } from '../data/scheduleData';
|
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
|
||||||
|
|
||||||
export class ScheduleDialog {
|
|
||||||
|
|
||||||
// Top level
|
|
||||||
private readonly DialogTitle: string = localize('scheduleDialog.newSchedule', "New Schedule");
|
|
||||||
private readonly OkButtonText: string = localize('scheduleDialog.ok', "OK");
|
|
||||||
private readonly CancelButtonText: string = localize('scheduleDialog.cancel', "Cancel");
|
|
||||||
private readonly ScheduleNameText: string = localize('scheduleDialog.scheduleName', "Schedule Name");
|
|
||||||
private readonly SchedulesLabelText: string = localize('scheduleDialog.schedules', "Schedules");
|
|
||||||
|
|
||||||
// UI Components
|
|
||||||
private dialog: azdata.window.Dialog;
|
|
||||||
private schedulesTable: azdata.TableComponent;
|
|
||||||
|
|
||||||
private model: ScheduleData;
|
|
||||||
|
|
||||||
private _onSuccess: vscode.EventEmitter<ScheduleData> = new vscode.EventEmitter<ScheduleData>();
|
|
||||||
public readonly onSuccess: vscode.Event<ScheduleData> = this._onSuccess.event;
|
|
||||||
|
|
||||||
constructor(ownerUri: string) {
|
|
||||||
this.model = new ScheduleData(ownerUri);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async showDialog() {
|
|
||||||
await this.model.initialize();
|
|
||||||
this.dialog = azdata.window.createModelViewDialog(this.DialogTitle);
|
|
||||||
this.initializeContent();
|
|
||||||
this.dialog.okButton.onClick(async () => await this.execute());
|
|
||||||
this.dialog.cancelButton.onClick(async () => await this.cancel());
|
|
||||||
this.dialog.okButton.label = this.OkButtonText;
|
|
||||||
this.dialog.cancelButton.label = this.CancelButtonText;
|
|
||||||
|
|
||||||
azdata.window.openDialog(this.dialog);
|
|
||||||
}
|
|
||||||
|
|
||||||
private initializeContent() {
|
|
||||||
this.dialog.registerContent(async view => {
|
|
||||||
this.schedulesTable = view.modelBuilder.table()
|
|
||||||
.withProperties({
|
|
||||||
columns: [
|
|
||||||
this.ScheduleNameText
|
|
||||||
],
|
|
||||||
data: [],
|
|
||||||
height: 600,
|
|
||||||
width: 400
|
|
||||||
}).component();
|
|
||||||
|
|
||||||
let formModel = view.modelBuilder.formContainer()
|
|
||||||
.withFormItems([{
|
|
||||||
component: this.schedulesTable,
|
|
||||||
title: this.SchedulesLabelText
|
|
||||||
}]).withLayout({ width: '100%' }).component();
|
|
||||||
|
|
||||||
await view.initializeModel(formModel);
|
|
||||||
|
|
||||||
if (this.model.schedules) {
|
|
||||||
let data: any[][] = [];
|
|
||||||
for (let i = 0; i < this.model.schedules.length; ++i) {
|
|
||||||
let schedule = this.model.schedules[i];
|
|
||||||
data[i] = [schedule.name];
|
|
||||||
}
|
|
||||||
this.schedulesTable.data = data;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async execute() {
|
|
||||||
this.updateModel();
|
|
||||||
await this.model.save();
|
|
||||||
this._onSuccess.fire(this.model);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async cancel() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private updateModel() {
|
|
||||||
let selectedRows = this.schedulesTable.selectedRows;
|
|
||||||
if (selectedRows && selectedRows.length > 0) {
|
|
||||||
let selectedRow = selectedRows[0];
|
|
||||||
this.model.selectedSchedule = this.model.schedules[selectedRow];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,11 +2,10 @@
|
|||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import vscode = require('vscode');
|
import * as vscode from 'vscode';
|
||||||
import { MainController } from './mainController';
|
import { MainController } from './mainController';
|
||||||
export let controller: MainController;
|
let controller: MainController;
|
||||||
|
|
||||||
export function activate(context: vscode.ExtensionContext) {
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
controller = new MainController(context);
|
controller = new MainController(context);
|
||||||
|
|||||||
@@ -25,12 +25,13 @@ const localize = nls.loadMessageBundle();
|
|||||||
/**
|
/**
|
||||||
* The main controller class that initializes the extension
|
* The main controller class that initializes the extension
|
||||||
*/
|
*/
|
||||||
export class TemplateMapObject {
|
class TemplateMapObject {
|
||||||
notebookInfo: azdata.AgentNotebookInfo;
|
notebookInfo: azdata.AgentNotebookInfo;
|
||||||
fileUri: vscode.Uri;
|
fileUri: vscode.Uri;
|
||||||
tempPath: string;
|
tempPath: string;
|
||||||
ownerUri: string;
|
ownerUri: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MainController {
|
export class MainController {
|
||||||
|
|
||||||
protected _context: vscode.ExtensionContext;
|
protected _context: vscode.ExtensionContext;
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +28,7 @@ export interface Tenant {
|
|||||||
/**
|
/**
|
||||||
* Represents a resource exposed by an Azure Active Directory
|
* Represents a resource exposed by an Azure Active Directory
|
||||||
*/
|
*/
|
||||||
export interface Resource {
|
interface Resource {
|
||||||
/**
|
/**
|
||||||
* Identifier of the resource
|
* Identifier of the resource
|
||||||
*/
|
*/
|
||||||
@@ -42,25 +40,10 @@ export interface Resource {
|
|||||||
endpoint: string;
|
endpoint: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the arguments that identify an instantiation of the AAD account provider
|
|
||||||
*/
|
|
||||||
export interface Arguments {
|
|
||||||
/**
|
|
||||||
* Host of the authority
|
|
||||||
*/
|
|
||||||
host: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Identifier of the client application
|
|
||||||
*/
|
|
||||||
clientId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents settings for an AAD account provider
|
* Represents settings for an AAD account provider
|
||||||
*/
|
*/
|
||||||
export interface Settings {
|
interface Settings {
|
||||||
/**
|
/**
|
||||||
* Host of the authority
|
* Host of the authority
|
||||||
*/
|
*/
|
||||||
@@ -138,7 +121,7 @@ export interface AzureAccountProviderMetadata extends azdata.AccountProviderMeta
|
|||||||
/**
|
/**
|
||||||
* Properties specific to an Azure account
|
* Properties specific to an Azure account
|
||||||
*/
|
*/
|
||||||
export interface AzureAccountProperties {
|
interface AzureAccountProperties {
|
||||||
/**
|
/**
|
||||||
* Whether or not the account is a Microsoft account
|
* Whether or not the account is a Microsoft account
|
||||||
*/
|
*/
|
||||||
@@ -163,7 +146,7 @@ export interface AzureAccount extends azdata.Account {
|
|||||||
/**
|
/**
|
||||||
* Token returned from a request for an access token
|
* Token returned from a request for an access token
|
||||||
*/
|
*/
|
||||||
export interface AzureAccountSecurityToken {
|
interface AzureAccountSecurityToken {
|
||||||
/**
|
/**
|
||||||
* Access token, itself
|
* Access token, itself
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase'
|
|||||||
import { AzureResourceDatabaseServer } from '../../interfaces';
|
import { AzureResourceDatabaseServer } from '../../interfaces';
|
||||||
|
|
||||||
|
|
||||||
export interface DbServerGraphData extends GraphData {
|
interface DbServerGraphData extends GraphData {
|
||||||
properties: {
|
properties: {
|
||||||
fullyQualifiedDomainName: string;
|
fullyQualifiedDomainName: string;
|
||||||
administratorLogin: string;
|
administratorLogin: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const serversQuery = 'where type == "microsoft.dbforpostgresql/servers"';
|
const serversQuery = 'where type == "microsoft.dbforpostgresql/servers"';
|
||||||
|
|
||||||
export class PostgresServerService extends ResourceServiceBase<DbServerGraphData, AzureResourceDatabaseServer> {
|
export class PostgresServerService extends ResourceServiceBase<DbServerGraphData, AzureResourceDatabaseServer> {
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import { AzureResourceDatabaseServer } from '../../interfaces';
|
import { AzureResourceDatabaseServer } from '../../interfaces';
|
||||||
import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase';
|
import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase';
|
||||||
|
|
||||||
export interface SqlInstanceGraphData extends GraphData {
|
interface SqlInstanceGraphData extends GraphData {
|
||||||
properties: {
|
properties: {
|
||||||
fullyQualifiedDomainName: string;
|
fullyQualifiedDomainName: string;
|
||||||
administratorLogin: string;
|
administratorLogin: string;
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { AppContext } from '../../appContext';
|
import { AppContext } from '../../appContext';
|
||||||
|
|
||||||
import { TreeNode } from '../treeNode';
|
import { TreeNode } from '../treeNode';
|
||||||
@@ -12,7 +10,7 @@ import { IAzureResourceTreeChangeHandler } from './treeChangeHandler';
|
|||||||
import { IAzureResourceCacheService } from '../../azureResource/interfaces';
|
import { IAzureResourceCacheService } from '../../azureResource/interfaces';
|
||||||
import { AzureResourceServiceNames } from '../constants';
|
import { AzureResourceServiceNames } from '../constants';
|
||||||
|
|
||||||
export abstract class AzureResourceTreeNodeBase extends TreeNode {
|
abstract class AzureResourceTreeNodeBase extends TreeNode {
|
||||||
public constructor(
|
public constructor(
|
||||||
public readonly appContext: AppContext,
|
public readonly appContext: AppContext,
|
||||||
public readonly treeChangeHandler: IAzureResourceTreeChangeHandler,
|
public readonly treeChangeHandler: IAzureResourceTreeChangeHandler,
|
||||||
|
|||||||
@@ -3,12 +3,10 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
export function getErrorMessage(error: Error | string): string {
|
function getErrorMessage(error: Error | string): string {
|
||||||
return (error instanceof Error) ? error.message : error;
|
return (error instanceof Error) ? error.message : error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ let extensionContext: vscode.ExtensionContext;
|
|||||||
|
|
||||||
// The function is a duplicate of \src\paths.js. IT would be better to import path.js but it doesn't
|
// The function is a duplicate of \src\paths.js. IT would be better to import path.js but it doesn't
|
||||||
// work for now because the extension is running in different process.
|
// work for now because the extension is running in different process.
|
||||||
export function getAppDataPath() {
|
function getAppDataPath() {
|
||||||
let platform = process.platform;
|
let platform = process.platform;
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'win32': return process.env['APPDATA'] || path.join(process.env['USERPROFILE'], 'AppData', 'Roaming');
|
case 'win32': return process.env['APPDATA'] || path.join(process.env['USERPROFILE'], 'AppData', 'Roaming');
|
||||||
@@ -46,7 +46,7 @@ export function getAppDataPath() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDefaultLogLocation() {
|
function getDefaultLogLocation() {
|
||||||
return path.join(getAppDataPath(), 'azuredatastudio');
|
return path.join(getAppDataPath(), 'azuredatastudio');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,4 +132,3 @@ function registerAzureServices(appContext: AppContext): void {
|
|||||||
appContext.registerService<IAzureResourceSubscriptionFilterService>(AzureResourceServiceNames.subscriptionFilterService, new AzureResourceSubscriptionFilterService(new AzureResourceCacheService(extensionContext)));
|
appContext.registerService<IAzureResourceSubscriptionFilterService>(AzureResourceServiceNames.subscriptionFilterService, new AzureResourceSubscriptionFilterService(new AzureResourceCacheService(extensionContext)));
|
||||||
appContext.registerService<IAzureResourceTenantService>(AzureResourceServiceNames.tenantService, new AzureResourceTenantService());
|
appContext.registerService<IAzureResourceTenantService>(AzureResourceServiceNames.tenantService, new AzureResourceTenantService());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export async function authenticateKerberos(hostname: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export type HostAndIp = { host: string, port: string };
|
type HostAndIp = { host: string, port: string };
|
||||||
|
|
||||||
export function getHostAndPortFromEndpoint(endpoint: string): HostAndIp {
|
export function getHostAndPortFromEndpoint(endpoint: string): HostAndIp {
|
||||||
let authority = vscode.Uri.parse(endpoint).authority;
|
let authority = vscode.Uri.parse(endpoint).authority;
|
||||||
@@ -32,4 +32,3 @@ export function getHostAndPortFromEndpoint(endpoint: string): HostAndIp {
|
|||||||
port: undefined
|
port: undefined
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import * as nls from 'vscode-nls';
|
|||||||
import { ClusterController, ControllerError } from '../controller/clusterControllerApi';
|
import { ClusterController, ControllerError } from '../controller/clusterControllerApi';
|
||||||
import { ControllerTreeDataProvider } from '../tree/controllerTreeDataProvider';
|
import { ControllerTreeDataProvider } from '../tree/controllerTreeDataProvider';
|
||||||
import { AuthType } from '../constants';
|
import { AuthType } from '../constants';
|
||||||
import { ManageControllerCommand } from '../../extension';
|
|
||||||
import { BdcDashboardOptions } from './bdcDashboardModel';
|
import { BdcDashboardOptions } from './bdcDashboardModel';
|
||||||
import { ControllerNode } from '../tree/controllerTreeNode';
|
import { ControllerNode } from '../tree/controllerTreeNode';
|
||||||
|
import { ManageControllerCommand } from '../../commands';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { ControllerTreeDataProvider } from '../tree/controllerTreeDataProvider';
|
|||||||
|
|
||||||
export type BdcDashboardOptions = { url: string, auth: AuthType, username: string, password: string, rememberPassword: boolean };
|
export type BdcDashboardOptions = { url: string, auth: AuthType, username: string, password: string, rememberPassword: boolean };
|
||||||
|
|
||||||
export type BdcErrorType = 'bdcStatus' | 'bdcEndpoints' | 'general';
|
type BdcErrorType = 'bdcStatus' | 'bdcEndpoints' | 'general';
|
||||||
export type BdcErrorEvent = { error: Error, errorType: BdcErrorType };
|
export type BdcErrorEvent = { error: Error, errorType: BdcErrorType };
|
||||||
|
|
||||||
export class BdcDashboardModel {
|
export class BdcDashboardModel {
|
||||||
|
|||||||
@@ -15,17 +15,6 @@ import { BdcDashboardPage } from './bdcDashboardPage';
|
|||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
export interface IGroup {
|
|
||||||
groupName: string;
|
|
||||||
instances: IInstanceStatus[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IInstanceStatus {
|
|
||||||
instanceName: string;
|
|
||||||
state: string;
|
|
||||||
healthStatus: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const healthAndStatusIconColumnWidth = 25;
|
const healthAndStatusIconColumnWidth = 25;
|
||||||
const healthAndStatusInstanceNameColumnWidth = 100;
|
const healthAndStatusInstanceNameColumnWidth = 100;
|
||||||
const healthAndStatusStateColumnWidth = 150;
|
const healthAndStatusStateColumnWidth = 150;
|
||||||
@@ -257,4 +246,3 @@ function createMetricsAndLogsRow(modelBuilder: azdata.ModelBuilder, instanceStat
|
|||||||
|
|
||||||
return metricsAndLogsRow;
|
return metricsAndLogsRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { IControllerTreeChangeHandler } from './controllerTreeChangeHandler';
|
|||||||
import { TreeNode } from './treeNode';
|
import { TreeNode } from './treeNode';
|
||||||
import { IconPathHelper, BdcItemType, IconPath, AuthType } from '../constants';
|
import { IconPathHelper, BdcItemType, IconPath, AuthType } from '../constants';
|
||||||
|
|
||||||
export abstract class ControllerTreeNode extends TreeNode {
|
abstract class ControllerTreeNode extends TreeNode {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
label: string,
|
label: string,
|
||||||
|
|||||||
@@ -234,14 +234,14 @@ interface RawEndpoint {
|
|||||||
port?: number;
|
port?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEndpoint {
|
interface IEndpoint {
|
||||||
serviceName: string;
|
serviceName: string;
|
||||||
description: string;
|
description: string;
|
||||||
endpoint: string;
|
endpoint: string;
|
||||||
protocol: string;
|
protocol: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getClusterEndpoints(serverInfo: azdata.ServerInfo): IEndpoint[] {
|
function getClusterEndpoints(serverInfo: azdata.ServerInfo): IEndpoint[] {
|
||||||
let endpoints: RawEndpoint[] = serverInfo.options[constants.clusterEndpointsProperty];
|
let endpoints: RawEndpoint[] = serverInfo.options[constants.clusterEndpointsProperty];
|
||||||
if (!endpoints || endpoints.length === 0) { return []; }
|
if (!endpoints || endpoints.length === 0) { return []; }
|
||||||
|
|
||||||
@@ -272,8 +272,8 @@ export function getBdcStatusErrorMessage(error: Error): string {
|
|||||||
return localize('endpointsError', "Unexpected error retrieving BDC Endpoints: {0}", error.message);
|
return localize('endpointsError', "Unexpected error retrieving BDC Endpoints: {0}", error.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const bdcConfigSectionName = 'bigDataCluster';
|
const bdcConfigSectionName = 'bigDataCluster';
|
||||||
export const ignoreSslConfigName = 'ignoreSslVerification';
|
const ignoreSslConfigName = 'ignoreSslVerification';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the current setting for whether to ignore SSL verification errors
|
* Retrieves the current setting for whether to ignore SSL verification errors
|
||||||
|
|||||||
12
extensions/big-data-cluster/src/commands.ts
Normal file
12
extensions/big-data-cluster/src/commands.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
export const ManageControllerCommand = 'bigDataClusters.command.manageController';
|
||||||
|
export const AddControllerCommand = 'bigDataClusters.command.addController';
|
||||||
|
export const DeleteControllerCommand = 'bigDataClusters.command.deleteController';
|
||||||
|
export const RefreshControllerCommand = 'bigDataClusters.command.refreshController';
|
||||||
|
export const MountHdfsCommand = 'bigDataClusters.command.mount';
|
||||||
|
export const RefreshMountCommand = 'bigDataClusters.command.refreshmount';
|
||||||
|
export const DeleteMountCommand = 'bigDataClusters.command.deletemount';
|
||||||
@@ -15,18 +15,11 @@ import { BdcDashboard } from './bigDataCluster/dialog/bdcDashboard';
|
|||||||
import { BdcDashboardModel, BdcDashboardOptions } from './bigDataCluster/dialog/bdcDashboardModel';
|
import { BdcDashboardModel, BdcDashboardOptions } from './bigDataCluster/dialog/bdcDashboardModel';
|
||||||
import { MountHdfsDialogModel as MountHdfsModel, MountHdfsProperties, MountHdfsDialog, DeleteMountDialog, DeleteMountModel, RefreshMountDialog, RefreshMountModel } from './bigDataCluster/dialog/mountHdfsDialog';
|
import { MountHdfsDialogModel as MountHdfsModel, MountHdfsProperties, MountHdfsDialog, DeleteMountDialog, DeleteMountModel, RefreshMountDialog, RefreshMountModel } from './bigDataCluster/dialog/mountHdfsDialog';
|
||||||
import { getControllerEndpoint } from './bigDataCluster/utils';
|
import { getControllerEndpoint } from './bigDataCluster/utils';
|
||||||
|
import * as commands from './commands';
|
||||||
import { HdfsDialogCancelledError } from './bigDataCluster/dialog/hdfsDialogBase';
|
import { HdfsDialogCancelledError } from './bigDataCluster/dialog/hdfsDialogBase';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
export const AddControllerCommand = 'bigDataClusters.command.addController';
|
|
||||||
export const DeleteControllerCommand = 'bigDataClusters.command.deleteController';
|
|
||||||
export const RefreshControllerCommand = 'bigDataClusters.command.refreshController';
|
|
||||||
export const ManageControllerCommand = 'bigDataClusters.command.manageController';
|
|
||||||
export const MountHdfsCommand = 'bigDataClusters.command.mount';
|
|
||||||
export const RefreshMountCommand = 'bigDataClusters.command.refreshmount';
|
|
||||||
export const DeleteMountCommand = 'bigDataClusters.command.deletemount';
|
|
||||||
|
|
||||||
const endpointNotFoundError = localize('mount.error.endpointNotFound', "Controller endpoint information was not found");
|
const endpointNotFoundError = localize('mount.error.endpointNotFound', "Controller endpoint information was not found");
|
||||||
|
|
||||||
let throttleTimers: { [key: string]: any } = {};
|
let throttleTimers: { [key: string]: any } = {};
|
||||||
@@ -46,22 +39,22 @@ function registerTreeDataProvider(treeDataProvider: ControllerTreeDataProvider):
|
|||||||
}
|
}
|
||||||
|
|
||||||
function registerCommands(context: vscode.ExtensionContext, treeDataProvider: ControllerTreeDataProvider): void {
|
function registerCommands(context: vscode.ExtensionContext, treeDataProvider: ControllerTreeDataProvider): void {
|
||||||
vscode.commands.registerCommand(AddControllerCommand, (node?: TreeNode) => {
|
vscode.commands.registerCommand(commands.AddControllerCommand, (node?: TreeNode) => {
|
||||||
runThrottledAction(AddControllerCommand, () => addBdcController(treeDataProvider, node));
|
runThrottledAction(commands.AddControllerCommand, () => addBdcController(treeDataProvider, node));
|
||||||
});
|
});
|
||||||
|
|
||||||
vscode.commands.registerCommand(DeleteControllerCommand, async (node: TreeNode) => {
|
vscode.commands.registerCommand(commands.DeleteControllerCommand, async (node: TreeNode) => {
|
||||||
await deleteBdcController(treeDataProvider, node);
|
await deleteBdcController(treeDataProvider, node);
|
||||||
});
|
});
|
||||||
|
|
||||||
vscode.commands.registerCommand(RefreshControllerCommand, (node: TreeNode) => {
|
vscode.commands.registerCommand(commands.RefreshControllerCommand, (node: TreeNode) => {
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
treeDataProvider.notifyNodeChanged(node);
|
treeDataProvider.notifyNodeChanged(node);
|
||||||
});
|
});
|
||||||
|
|
||||||
vscode.commands.registerCommand(ManageControllerCommand, async (info: ControllerNode | BdcDashboardOptions, addOrUpdateController: boolean = false) => {
|
vscode.commands.registerCommand(commands.ManageControllerCommand, async (info: ControllerNode | BdcDashboardOptions, addOrUpdateController: boolean = false) => {
|
||||||
const title: string = `${localize('bdc.dashboard.title', "Big Data Cluster Dashboard (preview) -")} ${ControllerNode.toIpAndPort(info.url)}`;
|
const title: string = `${localize('bdc.dashboard.title', "Big Data Cluster Dashboard (preview) -")} ${ControllerNode.toIpAndPort(info.url)}`;
|
||||||
if (addOrUpdateController) {
|
if (addOrUpdateController) {
|
||||||
// The info may be wrong, but if it is then we'll prompt to reconnect when the dashboard is opened
|
// The info may be wrong, but if it is then we'll prompt to reconnect when the dashboard is opened
|
||||||
@@ -78,13 +71,13 @@ function registerCommands(context: vscode.ExtensionContext, treeDataProvider: Co
|
|||||||
dashboard.showDashboard();
|
dashboard.showDashboard();
|
||||||
});
|
});
|
||||||
|
|
||||||
vscode.commands.registerCommand(MountHdfsCommand, e => mountHdfs(e).catch(error => {
|
vscode.commands.registerCommand(commands.MountHdfsCommand, e => mountHdfs(e).catch(error => {
|
||||||
vscode.window.showErrorMessage(error instanceof Error ? error.message : error);
|
vscode.window.showErrorMessage(error instanceof Error ? error.message : error);
|
||||||
}));
|
}));
|
||||||
vscode.commands.registerCommand(RefreshMountCommand, e => refreshMount(e).catch(error => {
|
vscode.commands.registerCommand(commands.RefreshMountCommand, e => refreshMount(e).catch(error => {
|
||||||
vscode.window.showErrorMessage(error instanceof Error ? error.message : error);
|
vscode.window.showErrorMessage(error instanceof Error ? error.message : error);
|
||||||
}));
|
}));
|
||||||
vscode.commands.registerCommand(DeleteMountCommand, e => deleteMount(e).catch(error => {
|
vscode.commands.registerCommand(commands.DeleteMountCommand, e => deleteMount(e).catch(error => {
|
||||||
vscode.window.showErrorMessage(error instanceof Error ? error.message : error);
|
vscode.window.showErrorMessage(error instanceof Error ? error.message : error);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const mssqlProvider: string = 'MSSQL';
|
|||||||
const CredentialNamespace = 'cmsCredentials';
|
const CredentialNamespace = 'cmsCredentials';
|
||||||
const sqlLoginAuthType: string = 'SqlLogin';
|
const sqlLoginAuthType: string = 'SqlLogin';
|
||||||
|
|
||||||
export interface CreateCmsResult {
|
interface CreateCmsResult {
|
||||||
listRegisteredServersResult: mssql.ListRegisteredServersResult;
|
listRegisteredServersResult: mssql.ListRegisteredServersResult;
|
||||||
connection: azdata.connection.Connection;
|
connection: azdata.connection.Connection;
|
||||||
ownerUri: string;
|
ownerUri: string;
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mocha": "^5.2.5",
|
"@types/mocha": "^5.2.5",
|
||||||
|
"@types/node": "10",
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"mocha-junit-reporter": "^1.17.0",
|
"mocha-junit-reporter": "^1.17.0",
|
||||||
"mocha-multi-reporters": "^1.1.7",
|
"mocha-multi-reporters": "^1.1.7",
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
import * as parser from 'htmlparser2';
|
import * as parser from 'htmlparser2';
|
||||||
@@ -13,7 +12,7 @@ import { DacFxConfigPage } from '../api/dacFxConfigPage';
|
|||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
export enum deployPlanXml {
|
enum deployPlanXml {
|
||||||
AlertElement = 'Alert',
|
AlertElement = 'Alert',
|
||||||
OperationElement = 'Operation',
|
OperationElement = 'Operation',
|
||||||
ItemElement = 'Item',
|
ItemElement = 'Item',
|
||||||
@@ -24,14 +23,14 @@ export enum deployPlanXml {
|
|||||||
DataIssueAttribute = 'DataIssue'
|
DataIssueAttribute = 'DataIssue'
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TableObject {
|
class TableObject {
|
||||||
operation: string;
|
operation: string;
|
||||||
object: string;
|
object: string;
|
||||||
type: string;
|
type: string;
|
||||||
dataloss: boolean;
|
dataloss: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DeployPlanResult {
|
class DeployPlanResult {
|
||||||
columnData: Array<Array<string>>;
|
columnData: Array<Array<string>>;
|
||||||
dataLossAlerts: Set<string>;
|
dataLossAlerts: Set<string>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.6.tgz#b8622d50557dd155e9f2f634b7d68fd38de5e94b"
|
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.6.tgz#b8622d50557dd155e9f2f634b7d68fd38de5e94b"
|
||||||
integrity sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==
|
integrity sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==
|
||||||
|
|
||||||
|
"@types/node@10":
|
||||||
|
version "10.17.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.4.tgz#8993a4fe3c4022fda66bf4ea660d615fc5659c6f"
|
||||||
|
integrity sha512-F2pgg+LcIr/elguz+x+fdBX5KeZXGUOp7TV8M0TVIrDezYLFRNt8oMTyps0VQ1kj5WGGoR18RdxnRDHXrIFHMQ==
|
||||||
|
|
||||||
agent-base@4, agent-base@^4.3.0:
|
agent-base@4, agent-base@^4.3.0:
|
||||||
version "4.3.0"
|
version "4.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
|
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
|
||||||
|
|||||||
@@ -70,7 +70,9 @@
|
|||||||
"vscode-extension-telemetry": "0.0.18",
|
"vscode-extension-telemetry": "0.0.18",
|
||||||
"vscode-nls": "^3.2.1"
|
"vscode-nls": "^3.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {
|
||||||
|
"@types/node": "10"
|
||||||
|
},
|
||||||
"__metadata": {
|
"__metadata": {
|
||||||
"id": "23",
|
"id": "23",
|
||||||
"publisherDisplayName": "Microsoft",
|
"publisherDisplayName": "Microsoft",
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { SqlOpsDataClient, SqlOpsFeature } from 'dataprotocol-client';
|
import { SqlOpsDataClient, SqlOpsFeature } from 'dataprotocol-client';
|
||||||
import {
|
import {
|
||||||
ClientCapabilities,
|
ClientCapabilities,
|
||||||
StaticFeature,
|
StaticFeature,
|
||||||
RPCMessageType,
|
RPCMessageType,
|
||||||
ServerCapabilities
|
ServerCapabilities,
|
||||||
|
RequestType
|
||||||
} from 'vscode-languageclient';
|
} from 'vscode-languageclient';
|
||||||
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
|
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
|
||||||
import { Disposable } from 'vscode';
|
import { Disposable } from 'vscode';
|
||||||
@@ -57,7 +57,7 @@ export class FlatFileImportFeature extends SqlOpsFeature<undefined> {
|
|||||||
protected registerProvider(options: undefined): Disposable {
|
protected registerProvider(options: undefined): Disposable {
|
||||||
const client = this._client;
|
const client = this._client;
|
||||||
|
|
||||||
let requestSender = (requestType, params) => {
|
let requestSender = (requestType: RequestType<any, any, void, void>, params: any) => {
|
||||||
return client.sendRequest(requestType, params).then(
|
return client.sendRequest(requestType, params).then(
|
||||||
r => {
|
r => {
|
||||||
return r as any;
|
return r as any;
|
||||||
|
|||||||
@@ -3,29 +3,24 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as contracts from './contracts';
|
|
||||||
import { SqlOpsDataClient } from 'dataprotocol-client/lib/main';
|
|
||||||
|
|
||||||
export enum ApiType {
|
export enum ApiType {
|
||||||
FlatFileProvider = 'FlatFileProvider'
|
FlatFileProvider = 'FlatFileProvider'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IServiceApi {
|
interface IServiceApi {
|
||||||
onRegisteredApi<T>(type: ApiType): vscode.Event<T>;
|
onRegisteredApi<T>(type: ApiType): vscode.Event<T>;
|
||||||
registerApi<T>(type: ApiType, feature: T): vscode.Disposable;
|
registerApi<T>(type: ApiType, feature: T): vscode.Disposable;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IModelViewDefinition {
|
interface IModelViewDefinition {
|
||||||
id: string;
|
id: string;
|
||||||
modelView: azdata.ModelView;
|
modelView: azdata.ModelView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ServiceApiManager implements IServiceApi {
|
class ServiceApiManager implements IServiceApi {
|
||||||
private modelViewRegistrations: { [id: string]: boolean } = {};
|
|
||||||
private featureEventChannels: { [type: string]: vscode.EventEmitter<any> } = {};
|
private featureEventChannels: { [type: string]: vscode.EventEmitter<any> } = {};
|
||||||
private _onRegisteredModelView = new vscode.EventEmitter<IModelViewDefinition>();
|
private _onRegisteredModelView = new vscode.EventEmitter<IModelViewDefinition>();
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client';
|
import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client';
|
||||||
import { ServerProvider, Events } from 'service-downloader';
|
import { ServerProvider, Events } from 'service-downloader';
|
||||||
import { ServerOptions, TransportKind } from 'vscode-languageclient';
|
import { ServerOptions, TransportKind } from 'vscode-languageclient';
|
||||||
@@ -17,7 +15,6 @@ import { EventAndListener } from 'eventemitter2';
|
|||||||
import { Telemetry, LanguageClientErrorHandler } from './telemetry';
|
import { Telemetry, LanguageClientErrorHandler } from './telemetry';
|
||||||
import * as Constants from '../constants';
|
import * as Constants from '../constants';
|
||||||
import { TelemetryFeature, FlatFileImportFeature } from './features';
|
import { TelemetryFeature, FlatFileImportFeature } from './features';
|
||||||
import * as serviceUtils from './serviceUtils';
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
|
||||||
export class ServiceClient {
|
export class ServiceClient {
|
||||||
|
|||||||
@@ -3,80 +3,9 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as path from 'path';
|
export function ensure(target: { [key: string]: any }, key: string): any {
|
||||||
import * as os from 'os';
|
|
||||||
|
|
||||||
// The function is a duplicate of \src\paths.js. IT would be better to import path.js but it doesn't
|
|
||||||
// work for now because the extension is running in different process.
|
|
||||||
export function getAppDataPath(): string {
|
|
||||||
let platform = process.platform;
|
|
||||||
switch (platform) {
|
|
||||||
case 'win32': return process.env['APPDATA'] || path.join(process.env['USERPROFILE'], 'AppData', 'Roaming');
|
|
||||||
case 'darwin': return path.join(os.homedir(), 'Library', 'Application Support');
|
|
||||||
case 'linux': return process.env['XDG_CONFIG_HOME'] || path.join(os.homedir(), '.config');
|
|
||||||
default: throw new Error('Platform not supported');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function ensure(target: object, key: string): any {
|
|
||||||
if (target[key] === void 0) {
|
if (target[key] === void 0) {
|
||||||
target[key] = {} as any;
|
target[key] = {} as any;
|
||||||
}
|
}
|
||||||
return target[key];
|
return target[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPackageInfo {
|
|
||||||
name: string;
|
|
||||||
version: string;
|
|
||||||
aiKey: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getPackageInfo(packageJson: any): IPackageInfo {
|
|
||||||
if (packageJson) {
|
|
||||||
return {
|
|
||||||
name: packageJson.name,
|
|
||||||
version: packageJson.version,
|
|
||||||
aiKey: packageJson.aiKey
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function verifyPlatform(): Thenable<boolean> {
|
|
||||||
if (os.platform() === 'darwin' && parseFloat(os.release()) < 16) {
|
|
||||||
return Promise.resolve(false);
|
|
||||||
} else {
|
|
||||||
return Promise.resolve(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getRuntimeDisplayName(runtime: Runtime): string {
|
|
||||||
switch (runtime) {
|
|
||||||
case Runtime.Windows_64:
|
|
||||||
return 'Windows';
|
|
||||||
case Runtime.Windows_86:
|
|
||||||
return 'Windows';
|
|
||||||
case Runtime.OSX:
|
|
||||||
return 'OSX';
|
|
||||||
case Runtime.Linux_64:
|
|
||||||
return 'Linux';
|
|
||||||
default:
|
|
||||||
return 'Unknown';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum Runtime {
|
|
||||||
Unknown = <any>'Unknown',
|
|
||||||
Windows_86 = <any>'Windows_86',
|
|
||||||
Windows_64 = <any>'Windows_64',
|
|
||||||
OSX = <any>'OSX',
|
|
||||||
CentOS_7 = <any>'CentOS_7',
|
|
||||||
Debian_8 = <any>'Debian_8',
|
|
||||||
Fedora_23 = <any>'Fedora_23',
|
|
||||||
OpenSUSE_13_2 = <any>'OpenSUSE_13_2',
|
|
||||||
SLES_12_2 = <any>'SLES_12_2',
|
|
||||||
RHEL_7 = <any>'RHEL_7',
|
|
||||||
Ubuntu_14 = <any>'Ubuntu_14',
|
|
||||||
Ubuntu_16 = <any>'Ubuntu_16',
|
|
||||||
Linux_64 = <any>'Linux_64',
|
|
||||||
Linux_86 = <any>'Linux-86'
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export class LanguageClientErrorHandler {
|
|||||||
/**
|
/**
|
||||||
* Filters error paths to only include source files. Exported to support testing
|
* Filters error paths to only include source files. Exported to support testing
|
||||||
*/
|
*/
|
||||||
export function FilterErrorPath(line: string): string {
|
function FilterErrorPath(line: string): string | undefined {
|
||||||
if (line) {
|
if (line) {
|
||||||
let values: string[] = line.split('/out/');
|
let values: string[] = line.split('/out/');
|
||||||
if (values.length <= 1) {
|
if (values.length <= 1) {
|
||||||
@@ -84,6 +84,7 @@ export function FilterErrorPath(line: string): string {
|
|||||||
return values[1];
|
return values[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Telemetry {
|
export class Telemetry {
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ export abstract class BasePage {
|
|||||||
* Sets up a navigation validator.
|
* Sets up a navigation validator.
|
||||||
* This will be called right before onPageEnter().
|
* This will be called right before onPageEnter().
|
||||||
*/
|
*/
|
||||||
public abstract setupNavigationValidator();
|
public abstract setupNavigationValidator(): void;
|
||||||
|
|
||||||
protected async getServerValues(): Promise<{ connection, displayName, name }[]> {
|
protected async getServerValues(): Promise<{ connection: azdata.connection.Connection, displayName: string, name: string }[]> {
|
||||||
let cons = await azdata.connection.getActiveConnections();
|
let cons = await azdata.connection.getActiveConnections();
|
||||||
// This user has no active connections ABORT MISSION
|
// This user has no active connections ABORT MISSION
|
||||||
if (!cons || cons.length === 0) {
|
if (!cons || cons.length === 0) {
|
||||||
@@ -90,7 +90,7 @@ export abstract class BasePage {
|
|||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async getDatabaseValues(): Promise<{ displayName, name }[]> {
|
protected async getDatabaseValues(): Promise<{ displayName: string, name: string }[]> {
|
||||||
let idx = -1;
|
let idx = -1;
|
||||||
let count = -1;
|
let count = -1;
|
||||||
let values = (await azdata.connection.listDatabases(this.model.server.connectionId)).map(db => {
|
let values = (await azdata.connection.listDatabases(this.model.server.connectionId)).map(db => {
|
||||||
|
|||||||
@@ -3,15 +3,12 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
import { ImportDataModel } from '../api/models';
|
import { ImportDataModel } from '../api/models';
|
||||||
import { ImportPage } from '../api/importPage';
|
import { ImportPage } from '../api/importPage';
|
||||||
import { FlatFileProvider } from '../../services/contracts';
|
import { FlatFileProvider } from '../../services/contracts';
|
||||||
import { FlatFileWizard } from '../flatFileWizard';
|
import { FlatFileWizard } from '../flatFileWizard';
|
||||||
import { PerformanceObserver } from 'perf_hooks';
|
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,7 @@
|
|||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noImplicitAny": false,
|
|
||||||
"noUnusedParameters": false,
|
"noUnusedParameters": false,
|
||||||
"noImplicitReturns": false,
|
|
||||||
"noUnusedLocals": false,
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules"
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
"@types/node@10":
|
||||||
|
version "10.17.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.4.tgz#8993a4fe3c4022fda66bf4ea660d615fc5659c6f"
|
||||||
|
integrity sha512-F2pgg+LcIr/elguz+x+fdBX5KeZXGUOp7TV8M0TVIrDezYLFRNt8oMTyps0VQ1kj5WGGoR18RdxnRDHXrIFHMQ==
|
||||||
|
|
||||||
agent-base@4:
|
agent-base@4:
|
||||||
version "4.2.1"
|
version "4.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
|
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
|
||||||
|
|||||||
@@ -55,7 +55,6 @@
|
|||||||
"chai": "3.5.0",
|
"chai": "3.5.0",
|
||||||
"mocha-junit-reporter": "^1.17.0",
|
"mocha-junit-reporter": "^1.17.0",
|
||||||
"mocha-multi-reporters": "^1.1.7",
|
"mocha-multi-reporters": "^1.1.7",
|
||||||
"uuid": "^3.3.2",
|
|
||||||
"vscode": "1.1.5"
|
"vscode": "1.1.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -3,14 +3,12 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as mssql from '../../mssql';
|
import * as mssql from '../../mssql';
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
import * as uuid from 'uuid';
|
import * as uuid from './uuid';
|
||||||
import { context } from './testContext';
|
import { context } from './testContext';
|
||||||
import assert = require('assert');
|
import assert = require('assert');
|
||||||
import { getStandaloneServer, TestServerProfile, getBdcServer } from './testConfig';
|
import { getStandaloneServer, TestServerProfile, getBdcServer } from './testConfig';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
@@ -15,7 +13,7 @@ import * as mssql from '../../mssql';
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { context } from './testContext';
|
import { context } from './testContext';
|
||||||
import { getStandaloneServer } from './testConfig';
|
import { getStandaloneServer } from './testConfig';
|
||||||
import assert = require('assert');
|
import * as assert from 'assert';
|
||||||
|
|
||||||
const retryCount = 24; // 2 minutes
|
const retryCount = 24; // 2 minutes
|
||||||
const dacpac1: string = path.join(__dirname, '../testData/Database1.dacpac');
|
const dacpac1: string = path.join(__dirname, '../testData/Database1.dacpac');
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { SuiteType, getSuiteType } from 'adstest';
|
|||||||
|
|
||||||
import { context } from './testContext';
|
import { context } from './testContext';
|
||||||
|
|
||||||
import path = require('path');
|
import * as path from 'path';
|
||||||
|
|
||||||
const suite = getSuiteType();
|
const suite = getSuiteType();
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
@@ -458,4 +456,3 @@ class NotebookTester {
|
|||||||
assert(languageInNotebook === languageConfigured, `Expected cell language is: ${languageConfigured}, Actual: ${languageInNotebook}`);
|
assert(languageInNotebook === languageConfigured, `Expected cell language is: ${languageConfigured}, Actual: ${languageInNotebook}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|||||||
@@ -3,14 +3,12 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import { context } from './testContext';
|
import { context } from './testContext';
|
||||||
import { getBdcServer, TestServerProfile, getAzureServer, getStandaloneServer } from './testConfig';
|
import { getBdcServer, TestServerProfile, getAzureServer, getStandaloneServer } from './testConfig';
|
||||||
import { connectToServer, createDB, deleteDB, DefaultConnectTimeoutInMs, asyncTimeout } from './utils';
|
import { connectToServer, createDB, deleteDB, DefaultConnectTimeoutInMs, asyncTimeout } from './utils';
|
||||||
import assert = require('assert');
|
import * as assert from 'assert';
|
||||||
import { stressify } from 'adstest';
|
import { stressify } from 'adstest';
|
||||||
|
|
||||||
if (context.RunTest) {
|
if (context.RunTest) {
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
@@ -14,7 +12,7 @@ import * as os from 'os';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
import { context } from './testContext';
|
import { context } from './testContext';
|
||||||
import assert = require('assert');
|
import * as assert from 'assert';
|
||||||
import { getStandaloneServer } from './testConfig';
|
import { getStandaloneServer } from './testConfig';
|
||||||
import { stressify } from 'adstest';
|
import { stressify } from 'adstest';
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,10 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { context } from './testContext';
|
import { context } from './testContext';
|
||||||
import assert = require('assert');
|
import * as assert from 'assert';
|
||||||
import { getConfigValue, EnvironmentVariable_BDC_SERVER, EnvironmentVariable_BDC_USERNAME, EnvironmentVariable_BDC_PASSWORD, EnvironmentVariable_AZURE_PASSWORD, EnvironmentVariable_AZURE_SERVER, EnvironmentVariable_AZURE_USERNAME, EnvironmentVariable_STANDALONE_PASSWORD, EnvironmentVariable_STANDALONE_SERVER, EnvironmentVariable_STANDALONE_USERNAME, EnvironmentVariable_PYTHON_PATH } from './testConfig';
|
import { getConfigValue, EnvironmentVariable_BDC_SERVER, EnvironmentVariable_BDC_USERNAME, EnvironmentVariable_BDC_PASSWORD, EnvironmentVariable_AZURE_PASSWORD, EnvironmentVariable_AZURE_SERVER, EnvironmentVariable_AZURE_USERNAME, EnvironmentVariable_STANDALONE_PASSWORD, EnvironmentVariable_STANDALONE_SERVER, EnvironmentVariable_STANDALONE_USERNAME, EnvironmentVariable_PYTHON_PATH } from './testConfig';
|
||||||
|
|
||||||
assert(getConfigValue(EnvironmentVariable_BDC_SERVER) !== undefined &&
|
assert(getConfigValue(EnvironmentVariable_BDC_SERVER) !== undefined &&
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ export enum EngineType {
|
|||||||
BigDataCluster
|
BigDataCluster
|
||||||
}
|
}
|
||||||
|
|
||||||
let connectionProviderMapping = {};
|
let connectionProviderMapping: { [key: string]: { name: string; displayName: string } } = {};
|
||||||
let authenticationTypeMapping = {};
|
let authenticationTypeMapping: { [key: string]: { name: string; displayName: string } } = {};
|
||||||
connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' };
|
connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' };
|
||||||
|
|
||||||
authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' };
|
authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' };
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import assert = require('assert');
|
import * as assert from 'assert';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|||||||
108
extensions/integration-tests/src/uuid.ts
Normal file
108
extensions/integration-tests/src/uuid.ts
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a UUID as defined by rfc4122.
|
||||||
|
*/
|
||||||
|
export interface UUID {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns the canonical representation in sets of hexadecimal numbers separated by dashes.
|
||||||
|
*/
|
||||||
|
asHex(): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ValueUUID implements UUID {
|
||||||
|
|
||||||
|
constructor(public _value: string) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
public asHex(): string {
|
||||||
|
return this._value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class V4UUID extends ValueUUID {
|
||||||
|
|
||||||
|
private static readonly _chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
|
||||||
|
|
||||||
|
private static readonly _timeHighBits = ['8', '9', 'a', 'b'];
|
||||||
|
|
||||||
|
private static _oneOf(array: string[]): string {
|
||||||
|
return array[Math.floor(array.length * Math.random())];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static _randomHex(): string {
|
||||||
|
return V4UUID._oneOf(V4UUID._chars);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super([
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
'-',
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
'-',
|
||||||
|
'4',
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
'-',
|
||||||
|
V4UUID._oneOf(V4UUID._timeHighBits),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
'-',
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
V4UUID._randomHex(),
|
||||||
|
].join(''));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function v4(): UUID {
|
||||||
|
return new V4UUID();
|
||||||
|
}
|
||||||
|
|
||||||
|
const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||||
|
|
||||||
|
export function isUUID(value: string): boolean {
|
||||||
|
return _UUIDPattern.test(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses a UUID that is of the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
|
||||||
|
* @param value A uuid string.
|
||||||
|
*/
|
||||||
|
export function parse(value: string): UUID {
|
||||||
|
if (!isUUID(value)) {
|
||||||
|
throw new Error('invalid uuid');
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ValueUUID(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function generateUuid(): string {
|
||||||
|
return v4().asHex();
|
||||||
|
}
|
||||||
@@ -55,7 +55,7 @@ export class GuestSessionManager {
|
|||||||
if (documentState) {
|
if (documentState) {
|
||||||
let queryDocument = await azdata.queryeditor.getQueryDocument(doc.uri.toString());
|
let queryDocument = await azdata.queryeditor.getQueryDocument(doc.uri.toString());
|
||||||
if (queryDocument) {
|
if (queryDocument) {
|
||||||
let connectionOptions: Map<string, any> = new Map<string, any>();
|
let connectionOptions: { [key: string]: any } = {};
|
||||||
connectionOptions['providerName'] = LiveShareProviderId;
|
connectionOptions['providerName'] = LiveShareProviderId;
|
||||||
connectionOptions['serverName'] = documentState.serverName;
|
connectionOptions['serverName'] = documentState.serverName;
|
||||||
connectionOptions['databaseName'] = documentState.databaseName;
|
connectionOptions['databaseName'] = documentState.databaseName;
|
||||||
|
|||||||
@@ -9,27 +9,10 @@
|
|||||||
|
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
/**
|
|
||||||
* Root API that is used to acquire access to the main Live Share API.
|
|
||||||
*
|
|
||||||
* An implementation of this interface is returned by the Live Share extension's
|
|
||||||
* activation function. Ordinarily this interface is not used directly; use the
|
|
||||||
* `getApiAsync()` helper function above instead.
|
|
||||||
*/
|
|
||||||
export interface LiveShareExtension {
|
|
||||||
/**
|
|
||||||
* Requests a specific version of the Live Share API for use by another extension.
|
|
||||||
*
|
|
||||||
* @returns a promise that resolves to the requested API, or `null` if the requested
|
|
||||||
* API is not available
|
|
||||||
*/
|
|
||||||
getApi(requestedApiVersion: string): Promise<LiveShare | null>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forward definition of the ContactServiceProvider interface
|
* Forward definition of the ContactServiceProvider interface
|
||||||
*/
|
*/
|
||||||
export interface ContactServiceProvider {
|
interface ContactServiceProvider {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +199,7 @@ export interface LiveShare {
|
|||||||
getContacts(emails: string[]): Promise<ContactsCollection>;
|
getContacts(emails: string[]): Promise<ContactsCollection>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ShareOptions {
|
interface ShareOptions {
|
||||||
/**
|
/**
|
||||||
* Suppress display of the usual notification that indicates that sharing
|
* Suppress display of the usual notification that indicates that sharing
|
||||||
* started. Also suppresses copying the join link to the clipboard. When
|
* started. Also suppresses copying the join link to the clipboard. When
|
||||||
@@ -232,7 +215,7 @@ export interface ShareOptions {
|
|||||||
access?: Access;
|
access?: Access;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JoinOptions {
|
interface JoinOptions {
|
||||||
/**
|
/**
|
||||||
* Open the joined workspace in a new window, instead of re-using the current window.
|
* Open the joined workspace in a new window, instead of re-using the current window.
|
||||||
*/
|
*/
|
||||||
@@ -243,7 +226,7 @@ export interface JoinOptions {
|
|||||||
/**
|
/**
|
||||||
* Represents a local TCP server listening on the given port.
|
* Represents a local TCP server listening on the given port.
|
||||||
*/
|
*/
|
||||||
export interface Server {
|
interface Server {
|
||||||
/**
|
/**
|
||||||
* Local TCP port the server is listening on.
|
* Local TCP port the server is listening on.
|
||||||
*/
|
*/
|
||||||
@@ -258,14 +241,14 @@ export interface Server {
|
|||||||
browseUrl?: string;
|
browseUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Role {
|
enum Role {
|
||||||
None = 0,
|
None = 0,
|
||||||
Host = 1,
|
Host = 1,
|
||||||
Guest = 2,
|
Guest = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This is just a placeholder for a richer access control model to be added later. */
|
/** This is just a placeholder for a richer access control model to be added later. */
|
||||||
export enum Access {
|
enum Access {
|
||||||
None = 0,
|
None = 0,
|
||||||
ReadOnly = 1,
|
ReadOnly = 1,
|
||||||
ReadWrite = 3,
|
ReadWrite = 3,
|
||||||
@@ -278,7 +261,7 @@ export enum Access {
|
|||||||
* NOTE: Access to user information may be restricted.
|
* NOTE: Access to user information may be restricted.
|
||||||
* If the caller is not permitted, the `Peer.user` property returns 'null'.
|
* If the caller is not permitted, the `Peer.user` property returns 'null'.
|
||||||
*/
|
*/
|
||||||
export interface UserInfo {
|
interface UserInfo {
|
||||||
/**
|
/**
|
||||||
* User display name.
|
* User display name.
|
||||||
*/
|
*/
|
||||||
@@ -304,7 +287,7 @@ export interface UserInfo {
|
|||||||
/**
|
/**
|
||||||
* Represents one participant in a sharing session.
|
* Represents one participant in a sharing session.
|
||||||
*/
|
*/
|
||||||
export interface Peer {
|
interface Peer {
|
||||||
/** Integer that uniquely identifies a peer within the scope of a session. */
|
/** Integer that uniquely identifies a peer within the scope of a session. */
|
||||||
readonly peerNumber: number;
|
readonly peerNumber: number;
|
||||||
|
|
||||||
@@ -332,27 +315,27 @@ export interface Peer {
|
|||||||
/**
|
/**
|
||||||
* Information about the current session, including user information (in the base class).
|
* Information about the current session, including user information (in the base class).
|
||||||
*/
|
*/
|
||||||
export interface Session extends Peer {
|
interface Session extends Peer {
|
||||||
/**
|
/**
|
||||||
* Globally unique identifier for the current session, or null if there is no active session.
|
* Globally unique identifier for the current session, or null if there is no active session.
|
||||||
*/
|
*/
|
||||||
readonly id: string | null;
|
readonly id: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SessionChangeEvent {
|
interface SessionChangeEvent {
|
||||||
readonly session: Session;
|
readonly session: Session;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PeersChangeEvent {
|
interface PeersChangeEvent {
|
||||||
readonly added: Peer[];
|
readonly added: Peer[];
|
||||||
readonly removed: Peer[];
|
readonly removed: Peer[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RequestHandler {
|
interface RequestHandler {
|
||||||
(args: any[], cancellation: vscode.CancellationToken): any | Promise<any>;
|
(args: any[], cancellation: vscode.CancellationToken): any | Promise<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NotifyHandler {
|
interface NotifyHandler {
|
||||||
(args: object): void;
|
(args: object): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,100 +418,19 @@ export interface SharedServiceProxy {
|
|||||||
notify(name: string, args: object): void;
|
notify(name: string, args: object): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Error thrown by a proxy when a request to a shared service cannot be made
|
|
||||||
* because the service is not available or cannot be reached.
|
|
||||||
*/
|
|
||||||
export interface SharedServiceProxyError extends Error {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Error thrown by a proxy when a shared service's request handler threw an error.
|
|
||||||
* The remote message and remote stack are propagated back to the proxy.
|
|
||||||
*/
|
|
||||||
export interface SharedServiceResponseError extends Error {
|
|
||||||
remoteStack?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifiers for Live Share tree views. These identifiers may be used by other extensions
|
* Identifiers for Live Share tree views. These identifiers may be used by other extensions
|
||||||
* to extend Live Share tree views with additional nodes via the `registerTreeDataProvider()`
|
* to extend Live Share tree views with additional nodes via the `registerTreeDataProvider()`
|
||||||
* API.
|
* API.
|
||||||
*/
|
*/
|
||||||
export enum View {
|
enum View {
|
||||||
Session = 'liveshare.session',
|
Session = 'liveshare.session',
|
||||||
ExplorerSession = 'liveshare.session.explorer',
|
ExplorerSession = 'liveshare.session.explorer',
|
||||||
Contacts = 'liveshare.contacts',
|
Contacts = 'liveshare.contacts',
|
||||||
Help = 'liveshare.help',
|
Help = 'liveshare.help',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
interface InviteContactOptions {
|
||||||
* Identifiers for Live Share tree view items. These identifiers may be used by other
|
|
||||||
* extensions to extend Live Share tree items with additional commands using conditional
|
|
||||||
* expressions in the `view/item/context` section of their own package.json.
|
|
||||||
*/
|
|
||||||
export enum ViewItem {
|
|
||||||
// session item groups
|
|
||||||
Participants = 'participants',
|
|
||||||
Servers = 'servers',
|
|
||||||
Terminals = 'terminals',
|
|
||||||
|
|
||||||
// participants
|
|
||||||
CurrentUser = 'participants.currentuser', // (not currently shown)
|
|
||||||
Guest = 'participants.guest',
|
|
||||||
FollowedGuest = 'participants.guest.followed',
|
|
||||||
Participant = 'participants.participant',
|
|
||||||
FollowedParticipant = 'participants.participant.followed',
|
|
||||||
|
|
||||||
GuestAnonymous = 'participants.guest.anonymous',
|
|
||||||
FollowedGuestAnonymous = 'participants.guest.followed.anonymous',
|
|
||||||
|
|
||||||
GuestElevated = 'participants.guest.elevated',
|
|
||||||
FollowedGuestElevated = 'participants.guest.followed.elevated',
|
|
||||||
|
|
||||||
// servers
|
|
||||||
LocalServer = 'servers.local',
|
|
||||||
RemoteServer = 'servers.remote',
|
|
||||||
|
|
||||||
// terminals
|
|
||||||
LocalTerminalReadOnly = 'terminals.local.readonly',
|
|
||||||
LocalTerminalReadWrite = 'terminals.local.readwrite',
|
|
||||||
RemoteTerminal = 'terminals.remote',
|
|
||||||
|
|
||||||
// contacts
|
|
||||||
SuggestedContacts = 'contacts.suggested',
|
|
||||||
AvailableContacts = 'contacts.available',
|
|
||||||
ContactsProvider = 'contacts.provider',
|
|
||||||
SelfContact = 'contacts.selfContact',
|
|
||||||
Contact = 'contacts.contact',
|
|
||||||
ContactOffline = 'contacts.contact.offline',
|
|
||||||
RecentContact = 'contacts.recentContact',
|
|
||||||
RecentContactOffline = 'contacts.recentContact.offline',
|
|
||||||
NoContact = 'contacts.noContact',
|
|
||||||
RecentContacts = 'contacts.RecentContacts',
|
|
||||||
NoSuggestedContacts = 'contacts.NoSuggestedUsers',
|
|
||||||
NoRecentContacts = 'contacts.NoRecentContacts',
|
|
||||||
InvitedContact = 'contacts.invited',
|
|
||||||
|
|
||||||
// help
|
|
||||||
SessionFeedbackQuestion = 'help.sessionFeedback',
|
|
||||||
ReportAProblem = 'help.reportAProblem',
|
|
||||||
TweetUsYourFeedback = 'help.tweetUsYourFeedback',
|
|
||||||
Survey = 'help.survey',
|
|
||||||
GoodFeedback = 'help.goodFeedback',
|
|
||||||
BadFeedback = 'help.badFeedback',
|
|
||||||
DontAskAgain = 'help.dontAskAgain',
|
|
||||||
Thankyou = 'help.thankyou',
|
|
||||||
MoreInfo = 'help.moreinfo',
|
|
||||||
|
|
||||||
// Shown while session sharing / joining is in progress
|
|
||||||
Loading = 'loading',
|
|
||||||
|
|
||||||
// Other / unspecified item type
|
|
||||||
Other = 'other',
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface InviteContactOptions {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This option will force the invite to only use the email channel
|
* This option will force the invite to only use the email channel
|
||||||
@@ -539,7 +441,7 @@ export interface InviteContactOptions {
|
|||||||
/**
|
/**
|
||||||
* Represent a contact with live presence support
|
* Represent a contact with live presence support
|
||||||
*/
|
*/
|
||||||
export interface Contact {
|
interface Contact {
|
||||||
readonly onDidChange: vscode.Event<string[]>;
|
readonly onDidChange: vscode.Event<string[]>;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly email: string;
|
readonly email: string;
|
||||||
@@ -553,7 +455,7 @@ export interface Contact {
|
|||||||
/**
|
/**
|
||||||
* Represent a collection of contacts that can be disposed at once
|
* Represent a collection of contacts that can be disposed at once
|
||||||
*/
|
*/
|
||||||
export interface ContactsCollection {
|
interface ContactsCollection {
|
||||||
readonly contacts: { [email: string]: Contact };
|
readonly contacts: { [email: string]: Contact };
|
||||||
dispose(): Promise<void>;
|
dispose(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export class StatusProvider {
|
|||||||
if (args && args.ownerUri && args.profile) {
|
if (args && args.ownerUri && args.profile) {
|
||||||
let queryDocument = await azdata.queryeditor.getQueryDocument(args.ownerUri);
|
let queryDocument = await azdata.queryeditor.getQueryDocument(args.ownerUri);
|
||||||
if (queryDocument) {
|
if (queryDocument) {
|
||||||
let connectionOptions: Map<string, any> = new Map<string, any>();
|
let connectionOptions: { [key: string]: any } = {};
|
||||||
connectionOptions['providerName'] = LiveShareProviderId;
|
connectionOptions['providerName'] = LiveShareProviderId;
|
||||||
connectionOptions['serverName'] = args.profile.options['server'];
|
connectionOptions['serverName'] = args.profile.options['server'];
|
||||||
connectionOptions['databaseName'] = args.profile.options['database'];
|
connectionOptions['databaseName'] = args.profile.options['database'];
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./out",
|
"outDir": "./out",
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUnusedParameters": false,
|
"noUnusedParameters": false
|
||||||
"noImplicitAny": false
|
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*"
|
"src/**/*"
|
||||||
|
|||||||
@@ -996,7 +996,6 @@
|
|||||||
"error-ex": "^1.3.2",
|
"error-ex": "^1.3.2",
|
||||||
"figures": "^2.0.0",
|
"figures": "^2.0.0",
|
||||||
"find-remove": "1.2.1",
|
"find-remove": "1.2.1",
|
||||||
"fs-extra": "^3.0.1",
|
|
||||||
"kerberos": "^1.1.3",
|
"kerberos": "^1.1.3",
|
||||||
"request": "^2.88.0",
|
"request": "^2.88.0",
|
||||||
"request-promise": "^4.2.2",
|
"request-promise": "^4.2.2",
|
||||||
@@ -1004,14 +1003,16 @@
|
|||||||
"stream-meter": "^1.0.4",
|
"stream-meter": "^1.0.4",
|
||||||
"through2": "^3.0.1",
|
"through2": "^3.0.1",
|
||||||
"tough-cookie": "^3.0.1",
|
"tough-cookie": "^3.0.1",
|
||||||
"uri-js": "^4.2.2",
|
|
||||||
"vscode-extension-telemetry": "0.1.0",
|
"vscode-extension-telemetry": "0.1.0",
|
||||||
"vscode-languageclient": "5.2.1",
|
"vscode-languageclient": "5.2.1",
|
||||||
"vscode-nls": "^4.0.0"
|
"vscode-nls": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/bytes": "^3.0.0",
|
||||||
"@types/kerberos": "^1.1.0",
|
"@types/kerberos": "^1.1.0",
|
||||||
"@types/request": "^2.48.2",
|
"@types/request": "^2.48.2",
|
||||||
|
"@types/request-promise": "^4.1.44",
|
||||||
|
"@types/stream-meter": "^0.0.22",
|
||||||
"@types/through2": "^2.0.34"
|
"@types/through2": "^2.0.34"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ export class ApiWrapper {
|
|||||||
|
|
||||||
public openTextDocument(uri: vscode.Uri): Thenable<vscode.TextDocument>;
|
public openTextDocument(uri: vscode.Uri): Thenable<vscode.TextDocument>;
|
||||||
public openTextDocument(options: { language?: string; content?: string; }): Thenable<vscode.TextDocument>;
|
public openTextDocument(options: { language?: string; content?: string; }): Thenable<vscode.TextDocument>;
|
||||||
public openTextDocument(uriOrOptions): Thenable<vscode.TextDocument> {
|
public openTextDocument(uriOrOptions: any): Thenable<vscode.TextDocument> {
|
||||||
return vscode.workspace.openTextDocument(uriOrOptions);
|
return vscode.workspace.openTextDocument(uriOrOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as constants from '../constants';
|
import * as constants from '../constants';
|
||||||
import * as contracts from '../contracts';
|
import * as contracts from '../contracts';
|
||||||
|
|||||||
@@ -2,18 +2,18 @@
|
|||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
'use strict';
|
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
|
|
||||||
import * as types from './types';
|
import * as types from './types';
|
||||||
import * as Constants from './constants';
|
import * as Constants from './constants';
|
||||||
|
|
||||||
export enum BuiltInCommands {
|
enum BuiltInCommands {
|
||||||
SetContext = 'setContext',
|
SetContext = 'setContext',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ContextKeys {
|
enum ContextKeys {
|
||||||
ISCLOUD = 'mssql:iscloud',
|
ISCLOUD = 'mssql:iscloud',
|
||||||
EDITIONID = 'mssql:engineedition',
|
EDITIONID = 'mssql:engineedition',
|
||||||
ISCLUSTER = 'mssql:iscluster',
|
ISCLUSTER = 'mssql:iscluster',
|
||||||
@@ -26,7 +26,7 @@ const isCloudEditions = [
|
|||||||
11
|
11
|
||||||
];
|
];
|
||||||
|
|
||||||
export function setCommandContext(key: ContextKeys | string, value: any) {
|
function setCommandContext(key: ContextKeys | string, value: any) {
|
||||||
return vscode.commands.executeCommand(BuiltInCommands.SetContext, key, value);
|
return vscode.commands.executeCommand(BuiltInCommands.SetContext, key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ const resolveBookResources = (extension: vscode.Extension<any>, books: BookContr
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface BookContribution {
|
interface BookContribution {
|
||||||
name: string;
|
name: string;
|
||||||
path: string;
|
path: string;
|
||||||
when?: string;
|
when?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace BookContributions {
|
namespace BookContributions {
|
||||||
|
|
||||||
export function merge(a: BookContribution[], b: BookContribution[]): BookContribution[] {
|
export function merge(a: BookContribution[], b: BookContribution[]): BookContribution[] {
|
||||||
if (!a) {
|
if (!a) {
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
'use strict';
|
|
||||||
|
|
||||||
export default require('error-ex')('EscapeException');
|
export default require('error-ex')('EscapeException');
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ export function parseAclList(aclString: string): AclEntry[] {
|
|||||||
* assumes the string has already been checked for validity.
|
* assumes the string has already been checked for validity.
|
||||||
* @param aclString The string representation of the ACL entry
|
* @param aclString The string representation of the ACL entry
|
||||||
*/
|
*/
|
||||||
export function parseAclEntry(aclString: string): AclEntry {
|
function parseAclEntry(aclString: string): AclEntry {
|
||||||
const parts: string[] = aclString.split(':');
|
const parts: string[] = aclString.split(':');
|
||||||
let i = 0;
|
let i = 0;
|
||||||
const scope: AclEntryScope = parts.length === 4 && parts[i++] === 'default' ? AclEntryScope.default : AclEntryScope.access;
|
const scope: AclEntryScope = parts.length === 4 && parts[i++] === 'default' ? AclEntryScope.default : AclEntryScope.access;
|
||||||
|
|||||||
@@ -15,19 +15,20 @@ import { PermissionStatus, AclEntry, parseAclList, PermissionType, parseAclPermi
|
|||||||
import { Mount } from './mount';
|
import { Mount } from './mount';
|
||||||
import { everyoneName, ownerPostfix, owningGroupPostfix } from '../localizedConstants';
|
import { everyoneName, ownerPostfix, owningGroupPostfix } from '../localizedConstants';
|
||||||
import { FileStatus, parseHdfsFileType } from './fileStatus';
|
import { FileStatus, parseHdfsFileType } from './fileStatus';
|
||||||
|
import { Readable, Transform } from 'stream';
|
||||||
|
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
const ErrorMessageInvalidDataStructure = localize('webhdfs.invalidDataStructure', "Invalid Data Structure");
|
const ErrorMessageInvalidDataStructure = localize('webhdfs.invalidDataStructure', "Invalid Data Structure");
|
||||||
|
|
||||||
const emitError = (instance, err) => {
|
const emitError = (instance: request.Request | Transform, err: any) => {
|
||||||
const isErrorEmitted = instance.errorEmitted;
|
const isErrorEmitted = (instance as any).errorEmitted;
|
||||||
|
|
||||||
if (!isErrorEmitted) {
|
if (!isErrorEmitted) {
|
||||||
instance.emit('error', err);
|
instance.emit('error', err);
|
||||||
instance.emit('finish');
|
instance.emit('finish');
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.errorEmitted = true;
|
(instance as any).errorEmitted = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class WebHDFS {
|
export class WebHDFS {
|
||||||
@@ -41,7 +42,7 @@ export class WebHDFS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let missingProps = ['host', 'port', 'path']
|
let missingProps = ['host', 'port', 'path']
|
||||||
.filter(p => !opts.hasOwnProperty(p) || !opts[p]);
|
.filter((p: keyof IHdfsOptions) => !opts.hasOwnProperty(p) || !opts[p]);
|
||||||
if (missingProps && missingProps.length > 0) {
|
if (missingProps && missingProps.length > 0) {
|
||||||
throw new Error(localize('webhdfs.missingProperties',
|
throw new Error(localize('webhdfs.missingProperties',
|
||||||
"Unable to create WebHDFS client due to missing options: ${0}", missingProps.join(', ')));
|
"Unable to create WebHDFS client due to missing options: ${0}", missingProps.join(', ')));
|
||||||
@@ -224,7 +225,7 @@ export class WebHDFS {
|
|||||||
);
|
);
|
||||||
this.ensureCookie(requestParams);
|
this.ensureCookie(requestParams);
|
||||||
// Add a wrapper to handle unauthorized requests by adding kerberos auth steps
|
// Add a wrapper to handle unauthorized requests by adding kerberos auth steps
|
||||||
let handler = (error, response) => {
|
let handler = (error: any, response: request.Response) => {
|
||||||
if (error && error.statusCode === 401 && this._requestParams.isKerberos) {
|
if (error && error.statusCode === 401 && this._requestParams.isKerberos) {
|
||||||
this.requestWithKerberosSync(requestParams, callback);
|
this.requestWithKerberosSync(requestParams, callback);
|
||||||
} else {
|
} else {
|
||||||
@@ -234,7 +235,7 @@ export class WebHDFS {
|
|||||||
this.doSendRequest(requestParams, handler);
|
this.doSendRequest(requestParams, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ensureCookie(requestParams: { headers?: {} }) {
|
private ensureCookie(requestParams: { headers?: { [key: string]: string } }) {
|
||||||
if (this._authCookie && this._authCookie.expiryTime() > Date.now()) {
|
if (this._authCookie && this._authCookie.expiryTime() > Date.now()) {
|
||||||
requestParams.headers = requestParams.headers || {};
|
requestParams.headers = requestParams.headers || {};
|
||||||
requestParams.headers['cookie'] = `${this._authCookie.key}=${this._authCookie.value}`;
|
requestParams.headers['cookie'] = `${this._authCookie.key}=${this._authCookie.value}`;
|
||||||
@@ -242,7 +243,7 @@ export class WebHDFS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private doSendRequest(requestParams: any, callback: (error: HdfsError, response: any) => void): void {
|
private doSendRequest(requestParams: any, callback: (error: HdfsError, response: any) => void): void {
|
||||||
request(requestParams, (error, response, body) => {
|
request(requestParams, (error: any, response: request.Response, body: any) => {
|
||||||
if (error || this.isError(response)) {
|
if (error || this.isError(response)) {
|
||||||
let hdfsError = this.parseError(response, body, error);
|
let hdfsError = this.parseError(response, body, error);
|
||||||
callback(hdfsError, response);
|
callback(hdfsError, response);
|
||||||
@@ -727,7 +728,7 @@ export class WebHDFS {
|
|||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let handleErr = (err) => {
|
let handleErr = (err: any) => {
|
||||||
replyStream.emit('error', err);
|
replyStream.emit('error', err);
|
||||||
replyStream.end();
|
replyStream.end();
|
||||||
};
|
};
|
||||||
@@ -735,7 +736,7 @@ export class WebHDFS {
|
|||||||
// After redirect, create valid stream to correct location
|
// After redirect, create valid stream to correct location
|
||||||
// and pipe the intermediate stream to it, unblocking the data flow
|
// and pipe the intermediate stream to it, unblocking the data flow
|
||||||
params.headers['content-type'] = 'application/octet-stream';
|
params.headers['content-type'] = 'application/octet-stream';
|
||||||
let upload = request(params, (err, res, bo) => {
|
let upload = request(params, (err: any, res: request.Response, bo: any) => {
|
||||||
if (err || this.isError(res)) {
|
if (err || this.isError(res)) {
|
||||||
emitError(replyStream, this.parseError(res, bo, err));
|
emitError(replyStream, this.parseError(res, bo, err));
|
||||||
replyStream.end();
|
replyStream.end();
|
||||||
@@ -760,11 +761,11 @@ export class WebHDFS {
|
|||||||
private doCreateWriteStream(params: any): fs.WriteStream {
|
private doCreateWriteStream(params: any): fs.WriteStream {
|
||||||
|
|
||||||
let canResume: boolean = true;
|
let canResume: boolean = true;
|
||||||
let stream = undefined;
|
let stream: Readable;
|
||||||
let req = request(params, (error, response, body) => {
|
let req = request(params, (error: any, response: request.Response, body: any) => {
|
||||||
// Handle redirect only if there was not an error (e.g. res is defined)
|
// Handle redirect only if there was not an error (e.g. res is defined)
|
||||||
if (response && this.isRedirect(response)) {
|
if (response && this.isRedirect(response)) {
|
||||||
let upload = request(Object.assign(params, { url: response.headers.location }), (err, res, bo) => {
|
let upload = request(Object.assign(params, { url: response.headers.location }), (err: any, res: request.Response, bo: any) => {
|
||||||
if (err || this.isError(res)) {
|
if (err || this.isError(res)) {
|
||||||
emitError(req, this.parseError(res, bo, err));
|
emitError(req, this.parseError(res, bo, err));
|
||||||
req.end();
|
req.end();
|
||||||
@@ -784,7 +785,7 @@ export class WebHDFS {
|
|||||||
emitError(req, this.parseError(response, body, error));
|
emitError(req, this.parseError(response, body, error));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
req.on('pipe', (src) => {
|
req.on('pipe', (src: Readable) => {
|
||||||
// Pause read stream
|
// Pause read stream
|
||||||
stream = src;
|
stream = src;
|
||||||
stream.pause();
|
stream.pause();
|
||||||
@@ -794,7 +795,7 @@ export class WebHDFS {
|
|||||||
canResume = false;
|
canResume = false;
|
||||||
stream.on('resume', () => {
|
stream.on('resume', () => {
|
||||||
if (!canResume) {
|
if (!canResume) {
|
||||||
stream._readableState.flowing = false;
|
(stream as any)._readableState.flowing = false; // i guess we are unsafely accessing this
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Unpipe initial request
|
// Unpipe initial request
|
||||||
@@ -845,7 +846,7 @@ export class WebHDFS {
|
|||||||
// Else, must add kerberos token and handle redirects
|
// Else, must add kerberos token and handle redirects
|
||||||
params.followRedirect = false;
|
params.followRedirect = false;
|
||||||
let replyStream = through();
|
let replyStream = through();
|
||||||
let handleErr = (err) => {
|
let handleErr = (err: any) => {
|
||||||
replyStream.emit('error', err);
|
replyStream.emit('error', err);
|
||||||
replyStream.end();
|
replyStream.end();
|
||||||
};
|
};
|
||||||
@@ -960,7 +961,7 @@ export class WebHDFS {
|
|||||||
this.unlink(path, recursive, callback);
|
this.unlink(path, recursive, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createClient(opts, requestParams): WebHDFS {
|
public static createClient(opts: IHdfsOptions, requestParams: IRequestParams): WebHDFS {
|
||||||
return new WebHDFS(
|
return new WebHDFS(
|
||||||
Object.assign(
|
Object.assign(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -181,8 +181,8 @@ async function handleNewNotebookTask(oeContext?: azdata.ObjectExplorerContext, p
|
|||||||
|
|
||||||
async function handleOpenNotebookTask(profile: azdata.IConnectionProfile): Promise<void> {
|
async function handleOpenNotebookTask(profile: azdata.IConnectionProfile): Promise<void> {
|
||||||
let notebookFileTypeName = localize('notebookFileType', "Notebooks");
|
let notebookFileTypeName = localize('notebookFileType', "Notebooks");
|
||||||
let filter = {};
|
let filter: { [key: string]: string[] } = {};
|
||||||
filter[notebookFileTypeName] = 'ipynb';
|
filter[notebookFileTypeName] = ['ipynb'];
|
||||||
let uris = await vscode.window.showOpenDialog({
|
let uris = await vscode.window.showOpenDialog({
|
||||||
filters: filter,
|
filters: filter,
|
||||||
canSelectFiles: true,
|
canSelectFiles: true,
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ import * as utils from '../utils';
|
|||||||
import * as constants from '../constants';
|
import * as constants from '../constants';
|
||||||
import { AppContext } from '../appContext';
|
import { AppContext } from '../appContext';
|
||||||
|
|
||||||
export interface ICommandContextParsingOptions {
|
interface ICommandContextParsingOptions {
|
||||||
editor: boolean;
|
editor: boolean;
|
||||||
uri: boolean;
|
uri: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICommandBaseContext {
|
interface ICommandBaseContext {
|
||||||
command: string;
|
command: string;
|
||||||
editor?: vscode.TextEditor;
|
editor?: vscode.TextEditor;
|
||||||
uri?: vscode.Uri;
|
uri?: vscode.Uri;
|
||||||
@@ -30,7 +30,7 @@ export interface ICommandUnknownContext extends ICommandBaseContext {
|
|||||||
type: 'unknown';
|
type: 'unknown';
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICommandUriContext extends ICommandBaseContext {
|
interface ICommandUriContext extends ICommandBaseContext {
|
||||||
type: 'uri';
|
type: 'uri';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ export interface ICommandObjectExplorerContext extends ICommandBaseContext {
|
|||||||
explorerContext: azdata.ObjectExplorerContext;
|
explorerContext: azdata.ObjectExplorerContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CommandContext = ICommandObjectExplorerContext | ICommandViewContext | ICommandUriContext | ICommandUnknownContext;
|
type CommandContext = ICommandObjectExplorerContext | ICommandViewContext | ICommandUriContext | ICommandUnknownContext;
|
||||||
|
|
||||||
function isTextEditor(editor: any): editor is vscode.TextEditor {
|
function isTextEditor(editor: any): editor is vscode.TextEditor {
|
||||||
if (editor === undefined) { return false; }
|
if (editor === undefined) { return false; }
|
||||||
|
|||||||
@@ -106,10 +106,11 @@ export interface IFileSource {
|
|||||||
exists(path: string): Promise<boolean>;
|
exists(path: string): Promise<boolean>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IHttpAuthentication {
|
interface IHttpAuthentication {
|
||||||
user: string;
|
user: string;
|
||||||
pass: string;
|
pass: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IHdfsOptions {
|
export interface IHdfsOptions {
|
||||||
host?: string;
|
host?: string;
|
||||||
port?: number;
|
port?: number;
|
||||||
@@ -176,7 +177,7 @@ export class FileSourceFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HdfsFileSource implements IFileSource {
|
class HdfsFileSource implements IFileSource {
|
||||||
private mounts: Map<string, Mount>;
|
private mounts: Map<string, Mount>;
|
||||||
constructor(private client: WebHDFS) {
|
constructor(private client: WebHDFS) {
|
||||||
}
|
}
|
||||||
@@ -240,7 +241,7 @@ export class HdfsFileSource implements IFileSource {
|
|||||||
public readFile(path: string, maxBytes?: number): Promise<Buffer> {
|
public readFile(path: string, maxBytes?: number): Promise<Buffer> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let error: HdfsError = undefined;
|
let error: HdfsError = undefined;
|
||||||
let remoteFileStream = this.client.createReadStream(path);
|
let remoteFileStream: fs.ReadStream | meter.StreamMeter = this.client.createReadStream(path);
|
||||||
remoteFileStream.on('error', (err) => {
|
remoteFileStream.on('error', (err) => {
|
||||||
error = <HdfsError>err;
|
error = <HdfsError>err;
|
||||||
reject(error);
|
reject(error);
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ export class UploadFilesCommand extends ProgressCommand {
|
|||||||
try {
|
try {
|
||||||
let folderNode = await getNode<FolderNode>(context, this.appContext);
|
let folderNode = await getNode<FolderNode>(context, this.appContext);
|
||||||
const allFilesFilter = localize('allFiles', "All Files");
|
const allFilesFilter = localize('allFiles', "All Files");
|
||||||
let filter = {};
|
let filter: { [key: string]: string[] } = {};
|
||||||
filter[allFilesFilter] = '*';
|
filter[allFilesFilter] = ['*'];
|
||||||
if (folderNode) {
|
if (folderNode) {
|
||||||
let options: vscode.OpenDialogOptions = {
|
let options: vscode.OpenDialogOptions = {
|
||||||
canSelectFiles: true,
|
canSelectFiles: true,
|
||||||
@@ -175,7 +175,7 @@ export class MkDirCommand extends ProgressCommand {
|
|||||||
}).then(confirmed => <string>confirmed);
|
}).then(confirmed => <string>confirmed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async mkDir(fileName, folderNode: FolderNode, cancelToken: vscode.CancellationTokenSource): Promise<void> {
|
private async mkDir(fileName: string, folderNode: FolderNode, cancelToken: vscode.CancellationTokenSource): Promise<void> {
|
||||||
await folderNode.mkdir(fileName);
|
await folderNode.mkdir(fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import * as nls from 'vscode-nls';
|
|||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
import * as Constants from '../constants';
|
import * as Constants from '../constants';
|
||||||
import { IFileSource, IHdfsOptions, IFile, File, FileSourceFactory, FileType } from './fileSources';
|
import { IFileSource, IFile, File, FileType } from './fileSources';
|
||||||
import { CancelableStream } from './cancelableStream';
|
import { CancelableStream } from './cancelableStream';
|
||||||
import { TreeNode } from './treeNodes';
|
import { TreeNode } from './treeNodes';
|
||||||
import * as utils from '../utils';
|
import * as utils from '../utils';
|
||||||
@@ -28,53 +28,6 @@ export class TreeDataContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HdfsProvider implements vscode.TreeDataProvider<TreeNode>, ITreeChangeHandler {
|
|
||||||
static readonly NoConnectionsMessage = 'No connections added';
|
|
||||||
static readonly ConnectionsLabel = 'Connections';
|
|
||||||
|
|
||||||
private connections: ConnectionNode[];
|
|
||||||
private _onDidChangeTreeData = new vscode.EventEmitter<TreeNode>();
|
|
||||||
private context: TreeDataContext;
|
|
||||||
|
|
||||||
constructor(extensionContext: vscode.ExtensionContext) {
|
|
||||||
this.connections = [];
|
|
||||||
this.context = new TreeDataContext(extensionContext, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public get onDidChangeTreeData(): vscode.Event<TreeNode> {
|
|
||||||
return this._onDidChangeTreeData.event;
|
|
||||||
}
|
|
||||||
|
|
||||||
getTreeItem(element: TreeNode): vscode.TreeItem | Thenable<vscode.TreeItem> {
|
|
||||||
return element.getTreeItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
getChildren(element?: TreeNode): vscode.ProviderResult<TreeNode[]> {
|
|
||||||
if (element) {
|
|
||||||
return element.getChildren(false);
|
|
||||||
} else {
|
|
||||||
return this.connections.length > 0 ? this.connections : [ErrorNode.create(HdfsProvider.NoConnectionsMessage, element)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addConnection(displayName: string, fileSource: IFileSource): void {
|
|
||||||
if (!this.connections.find(c => c.getDisplayName() === displayName)) {
|
|
||||||
this.connections.push(new ConnectionNode(this.context, displayName, fileSource));
|
|
||||||
this._onDidChangeTreeData.fire();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async addHdfsConnection(options: IHdfsOptions): Promise<void> {
|
|
||||||
let displayName = `${options.user}@${options.host}:${options.port}`;
|
|
||||||
let fileSource = await FileSourceFactory.instance.createHdfsFileSource(options);
|
|
||||||
this.addConnection(displayName, fileSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
notifyNodeChanged(node: TreeNode): void {
|
|
||||||
this._onDidChangeTreeData.fire(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export abstract class HdfsFileSourceNode extends TreeNode {
|
export abstract class HdfsFileSourceNode extends TreeNode {
|
||||||
constructor(protected context: TreeDataContext, protected _path: string, public readonly fileSource: IFileSource, protected mountStatus?: MountStatus) {
|
constructor(protected context: TreeDataContext, protected _path: string, public readonly fileSource: IFileSource, protected mountStatus?: MountStatus) {
|
||||||
super();
|
super();
|
||||||
@@ -362,7 +315,7 @@ export class FileNode extends HdfsFileSourceNode implements IFileNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorNode extends TreeNode {
|
class ErrorNode extends TreeNode {
|
||||||
static messageNum: number = 0;
|
static messageNum: number = 0;
|
||||||
|
|
||||||
private _nodePathValue: string;
|
private _nodePathValue: string;
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
@@ -72,7 +70,7 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements azd
|
|||||||
|
|
||||||
private async doExpandNode(nodeInfo: azdata.ExpandNodeInfo, isRefresh: boolean = false): Promise<boolean> {
|
private async doExpandNode(nodeInfo: azdata.ExpandNodeInfo, isRefresh: boolean = false): Promise<boolean> {
|
||||||
let session = this.sessionMap.get(nodeInfo.sessionId);
|
let session = this.sessionMap.get(nodeInfo.sessionId);
|
||||||
let response = {
|
let response: azdata.ObjectExplorerExpandInfo = {
|
||||||
sessionId: nodeInfo.sessionId,
|
sessionId: nodeInfo.sessionId,
|
||||||
nodePath: nodeInfo.nodePath,
|
nodePath: nodeInfo.nodePath,
|
||||||
errorMessage: undefined,
|
errorMessage: undefined,
|
||||||
@@ -235,7 +233,7 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements azd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SqlClusterSession {
|
class SqlClusterSession {
|
||||||
private _rootNode: SqlClusterRootNode;
|
private _rootNode: SqlClusterRootNode;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
import { window } from 'vscode';
|
import { window } from 'vscode';
|
||||||
import PromptFactory from './factory';
|
import PromptFactory from './factory';
|
||||||
import EscapeException from '../escapeException';
|
import EscapeException from '../escapeException';
|
||||||
import { IQuestion, IPrompter, IPromptCallback } from './question';
|
import { IQuestion, IPrompter } from './question';
|
||||||
|
|
||||||
// Supports simple pattern for prompting for user input and acting on this
|
// Supports simple pattern for prompting for user input and acting on this
|
||||||
export default class CodeAdapter implements IPrompter {
|
export default class CodeAdapter implements IPrompter {
|
||||||
|
|
||||||
// TODO define question interface
|
// TODO define question interface
|
||||||
private fixQuestion(question: any): any {
|
private fixQuestion(question: IQuestion): any {
|
||||||
if (question.type === 'checkbox' && Array.isArray(question.choices)) {
|
if (question.type === 'checkbox' && Array.isArray(question.choices)) {
|
||||||
// For some reason when there's a choice of checkboxes, they aren't formatted properly
|
// For some reason when there's a choice of checkboxes, they aren't formatted properly
|
||||||
// Not sure where the issue is
|
// Not sure where the issue is
|
||||||
@@ -46,7 +46,7 @@ export default class CodeAdapter implements IPrompter {
|
|||||||
return PromptFactory.createPrompt(question, ignoreFocusOut);
|
return PromptFactory.createPrompt(question, ignoreFocusOut);
|
||||||
}).then(prompt => {
|
}).then(prompt => {
|
||||||
if (!question.shouldPrompt || question.shouldPrompt(answers) === true) {
|
if (!question.shouldPrompt || question.shouldPrompt(answers) === true) {
|
||||||
return prompt.render().then(result => {
|
return prompt.render().then((result: T) => {
|
||||||
answers[question.name] = result;
|
answers[question.name] = result;
|
||||||
|
|
||||||
if (question.onAnswered) {
|
if (question.onAnswered) {
|
||||||
@@ -67,14 +67,4 @@ export default class CodeAdapter implements IPrompter {
|
|||||||
window.showErrorMessage(err.message);
|
window.showErrorMessage(err.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper to make it possible to prompt using callback pattern. Generally Promise is a preferred flow
|
|
||||||
public promptCallback(questions: IQuestion[], callback: IPromptCallback): void {
|
|
||||||
// Collapse multiple questions into a set of prompt steps
|
|
||||||
this.prompt(questions).then(answers => {
|
|
||||||
if (callback) {
|
|
||||||
callback(answers);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
|
||||||
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
|
||||||
|
|
||||||
import { window } from 'vscode';
|
|
||||||
import Prompt from './prompt';
|
|
||||||
import EscapeException from '../escapeException';
|
|
||||||
|
|
||||||
const figures = require('figures');
|
|
||||||
|
|
||||||
export default class CheckboxPrompt extends Prompt {
|
|
||||||
|
|
||||||
constructor(question: any, ignoreFocusOut?: boolean) {
|
|
||||||
super(question, ignoreFocusOut);
|
|
||||||
}
|
|
||||||
|
|
||||||
public render(): any {
|
|
||||||
let choices = this._question.choices.reduce((result, choice) => {
|
|
||||||
let choiceName = choice.name || choice;
|
|
||||||
result[`${choice.checked === true ? figures.radioOn : figures.radioOff} ${choiceName}`] = choice;
|
|
||||||
return result;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
let options = this.defaultQuickPickOptions;
|
|
||||||
options.placeHolder = this._question.message;
|
|
||||||
|
|
||||||
let quickPickOptions = Object.keys(choices);
|
|
||||||
quickPickOptions.push(figures.tick);
|
|
||||||
|
|
||||||
return window.showQuickPick(quickPickOptions, options)
|
|
||||||
.then(result => {
|
|
||||||
if (result === undefined) {
|
|
||||||
throw new EscapeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result !== figures.tick) {
|
|
||||||
choices[result].checked = !choices[result].checked;
|
|
||||||
|
|
||||||
return this.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._question.choices.reduce((result2, choice) => {
|
|
||||||
if (choice.checked === true) {
|
|
||||||
result2.push(choice.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result2;
|
|
||||||
}, []);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
||||||
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
||||||
|
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
|
||||||
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
|
||||||
|
|
||||||
import vscode = require('vscode');
|
|
||||||
import Prompt from './prompt';
|
|
||||||
import EscapeException from '../escapeException';
|
|
||||||
import { INameValueChoice } from './question';
|
|
||||||
|
|
||||||
const figures = require('figures');
|
|
||||||
|
|
||||||
export default class ExpandPrompt extends Prompt {
|
|
||||||
|
|
||||||
constructor(question: any, ignoreFocusOut?: boolean) {
|
|
||||||
super(question, ignoreFocusOut);
|
|
||||||
}
|
|
||||||
|
|
||||||
public render(): any {
|
|
||||||
// label indicates this is a quickpick item. Otherwise it's a name-value pair
|
|
||||||
if (this._question.choices[0].label) {
|
|
||||||
return this.renderQuickPick(this._question.choices);
|
|
||||||
} else {
|
|
||||||
return this.renderNameValueChoice(this._question.choices);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private renderQuickPick(choices: vscode.QuickPickItem[]): any {
|
|
||||||
let options = this.defaultQuickPickOptions;
|
|
||||||
options.placeHolder = this._question.message;
|
|
||||||
|
|
||||||
return vscode.window.showQuickPick(choices, options)
|
|
||||||
.then(result => {
|
|
||||||
if (result === undefined) {
|
|
||||||
throw new EscapeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.validateAndReturn(result || false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
private renderNameValueChoice(choices: INameValueChoice[]): any {
|
|
||||||
const choiceMap = this._question.choices.reduce((result, choice) => {
|
|
||||||
result[choice.name] = choice.value;
|
|
||||||
return result;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
let options = this.defaultQuickPickOptions;
|
|
||||||
options.placeHolder = this._question.message;
|
|
||||||
|
|
||||||
return vscode.window.showQuickPick(Object.keys(choiceMap), options)
|
|
||||||
.then(result => {
|
|
||||||
if (result === undefined) {
|
|
||||||
throw new EscapeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: cannot be used with 0 or false responses
|
|
||||||
let returnVal = choiceMap[result] || false;
|
|
||||||
return this.validateAndReturn(returnVal);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private validateAndReturn(value: any): any {
|
|
||||||
if (!this.validate(value)) {
|
|
||||||
return this.render();
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private validate(value: any): boolean {
|
|
||||||
const validationError = this._question.validate ? this._question.validate(value || '') : undefined;
|
|
||||||
|
|
||||||
if (validationError) {
|
|
||||||
this._question.message = `${figures.warning} ${validationError}`;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +1,22 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
||||||
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
||||||
|
|
||||||
import Prompt from './prompt';
|
import Prompt from './prompt';
|
||||||
import InputPrompt from './input';
|
import InputPrompt from './input';
|
||||||
import PasswordPrompt from './password';
|
import PasswordPrompt from './password';
|
||||||
import ListPrompt from './list';
|
|
||||||
import ConfirmPrompt from './confirm';
|
import ConfirmPrompt from './confirm';
|
||||||
import CheckboxPrompt from './checkbox';
|
import { IQuestion } from './question';
|
||||||
import ExpandPrompt from './expand';
|
|
||||||
|
|
||||||
export default class PromptFactory {
|
export default class PromptFactory {
|
||||||
|
|
||||||
public static createPrompt(question: any, ignoreFocusOut?: boolean): Prompt {
|
public static createPrompt(question: IQuestion, ignoreFocusOut?: boolean): Prompt {
|
||||||
switch (question.type || 'input') {
|
switch (question.type) {
|
||||||
case 'string':
|
|
||||||
case 'input':
|
case 'input':
|
||||||
return new InputPrompt(question, ignoreFocusOut);
|
return new InputPrompt(question, ignoreFocusOut);
|
||||||
case 'password':
|
case 'password':
|
||||||
return new PasswordPrompt(question, ignoreFocusOut);
|
return new PasswordPrompt(question, ignoreFocusOut);
|
||||||
case 'list':
|
|
||||||
return new ListPrompt(question, ignoreFocusOut);
|
|
||||||
case 'confirm':
|
case 'confirm':
|
||||||
return new ConfirmPrompt(question, ignoreFocusOut);
|
return new ConfirmPrompt(question, ignoreFocusOut);
|
||||||
case 'checkbox':
|
|
||||||
return new CheckboxPrompt(question, ignoreFocusOut);
|
|
||||||
case 'expand':
|
|
||||||
return new ExpandPrompt(question, ignoreFocusOut);
|
|
||||||
default:
|
default:
|
||||||
throw new Error(`Could not find a prompt for question type ${question.type}`);
|
throw new Error(`Could not find a prompt for question type ${question.type}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
||||||
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
|
||||||
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
|
||||||
|
|
||||||
import { window } from 'vscode';
|
|
||||||
import Prompt from './prompt';
|
|
||||||
import EscapeException from '../escapeException';
|
|
||||||
|
|
||||||
export default class ListPrompt extends Prompt {
|
|
||||||
constructor(question: any, ignoreFocusOut?: boolean) {
|
|
||||||
super(question, ignoreFocusOut);
|
|
||||||
}
|
|
||||||
|
|
||||||
public render(): any {
|
|
||||||
const choices = this._question.choices.reduce((result, choice) => {
|
|
||||||
result[choice.name] = choice.value;
|
|
||||||
return result;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
let options = this.defaultQuickPickOptions;
|
|
||||||
options.placeHolder = this._question.message;
|
|
||||||
|
|
||||||
return window.showQuickPick(Object.keys(choices), options)
|
|
||||||
.then(result => {
|
|
||||||
if (result === undefined) {
|
|
||||||
throw new EscapeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
return choices[result];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
||||||
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
||||||
|
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
|
||||||
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
|
||||||
|
|
||||||
import {window, StatusBarItem, StatusBarAlignment} from 'vscode';
|
|
||||||
|
|
||||||
export default class ProgressIndicator {
|
|
||||||
|
|
||||||
private _statusBarItem: StatusBarItem;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this._statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left);
|
|
||||||
}
|
|
||||||
|
|
||||||
private _tasks: string[] = [];
|
|
||||||
public beginTask(task: string): void {
|
|
||||||
this._tasks.push(task);
|
|
||||||
this.displayProgressIndicator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public endTask(task: string): void {
|
|
||||||
if (this._tasks.length > 0) {
|
|
||||||
this._tasks.pop();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
private setMessage(): void {
|
|
||||||
if (this._tasks.length === 0) {
|
|
||||||
this._statusBarItem.text = '';
|
|
||||||
this.hideProgressIndicator();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._statusBarItem.text = this._tasks[this._tasks.length - 1];
|
|
||||||
this._statusBarItem.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private _interval: any;
|
|
||||||
private displayProgressIndicator(): void {
|
|
||||||
this.setMessage();
|
|
||||||
this.hideProgressIndicator();
|
|
||||||
this._interval = setInterval(() => this.onDisplayProgressIndicator(), 100);
|
|
||||||
}
|
|
||||||
private hideProgressIndicator(): void {
|
|
||||||
if (this._interval) {
|
|
||||||
clearInterval(this._interval);
|
|
||||||
this._interval = undefined;
|
|
||||||
}
|
|
||||||
this.ProgressCounter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ProgressText = ['|', '/', '-', '\\', '|', '/', '-', '\\'];
|
|
||||||
private ProgressCounter = 0;
|
|
||||||
private onDisplayProgressIndicator(): void {
|
|
||||||
if (this._tasks.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let txt = this.ProgressText[this.ProgressCounter];
|
|
||||||
this._statusBarItem.text = this._tasks[this._tasks.length - 1] + ' ' + txt;
|
|
||||||
this.ProgressCounter++;
|
|
||||||
|
|
||||||
if (this.ProgressCounter >= this.ProgressText.length - 1) {
|
|
||||||
this.ProgressCounter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,15 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
// This code is originally from https://github.com/DonJayamanne/bowerVSCode
|
||||||
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
// License: https://github.com/DonJayamanne/bowerVSCode/blob/master/LICENSE
|
||||||
|
|
||||||
import { InputBoxOptions, QuickPickOptions } from 'vscode';
|
import { InputBoxOptions, QuickPickOptions } from 'vscode';
|
||||||
|
import { IQuestion } from './question';
|
||||||
|
|
||||||
abstract class Prompt {
|
abstract class Prompt {
|
||||||
|
|
||||||
protected _question: any;
|
protected _question: IQuestion;
|
||||||
protected _ignoreFocusOut?: boolean;
|
protected _ignoreFocusOut?: boolean;
|
||||||
|
|
||||||
constructor(question: any, ignoreFocusOut?: boolean) {
|
constructor(question: IQuestion, ignoreFocusOut?: boolean) {
|
||||||
this._question = question;
|
this._question = question;
|
||||||
this._ignoreFocusOut = ignoreFocusOut ? ignoreFocusOut : false;
|
this._ignoreFocusOut = ignoreFocusOut ? ignoreFocusOut : false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,12 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import vscode = require('vscode');
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
export class QuestionTypes {
|
export class QuestionTypes {
|
||||||
public static get input(): string { return 'input'; }
|
public static get input(): string { return 'input'; }
|
||||||
public static get password(): string { return 'password'; }
|
public static get password(): string { return 'password'; }
|
||||||
public static get list(): string { return 'list'; }
|
|
||||||
public static get confirm(): string { return 'confirm'; }
|
public static get confirm(): string { return 'confirm'; }
|
||||||
public static get checkbox(): string { return 'checkbox'; }
|
|
||||||
public static get expand(): string { return 'expand'; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Question interface to clarify how to use the prompt feature
|
// Question interface to clarify how to use the prompt feature
|
||||||
@@ -40,19 +37,11 @@ export interface IQuestion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pair used to display simple choices to the user
|
// Pair used to display simple choices to the user
|
||||||
export interface INameValueChoice {
|
interface INameValueChoice {
|
||||||
name: string;
|
name: string;
|
||||||
value: any;
|
value: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic object that can be used to define a set of questions and handle the result
|
|
||||||
export interface IQuestionHandler {
|
|
||||||
// Set of questions to be answered
|
|
||||||
questions: IQuestion[];
|
|
||||||
// Optional callback, since questions may handle themselves
|
|
||||||
callback?: IPromptCallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IPrompter {
|
export interface IPrompter {
|
||||||
promptSingle<T>(question: IQuestion, ignoreFocusOut?: boolean): Promise<T>;
|
promptSingle<T>(question: IQuestion, ignoreFocusOut?: boolean): Promise<T>;
|
||||||
/**
|
/**
|
||||||
@@ -61,10 +50,5 @@ export interface IPrompter {
|
|||||||
* @returns 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
|
* the user canceled the question session
|
||||||
*/
|
*/
|
||||||
prompt<T>(questions: IQuestion[], ignoreFocusOut?: boolean): Promise<{ [questionId: string]: any }>;
|
prompt(questions: IQuestion[], ignoreFocusOut?: boolean): Promise<{ [questionId: string]: any }>;
|
||||||
promptCallback(questions: IQuestion[], callback: IPromptCallback): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IPromptCallback {
|
|
||||||
(answers: { [id: string]: any }): void;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
'use strict';
|
|
||||||
|
|
||||||
export const serviceName = 'AzureResourceProvider';
|
export const serviceName = 'AzureResourceProvider';
|
||||||
export const providerId = 'azureresourceProvider';
|
export const providerId = 'azureresourceProvider';
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { RequestType } from 'vscode-languageclient';
|
import { RequestType } from 'vscode-languageclient';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
@@ -25,7 +24,7 @@ export interface CreateFirewallRuleParams {
|
|||||||
securityTokenMappings: {};
|
securityTokenMappings: {};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateFirewallRuleResponse {
|
interface CreateFirewallRuleResponse {
|
||||||
result: boolean;
|
result: boolean;
|
||||||
errorMessage: string;
|
errorMessage: string;
|
||||||
}
|
}
|
||||||
@@ -36,7 +35,7 @@ export interface HandleFirewallRuleParams {
|
|||||||
connectionTypeId: string;
|
connectionTypeId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface HandleFirewallRuleResponse {
|
interface HandleFirewallRuleResponse {
|
||||||
result: boolean;
|
result: boolean;
|
||||||
ipAddress: string;
|
ipAddress: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import { IConfig, ServerProvider } from 'service-downloader';
|
import { IConfig, ServerProvider } from 'service-downloader';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export class SparkJobSubmissionModel {
|
|||||||
private readonly _sqlClusterConnection: SqlClusterConnection,
|
private readonly _sqlClusterConnection: SqlClusterConnection,
|
||||||
private readonly _dialog: azdata.window.Dialog,
|
private readonly _dialog: azdata.window.Dialog,
|
||||||
private readonly _appContext: AppContext,
|
private readonly _appContext: AppContext,
|
||||||
requestService?: (args: any) => any) {
|
requestService?: typeof import('request-promise')) {
|
||||||
|
|
||||||
if (!this._sqlClusterConnection || !this._dialog || !this._appContext) {
|
if (!this._sqlClusterConnection || !this._dialog || !this._appContext) {
|
||||||
throw new Error(localize('sparkJobSubmission.SparkJobSubmissionModelInitializeError',
|
throw new Error(localize('sparkJobSubmission.SparkJobSubmissionModelInitializeError',
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
@@ -12,12 +10,13 @@ import * as constants from '../../../constants';
|
|||||||
import { SqlClusterConnection } from '../../../objectExplorerNodeProvider/connection';
|
import { SqlClusterConnection } from '../../../objectExplorerNodeProvider/connection';
|
||||||
import * as utils from '../../../utils';
|
import * as utils from '../../../utils';
|
||||||
import * as auth from '../../../util/auth';
|
import * as auth from '../../../util/auth';
|
||||||
|
import { Options } from 'request-promise';
|
||||||
|
|
||||||
export class SparkJobSubmissionService {
|
export class SparkJobSubmissionService {
|
||||||
private _requestPromise: (args: any) => any;
|
private _requestPromise: typeof import('request-promise');
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
requestService?: (args: any) => any) {
|
requestService?: typeof import('request-promise')) {
|
||||||
if (requestService) {
|
if (requestService) {
|
||||||
// this is to fake the request service for test.
|
// this is to fake the request service for test.
|
||||||
this._requestPromise = requestService;
|
this._requestPromise = requestService;
|
||||||
@@ -33,7 +32,7 @@ export class SparkJobSubmissionService {
|
|||||||
// Get correct authentication headers
|
// Get correct authentication headers
|
||||||
let headers = await this.getAuthenticationHeaders(submissionArgs);
|
let headers = await this.getAuthenticationHeaders(submissionArgs);
|
||||||
|
|
||||||
let options = {
|
let options: Options = {
|
||||||
uri: livyUrl,
|
uri: livyUrl,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
json: true,
|
json: true,
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { AppContext } from '../appContext';
|
import { AppContext } from '../appContext';
|
||||||
|
|||||||
@@ -1,217 +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 * as childProcess from 'child_process';
|
|
||||||
import * as fs from 'fs-extra';
|
|
||||||
import * as path from 'path';
|
|
||||||
import * as azdata from 'azdata';
|
|
||||||
import * as vscode from 'vscode';
|
|
||||||
import * as which from 'which';
|
|
||||||
import * as constants from '../constants';
|
|
||||||
import * as nls from 'vscode-nls';
|
|
||||||
const localize = nls.loadMessageBundle();
|
|
||||||
|
|
||||||
export function getDropdownValue(dropdownValue: string | azdata.CategoryValue): string {
|
|
||||||
if (typeof (dropdownValue) === 'string') {
|
|
||||||
return <string>dropdownValue;
|
|
||||||
} else {
|
|
||||||
return dropdownValue ? (<azdata.CategoryValue>dropdownValue).name : undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getServerAddressFromName(connection: azdata.ConnectionInfo | string): string {
|
|
||||||
// Strip TDS port number from the server URI
|
|
||||||
if ((<azdata.ConnectionInfo>connection).options && (<azdata.ConnectionInfo>connection).options[constants.hostPropName]) {
|
|
||||||
return (<azdata.ConnectionInfo>connection).options[constants.hostPropName].split(',')[0].split(':')[0];
|
|
||||||
} else if ((<azdata.ConnectionInfo>connection).options && (<azdata.ConnectionInfo>connection).options['server']) {
|
|
||||||
return (<azdata.ConnectionInfo>connection).options['server'].split(',')[0].split(':')[0];
|
|
||||||
} else {
|
|
||||||
return (<string>connection).split(',')[0].split(':')[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getKnoxUrl(host: string, port: string): string {
|
|
||||||
return `https://${host}:${port}/gateway`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getLivyUrl(serverName: string, port: string): string {
|
|
||||||
return this.getKnoxUrl(serverName, port) + '/default/livy/v1/';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getTemplatePath(extensionPath: string, templateName: string): string {
|
|
||||||
return path.join(extensionPath, 'resources', templateName);
|
|
||||||
}
|
|
||||||
export function shellWhichResolving(cmd: string): Promise<string> {
|
|
||||||
return new Promise<string>(resolve => {
|
|
||||||
which(cmd, async (err, foundPath) => {
|
|
||||||
if (err) {
|
|
||||||
resolve(undefined);
|
|
||||||
} else {
|
|
||||||
// NOTE: Using realpath b/c some system installs are symlinked from */bin
|
|
||||||
resolve(await fs.promises.realpath(foundPath));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function mkDir(dirPath: string, outputChannel?: vscode.OutputChannel): Promise<void> {
|
|
||||||
if (!await fs.exists(dirPath)) {
|
|
||||||
if (outputChannel) {
|
|
||||||
outputChannel.appendLine(localize('mkdirOutputMsg', "... Creating {0}", dirPath));
|
|
||||||
}
|
|
||||||
await fs.ensureDir(dirPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getErrorMessage(error: Error | string): string {
|
|
||||||
return (error instanceof Error) ? error.message : error;
|
|
||||||
}
|
|
||||||
|
|
||||||
// COMMAND EXECUTION HELPERS ///////////////////////////////////////////////
|
|
||||||
export function executeBufferedCommand(cmd: string, options: childProcess.ExecOptions, outputChannel?: vscode.OutputChannel): Thenable<string> {
|
|
||||||
return new Promise<string>((resolve, reject) => {
|
|
||||||
if (outputChannel) {
|
|
||||||
outputChannel.appendLine(` > ${cmd}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
let child = childProcess.exec(cmd, options, (err, stdout) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
} else {
|
|
||||||
resolve(stdout);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add listeners to print stdout and stderr if an output channel was provided
|
|
||||||
if (outputChannel) {
|
|
||||||
child.stdout.on('data', data => { outputDataChunk(data, outputChannel, ' stdout: '); });
|
|
||||||
child.stderr.on('data', data => { outputDataChunk(data, outputChannel, ' stderr: '); });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function executeExitCodeCommand(cmd: string, outputChannel?: vscode.OutputChannel): Thenable<number> {
|
|
||||||
return new Promise<number>((resolve, reject) => {
|
|
||||||
if (outputChannel) {
|
|
||||||
outputChannel.appendLine(` > ${cmd}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
let child = childProcess.spawn(cmd, [], { shell: true, detached: false });
|
|
||||||
|
|
||||||
// Add listeners for the process to exit
|
|
||||||
child.on('error', reject);
|
|
||||||
child.on('exit', (code: number) => { resolve(code); });
|
|
||||||
|
|
||||||
// Add listeners to print stdout and stderr if an output channel was provided
|
|
||||||
if (outputChannel) {
|
|
||||||
child.stdout.on('data', data => { outputDataChunk(data, outputChannel, ' stdout: '); });
|
|
||||||
child.stderr.on('data', data => { outputDataChunk(data, outputChannel, ' stderr: '); });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function executeStreamedCommand(cmd: string, outputChannel?: vscode.OutputChannel): Thenable<void> {
|
|
||||||
return new Promise<void>((resolve, reject) => {
|
|
||||||
// Start the command
|
|
||||||
if (outputChannel) {
|
|
||||||
outputChannel.appendLine(` > ${cmd}`);
|
|
||||||
}
|
|
||||||
let child = childProcess.spawn(cmd, [], { shell: true, detached: false });
|
|
||||||
|
|
||||||
// Add listeners to resolve/reject the promise on exit
|
|
||||||
child.on('error', reject);
|
|
||||||
child.on('exit', (code: number) => {
|
|
||||||
if (code === 0) {
|
|
||||||
resolve();
|
|
||||||
} else {
|
|
||||||
reject(localize('executeCommandProcessExited', "Process exited with code {0}", code));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add listeners to print stdout and stderr if an output channel was provided
|
|
||||||
if (outputChannel) {
|
|
||||||
child.stdout.on('data', data => { outputDataChunk(data, outputChannel, ' stdout: '); });
|
|
||||||
child.stderr.on('data', data => { outputDataChunk(data, outputChannel, ' stderr: '); });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isObjectExplorerContext(object: any): object is azdata.ObjectExplorerContext {
|
|
||||||
return 'connectionProfile' in object && 'isConnectionNode' in object;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getUserHome(): string {
|
|
||||||
return process.env.HOME || process.env.USERPROFILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum Platform {
|
|
||||||
Mac,
|
|
||||||
Linux,
|
|
||||||
Windows,
|
|
||||||
Others
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getOSPlatform(): Platform {
|
|
||||||
switch (process.platform) {
|
|
||||||
case 'win32':
|
|
||||||
return Platform.Windows;
|
|
||||||
case 'darwin':
|
|
||||||
return Platform.Mac;
|
|
||||||
case 'linux':
|
|
||||||
return Platform.Linux;
|
|
||||||
default:
|
|
||||||
return Platform.Others;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getOSPlatformId(): string {
|
|
||||||
let platformId = undefined;
|
|
||||||
switch (process.platform) {
|
|
||||||
case 'win32':
|
|
||||||
platformId = 'win-x64';
|
|
||||||
break;
|
|
||||||
case 'darwin':
|
|
||||||
platformId = 'osx';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
platformId = 'linux-x64';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return platformId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// PRIVATE HELPERS /////////////////////////////////////////////////////////
|
|
||||||
function outputDataChunk(data: string | Buffer, outputChannel: vscode.OutputChannel, header: string): void {
|
|
||||||
data.toString().split(/\r?\n/)
|
|
||||||
.forEach(line => {
|
|
||||||
outputChannel.appendLine(header + line);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function clone<T>(obj: T): T {
|
|
||||||
if (!obj || typeof obj !== 'object') {
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
if (obj instanceof RegExp) {
|
|
||||||
// See https://github.com/Microsoft/TypeScript/issues/10990
|
|
||||||
return obj as any;
|
|
||||||
}
|
|
||||||
const result = (Array.isArray(obj)) ? <any>[] : <any>{};
|
|
||||||
Object.keys(obj).forEach(key => {
|
|
||||||
if (obj[key] && typeof obj[key] === 'object') {
|
|
||||||
result[key] = clone(obj[key]);
|
|
||||||
} else {
|
|
||||||
result[key] = obj[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isValidNumber(maybeNumber: any) {
|
|
||||||
return maybeNumber !== undefined
|
|
||||||
&& maybeNumber !== null
|
|
||||||
&& maybeNumber !== ''
|
|
||||||
&& !isNaN(Number(maybeNumber.toString()));
|
|
||||||
}
|
|
||||||
@@ -26,7 +26,7 @@ export interface ITelemetryEventMeasures {
|
|||||||
/**
|
/**
|
||||||
* Filters error paths to only include source files. Exported to support testing
|
* Filters error paths to only include source files. Exported to support testing
|
||||||
*/
|
*/
|
||||||
export function FilterErrorPath(line: string): string {
|
function FilterErrorPath(line: string): string {
|
||||||
if (line) {
|
if (line) {
|
||||||
let values: string[] = line.split('/out/');
|
let values: string[] = line.split('/out/');
|
||||||
if (values.length <= 1) {
|
if (values.length <= 1) {
|
||||||
|
|||||||
19
extensions/mssql/src/typings/bufferStreamReader.d.ts
vendored
Normal file
19
extensions/mssql/src/typings/bufferStreamReader.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
declare module 'buffer-stream-reader' {
|
||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
|
class BufferStreamReader {
|
||||||
|
constructor(stream: string | Buffer);
|
||||||
|
pipe(pipe: fs.WriteStream): void
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace BufferStreamReader {
|
||||||
|
interface FindRemoveOptions {
|
||||||
|
age?: {
|
||||||
|
seconds?: number;
|
||||||
|
};
|
||||||
|
limit?: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export = BufferStreamReader;
|
||||||
|
}
|
||||||
17
extensions/mssql/src/typings/findRemove.d.ts
vendored
Normal file
17
extensions/mssql/src/typings/findRemove.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
declare module 'find-remove' {
|
||||||
|
namespace findRemove {
|
||||||
|
interface FindRemoveApi {
|
||||||
|
(path: string, options: FindRemoveOptions): JSON;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FindRemoveOptions {
|
||||||
|
age?: {
|
||||||
|
seconds?: number;
|
||||||
|
};
|
||||||
|
limit?: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const findRemove: findRemove.FindRemoveApi;
|
||||||
|
export = findRemove;
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
export function disposeAll(disposables: vscode.Disposable[]) {
|
function disposeAll(disposables: vscode.Disposable[]) {
|
||||||
while (disposables.length) {
|
while (disposables.length) {
|
||||||
const item = disposables.pop();
|
const item = disposables.pop();
|
||||||
if (item) {
|
if (item) {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export function getCommonLaunchArgsAndCleanupOldLogFiles(logPath: string, fileNa
|
|||||||
return launchArgs;
|
return launchArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ensure(target: object, key: string): any {
|
export function ensure(target: { [key: string]: any }, key: string): any {
|
||||||
if (target[key] === void 0) {
|
if (target[key] === void 0) {
|
||||||
target[key] = {} as any;
|
target[key] = {} as any;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "./out",
|
"outDir": "./out",
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUnusedParameters": false,
|
"noUnusedParameters": false
|
||||||
"noImplicitAny": false
|
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*"
|
"src/**/*"
|
||||||
|
|||||||
@@ -2,6 +2,16 @@
|
|||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
"@types/bluebird@*":
|
||||||
|
version "3.5.28"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/bluebird/-/bluebird-3.5.28.tgz#04c1a520ff076649236bc8ca21198542ce2bdb09"
|
||||||
|
integrity sha512-0Vk/kqkukxPKSzP9c8WJgisgGDx5oZDbsLLWIP5t70yThO/YleE+GEm2S1GlRALTaack3O7U5OS5qEm7q2kciA==
|
||||||
|
|
||||||
|
"@types/bytes@^3.0.0":
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/bytes/-/bytes-3.0.0.tgz#549eeacd0a8fecfaa459334583a4edcee738e6db"
|
||||||
|
integrity sha512-ZF43+CIIlzngQe8/Zo7L1kpY9W8O6rO006VDz3c5iM21ddtXWxCEyOXyft+q4pVF2tGqvrVuVrEDH1+gJEi1fQ==
|
||||||
|
|
||||||
"@types/caseless@*":
|
"@types/caseless@*":
|
||||||
version "0.12.2"
|
version "0.12.2"
|
||||||
resolved "https://registry.yarnpkg.com/@types/caseless/-/caseless-0.12.2.tgz#f65d3d6389e01eeb458bd54dc8f52b95a9463bc8"
|
resolved "https://registry.yarnpkg.com/@types/caseless/-/caseless-0.12.2.tgz#f65d3d6389e01eeb458bd54dc8f52b95a9463bc8"
|
||||||
@@ -17,6 +27,24 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.2.tgz#c4e63af5e8823ce9cc3f0b34f7b998c2171f0c44"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.2.tgz#c4e63af5e8823ce9cc3f0b34f7b998c2171f0c44"
|
||||||
integrity sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg==
|
integrity sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg==
|
||||||
|
|
||||||
|
"@types/request-promise@^4.1.44":
|
||||||
|
version "4.1.44"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/request-promise/-/request-promise-4.1.44.tgz#05b59cd18445832fae16b68d5bb3d4621b549485"
|
||||||
|
integrity sha512-RId7eFsUKxfal1LirDDIcOp9u3MM3NXFDBcC3sqIMcmu7f4U6DsCEMD8RbLZtnPrQlN5Jc79di/WPsIEDO4keg==
|
||||||
|
dependencies:
|
||||||
|
"@types/bluebird" "*"
|
||||||
|
"@types/request" "*"
|
||||||
|
|
||||||
|
"@types/request@*":
|
||||||
|
version "2.48.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/request/-/request-2.48.3.tgz#970b8ed2317568c390361d29c555a95e74bd6135"
|
||||||
|
integrity sha512-3Wo2jNYwqgXcIz/rrq18AdOZUQB8cQ34CXZo+LUwPJNpvRAL86+Kc2wwI8mqpz9Cr1V+enIox5v+WZhy/p3h8w==
|
||||||
|
dependencies:
|
||||||
|
"@types/caseless" "*"
|
||||||
|
"@types/node" "*"
|
||||||
|
"@types/tough-cookie" "*"
|
||||||
|
form-data "^2.5.0"
|
||||||
|
|
||||||
"@types/request@^2.48.2":
|
"@types/request@^2.48.2":
|
||||||
version "2.48.2"
|
version "2.48.2"
|
||||||
resolved "https://registry.yarnpkg.com/@types/request/-/request-2.48.2.tgz#936374cbe1179d7ed529fc02543deb4597450fed"
|
resolved "https://registry.yarnpkg.com/@types/request/-/request-2.48.2.tgz#936374cbe1179d7ed529fc02543deb4597450fed"
|
||||||
@@ -27,6 +55,13 @@
|
|||||||
"@types/tough-cookie" "*"
|
"@types/tough-cookie" "*"
|
||||||
form-data "^2.5.0"
|
form-data "^2.5.0"
|
||||||
|
|
||||||
|
"@types/stream-meter@^0.0.22":
|
||||||
|
version "0.0.22"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/stream-meter/-/stream-meter-0.0.22.tgz#6602f644ea0f5468cae13931ee6611a3a03fbab1"
|
||||||
|
integrity sha512-gqqudd3q69aEmixGIL1p2qN1AySZ+UJ2j6y70ZXZBg8/SmzTM1MvkOKvmuelKNIpPS8bKml6Gw03pfbnI8YpwQ==
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "*"
|
||||||
|
|
||||||
"@types/through2@^2.0.34":
|
"@types/through2@^2.0.34":
|
||||||
version "2.0.34"
|
version "2.0.34"
|
||||||
resolved "https://registry.yarnpkg.com/@types/through2/-/through2-2.0.34.tgz#9c2a259a238dace2a05a2f8e94b786961bc27ac4"
|
resolved "https://registry.yarnpkg.com/@types/through2/-/through2-2.0.34.tgz#9c2a259a238dace2a05a2f8e94b786961bc27ac4"
|
||||||
@@ -534,15 +569,6 @@ fs-constants@^1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
|
resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
|
||||||
integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==
|
integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==
|
||||||
|
|
||||||
fs-extra@^3.0.1:
|
|
||||||
version "3.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.1.tgz#3794f378c58b342ea7dbbb23095109c4b3b62291"
|
|
||||||
integrity sha1-N5TzeMWLNC6n27sjCVEJxLO2IpE=
|
|
||||||
dependencies:
|
|
||||||
graceful-fs "^4.1.2"
|
|
||||||
jsonfile "^3.0.0"
|
|
||||||
universalify "^0.1.0"
|
|
||||||
|
|
||||||
fs.realpath@^1.0.0:
|
fs.realpath@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||||
@@ -594,7 +620,7 @@ glob@^7.0.5:
|
|||||||
once "^1.3.0"
|
once "^1.3.0"
|
||||||
path-is-absolute "^1.0.0"
|
path-is-absolute "^1.0.0"
|
||||||
|
|
||||||
graceful-fs@^4.1.10, graceful-fs@^4.1.2, graceful-fs@^4.1.6:
|
graceful-fs@^4.1.10:
|
||||||
version "4.1.15"
|
version "4.1.15"
|
||||||
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00"
|
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00"
|
||||||
integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==
|
integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==
|
||||||
@@ -742,13 +768,6 @@ json-stringify-safe@~5.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
|
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
|
||||||
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
|
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=
|
||||||
|
|
||||||
jsonfile@^3.0.0:
|
|
||||||
version "3.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66"
|
|
||||||
integrity sha1-pezG9l9T9mLEQVx2daAzHQmS7GY=
|
|
||||||
optionalDependencies:
|
|
||||||
graceful-fs "^4.1.6"
|
|
||||||
|
|
||||||
jsprim@^1.2.2:
|
jsprim@^1.2.2:
|
||||||
version "1.4.1"
|
version "1.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
|
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
|
||||||
@@ -1320,11 +1339,6 @@ unbzip2-stream@^1.0.9:
|
|||||||
buffer "^5.2.1"
|
buffer "^5.2.1"
|
||||||
through "^2.3.8"
|
through "^2.3.8"
|
||||||
|
|
||||||
universalify@^0.1.0:
|
|
||||||
version "0.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
|
|
||||||
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
|
|
||||||
|
|
||||||
uri-js@^4.2.2:
|
uri-js@^4.2.2:
|
||||||
version "4.2.2"
|
version "4.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
|
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0"
|
||||||
|
|||||||
2
src/sql/azdata.d.ts
vendored
2
src/sql/azdata.d.ts
vendored
@@ -93,7 +93,7 @@ declare module 'azdata' {
|
|||||||
azureTenantId?: string;
|
azureTenantId?: string;
|
||||||
options: { [name: string]: any };
|
options: { [name: string]: any };
|
||||||
|
|
||||||
static createFrom(options: Map<string, any>): ConnectionProfile;
|
static createFrom(options: { [key: string]: any }): ConnectionProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -697,9 +697,9 @@ export class ConnectionProfile {
|
|||||||
this.options['azureTenantId'] = value;
|
this.options['azureTenantId'] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
options: Map<string, any> = new Map<string, any>();
|
options: { [key: string]: any } = {};
|
||||||
|
|
||||||
static createFrom(options: Map<string, any>): ConnectionProfile {
|
static createFrom(options: { [key: string]: any }): ConnectionProfile {
|
||||||
let profile = new ConnectionProfile();
|
let profile = new ConnectionProfile();
|
||||||
profile.options = options;
|
profile.options = options;
|
||||||
return profile;
|
return profile;
|
||||||
|
|||||||
Reference in New Issue
Block a user