mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Renable Strict TSLint (#5018)
* removes more builder references * remove builder from profiler * formatting * fix profiler dailog * remove builder from oatuhdialog * remove the rest of builder references * formatting * add more strict null checks to base * enable strict tslint rules * fix formatting * fix compile error * fix the rest of the hygeny issues and add pipeline step * fix pipeline files
This commit is contained in:
@@ -27,9 +27,24 @@ steps:
|
||||
displayName: 'Install'
|
||||
|
||||
- script: |
|
||||
node_modules/.bin/gulp electron
|
||||
node_modules/.bin/gulp compile --max_old_space_size=4096
|
||||
displayName: 'Scripts'
|
||||
yarn gulp electron-x64
|
||||
displayName: Download Electron
|
||||
|
||||
- script: |
|
||||
yarn gulp hygiene
|
||||
displayName: Run Hygiene Checks
|
||||
|
||||
- script: |
|
||||
yarn tslint
|
||||
displayName: 'Run TSLint'
|
||||
|
||||
- script: |
|
||||
yarn strict-null-check
|
||||
displayName: 'Run Strict Null Check'
|
||||
|
||||
- script: |
|
||||
yarn compile
|
||||
displayName: 'Compile'
|
||||
|
||||
- script: |
|
||||
DISPLAY=:10 ./scripts/test.sh --reporter mocha-junit-reporter
|
||||
@@ -39,11 +54,3 @@ steps:
|
||||
inputs:
|
||||
testResultsFiles: '**/test-results.xml'
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- script: |
|
||||
yarn tslint
|
||||
displayName: 'Run TSLint'
|
||||
|
||||
- script: |
|
||||
yarn strict-null-check
|
||||
displayName: 'Run Strict Null Check'
|
||||
|
||||
@@ -9,11 +9,23 @@ steps:
|
||||
displayName: 'Yarn Install'
|
||||
|
||||
- script: |
|
||||
.\node_modules\.bin\gulp electron
|
||||
yarn gulp electron-x64
|
||||
displayName: 'Electron'
|
||||
|
||||
- script: |
|
||||
npm run compile
|
||||
yarn gulp hygiene
|
||||
displayName: Run Hygiene Checks
|
||||
|
||||
- script: |
|
||||
yarn tslint
|
||||
displayName: 'Run TSLint'
|
||||
|
||||
- script: |
|
||||
yarn strict-null-check
|
||||
displayName: 'Run Strict Null Check'
|
||||
|
||||
- script: |
|
||||
yarn compile
|
||||
displayName: 'Compile'
|
||||
|
||||
- script: |
|
||||
@@ -24,11 +36,3 @@ steps:
|
||||
inputs:
|
||||
testResultsFiles: 'test-results.xml'
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- script: |
|
||||
yarn tslint
|
||||
displayName: 'Run TSLint'
|
||||
|
||||
- script: |
|
||||
yarn strict-null-check
|
||||
displayName: 'Run Strict Null Check'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. 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';
|
||||
|
||||
@@ -90,7 +90,13 @@ const indentationFilter = [
|
||||
'!**/Dockerfile.*',
|
||||
'!**/*.Dockerfile',
|
||||
'!**/*.dockerfile',
|
||||
'!extensions/markdown-language-features/media/*.js'
|
||||
'!extensions/markdown-language-features/media/*.js',
|
||||
// {{SQL CARBON EDIT}}
|
||||
'!**/*.xlf',
|
||||
'!**/*.docx',
|
||||
'!**/*.sql',
|
||||
'!extensions/mssql/sqltoolsservice/**',
|
||||
'!extensions/import/flatfileimportservice/**',
|
||||
];
|
||||
|
||||
const copyrightFilter = [
|
||||
@@ -119,7 +125,36 @@ const copyrightFilter = [
|
||||
'!resources/completions/**',
|
||||
'!extensions/markdown-language-features/media/highlight.css',
|
||||
'!extensions/html-language-features/server/src/modes/typescript/*',
|
||||
'!extensions/*/server/bin/*'
|
||||
'!extensions/*/server/bin/*',
|
||||
// {{SQL CARBON EDIT}}
|
||||
'!extensions/notebook/src/intellisense/text.ts',
|
||||
'!extensions/mssql/src/objectExplorerNodeProvider/webhdfs.ts',
|
||||
'!src/sql/workbench/parts/notebook/outputs/tableRenderers.ts',
|
||||
'!src/sql/workbench/parts/notebook/outputs/common/url.ts',
|
||||
'!src/sql/workbench/parts/notebook/outputs/common/renderMimeInterfaces.ts',
|
||||
'!src/sql/workbench/parts/notebook/outputs/common/outputProcessor.ts',
|
||||
'!src/sql/workbench/parts/notebook/outputs/common/mimemodel.ts',
|
||||
'!src/sql/workbench/parts/notebook/cellViews/media/output.css',
|
||||
'!src/sql/base/browser/ui/table/plugins/rowSelectionModel.plugin.ts',
|
||||
'!src/sql/base/browser/ui/table/plugins/rowDetailView.ts',
|
||||
'!src/sql/base/browser/ui/table/plugins/headerFilter.plugin.ts',
|
||||
'!src/sql/base/browser/ui/table/plugins/checkboxSelectColumn.plugin.ts',
|
||||
'!src/sql/base/browser/ui/table/plugins/cellSelectionModel.plugin.ts',
|
||||
'!src/sql/base/browser/ui/table/plugins/autoSizeColumns.plugin.ts',
|
||||
'!src/sql/workbench/parts/notebook/outputs/sanitizer.ts',
|
||||
'!src/sql/workbench/parts/notebook/outputs/renderers.ts',
|
||||
'!src/sql/workbench/parts/notebook/outputs/registry.ts',
|
||||
'!src/sql/workbench/parts/notebook/outputs/factories.ts',
|
||||
'!src/sql/workbench/parts/notebook/models/nbformat.ts',
|
||||
'!extensions/markdown-language-features/media/tomorrow.css',
|
||||
'!src/sql/parts/modelComponents/highlight.css',
|
||||
'!extensions/mssql/sqltoolsservice/**',
|
||||
'!extensions/import/flatfileimportservice/**',
|
||||
'!extensions/notebook/src/prompts/**',
|
||||
'!extensions/mssql/src/prompts/**',
|
||||
'!extensions/notebook/resources/jupyter_config/**',
|
||||
'!**/*.gif',
|
||||
'!**/*.xlf'
|
||||
];
|
||||
|
||||
const eslintFilter = [
|
||||
@@ -165,8 +200,7 @@ gulp.task('eslint', () => {
|
||||
});
|
||||
|
||||
gulp.task('tslint', () => {
|
||||
// {{SQL CARBON EDIT}}
|
||||
const options = { emitError: false };
|
||||
const options = { emitError: true };
|
||||
|
||||
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
||||
.pipe(filter(tslintFilter))
|
||||
@@ -264,9 +298,8 @@ function hygiene(some) {
|
||||
.pipe(filter(f => !f.stat.isDirectory()))
|
||||
.pipe(filter(indentationFilter))
|
||||
.pipe(indentation)
|
||||
.pipe(filter(copyrightFilter));
|
||||
// {{SQL CARBON EDIT}}
|
||||
// .pipe(copyrights);
|
||||
.pipe(filter(copyrightFilter))
|
||||
.pipe(copyrights);
|
||||
|
||||
const typescript = result
|
||||
.pipe(filter(tslintFilter))
|
||||
@@ -276,15 +309,38 @@ function hygiene(some) {
|
||||
const javascript = result
|
||||
.pipe(filter(eslintFilter))
|
||||
.pipe(gulpeslint('src/.eslintrc'))
|
||||
.pipe(gulpeslint.formatEach('compact'));
|
||||
// {{SQL CARBON EDIT}}
|
||||
// .pipe(gulpeslint.failAfterError());
|
||||
.pipe(gulpeslint.formatEach('compact'))
|
||||
.pipe(gulpeslint.failAfterError());
|
||||
|
||||
let count = 0;
|
||||
return es.merge(typescript, javascript)
|
||||
.pipe(es.through(function (data) {
|
||||
// {{SQL CARBON EDIT}}
|
||||
count++;
|
||||
if (process.env['TRAVIS'] && count % 10 === 0) {
|
||||
process.stdout.write('.');
|
||||
}
|
||||
this.emit('data', data);
|
||||
}, function () {
|
||||
process.stdout.write('\n');
|
||||
|
||||
const tslintResult = tsLinter.getResult();
|
||||
if (tslintResult.failures.length > 0) {
|
||||
for (const failure of tslintResult.failures) {
|
||||
const name = failure.getFileName();
|
||||
const position = failure.getStartPosition();
|
||||
const line = position.getLineAndCharacter().line;
|
||||
const character = position.getLineAndCharacter().character;
|
||||
|
||||
console.error(`${name}:${line + 1}:${character + 1}:${failure.getFailure()}`);
|
||||
}
|
||||
errorCount += tslintResult.failures.length;
|
||||
}
|
||||
|
||||
if (errorCount > 0) {
|
||||
this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.');
|
||||
} else {
|
||||
this.emit('end');
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,6 @@
|
||||
'use strict';
|
||||
|
||||
const gulp = require('gulp');
|
||||
const json = require('gulp-json-editor');
|
||||
const buffer = require('gulp-buffer');
|
||||
const filter = require('gulp-filter');
|
||||
const es = require('event-stream');
|
||||
const vfs = require('vinyl-fs');
|
||||
const pkg = require('../package.json');
|
||||
const cp = require('child_process');
|
||||
const fancyLog = require('fancy-log');
|
||||
const ansiColors = require('ansi-colors');
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
const jeditor = require('gulp-json-editor');
|
||||
|
||||
@@ -28,7 +28,6 @@ const formatFiles = (some) => {
|
||||
console.info('ran formatting on file ' + file.path + ' result: ' + result.message);
|
||||
if (result.error) {
|
||||
console.error(result.message);
|
||||
errorCount++;
|
||||
}
|
||||
cb(null, file);
|
||||
|
||||
@@ -40,7 +39,7 @@ const formatFiles = (some) => {
|
||||
.pipe(filter(f => !f.stat.isDirectory()))
|
||||
.pipe(formatting);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
const formatStagedFiles = () => {
|
||||
const cp = require('child_process');
|
||||
@@ -81,4 +80,4 @@ const formatStagedFiles = () => {
|
||||
process.exit(1);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -27,7 +27,7 @@ const zipPath = arch => path.join(zipDir(arch), `VSCode-win32-${arch}.zip`);
|
||||
const setupDir = (arch, target) => path.join(repoPath, '.build', `win32-${arch}`, `${target}-setup`);
|
||||
const issPath = path.join(__dirname, 'win32', 'code.iss');
|
||||
const innoSetupPath = path.join(path.dirname(path.dirname(require.resolve('innosetup-compiler'))), 'bin', 'ISCC.exe');
|
||||
const signPS1 = path.join(repoPath, 'build', 'azure-pipelines', 'win32', 'sign.ps1');
|
||||
// const signPS1 = path.join(repoPath, 'build', 'azure-pipelines', 'win32', 'sign.ps1');
|
||||
|
||||
function packageInnoSetup(iss, options, cb) {
|
||||
options = options || {};
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
///
|
||||
'use strict';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as path from 'path';
|
||||
@@ -12,8 +10,7 @@ import * as vscode from 'vscode';
|
||||
import { IConfig, ServerProvider } from 'service-downloader';
|
||||
import { Telemetry } from './telemetry';
|
||||
import * as utils from './utils';
|
||||
import { ChildProcess, exec, ExecException } from 'child_process';
|
||||
import { stringify } from 'querystring';
|
||||
import { ChildProcess, exec } from 'child_process';
|
||||
|
||||
const baseConfig = require('./config.json');
|
||||
const localize = nls.loadMessageBundle();
|
||||
@@ -116,7 +113,7 @@ function launchSsmsDialog(action: string, connectionProfile: azdata.IConnectionP
|
||||
let args = buildSsmsMinCommandArgs(params);
|
||||
|
||||
// This will be an async call since we pass in the callback
|
||||
var proc: ChildProcess = exec(
|
||||
let proc: ChildProcess = exec(
|
||||
/*command*/`"${exePath}" ${args}`,
|
||||
/*options*/undefined,
|
||||
(execException, stdout, stderr) => {
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import * as vscode from 'vscode';
|
||||
import * as data from 'azdata';
|
||||
|
||||
@@ -12,7 +11,6 @@ import * as data from 'azdata';
|
||||
* this API from our code
|
||||
*
|
||||
* @export
|
||||
* @class ApiWrapper
|
||||
*/
|
||||
export class ApiWrapper {
|
||||
// Data APIs
|
||||
|
||||
@@ -610,7 +610,8 @@ export class JobDialog extends AgentDialog<JobData> {
|
||||
{
|
||||
component: deleteJobContainer,
|
||||
title: ''
|
||||
}], title: this.NotificationsTabTopLabelString}]).withLayout({ width: '100%' }).component();
|
||||
}], title: this.NotificationsTabTopLabelString
|
||||
}]).withLayout({ width: '100%' }).component();
|
||||
|
||||
await view.initializeModel(formModel);
|
||||
this.emailConditionDropdown.values = this.model.JobCompletionActionConditions;
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
"sourceMap": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"declaration": true
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as adal from 'adal-node';
|
||||
import * as azdata from 'azdata';
|
||||
import * as request from 'request';
|
||||
@@ -54,8 +52,8 @@ export class AzureAccountProvider implements azdata.AccountProvider {
|
||||
|
||||
/**
|
||||
* Clears all tokens that belong to the given account from the token cache
|
||||
* @param {"data".AccountKey} accountKey Key identifying the account to delete tokens for
|
||||
* @returns {Thenable<void>} Promise to clear requested tokens from the token cache
|
||||
* @param accountKey Key identifying the account to delete tokens for
|
||||
* @returns Promise to clear requested tokens from the token cache
|
||||
*/
|
||||
public clear(accountKey: azdata.AccountKey): Thenable<void> {
|
||||
return this.doIfInitialized(() => this.clearAccountTokens(accountKey));
|
||||
@@ -63,7 +61,7 @@ export class AzureAccountProvider implements azdata.AccountProvider {
|
||||
|
||||
/**
|
||||
* Clears the entire token cache. Invoked by command palette action.
|
||||
* @returns {Thenable<void>} Promise to clear the token cache
|
||||
* @returns Promise to clear the token cache
|
||||
*/
|
||||
public clearTokenCache(): Thenable<void> {
|
||||
return this._tokenCache.clear();
|
||||
@@ -321,10 +319,10 @@ export class AzureAccountProvider implements azdata.AccountProvider {
|
||||
* Retrieves a token for the given user ID for the specific tenant ID. If the token can, it
|
||||
* will be retrieved from the cache as per the ADAL API. AFAIK, the ADAL API will also utilize
|
||||
* the refresh token if there aren't any unexpired tokens to use.
|
||||
* @param {string} userId ID of the user to get a token for
|
||||
* @param {string} tenantId Tenant to get the token for
|
||||
* @param {string} resourceId ID of the resource the token will be good for
|
||||
* @returns {Thenable<TokenResponse>} Promise to return a token. Rejected if retrieving the token fails.
|
||||
* @param userId ID of the user to get a token for
|
||||
* @param tenantId Tenant to get the token for
|
||||
* @param resourceId ID of the resource the token will be good for
|
||||
* @returns Promise to return a token. Rejected if retrieving the token fails.
|
||||
*/
|
||||
private getToken(userId: string, tenantId: string, resourceId: string): Thenable<adal.TokenResponse> {
|
||||
let self = this;
|
||||
@@ -346,9 +344,9 @@ export class AzureAccountProvider implements azdata.AccountProvider {
|
||||
|
||||
/**
|
||||
* Performs a web request using the provided bearer token
|
||||
* @param {TokenResponse} accessToken Bearer token for accessing the provided URI
|
||||
* @param {string} uri URI to access
|
||||
* @returns {Thenable<any>} Promise to return the deserialized body of the request. Rejected if error occurred.
|
||||
* @param accessToken Bearer token for accessing the provided URI
|
||||
* @param uri URI to access
|
||||
* @returns Promise to return the deserialized body of the request. Rejected if error occurred.
|
||||
*/
|
||||
private makeWebRequest(accessToken: adal.TokenResponse, uri: string): Thenable<any> {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as adal from 'adal-node';
|
||||
import * as azdata from 'azdata';
|
||||
import * as crypto from 'crypto';
|
||||
@@ -79,7 +77,7 @@ export default class TokenCache implements adal.TokenCache {
|
||||
/**
|
||||
* Wrapper to make callback-based find method into a thenable method
|
||||
* @param query Partial object to use to look up tokens. Ideally should be partial of adal.TokenResponse
|
||||
* @returns {Thenable<any[]>} Promise to return the matching adal.TokenResponse objects.
|
||||
* @returns Promise to return the matching adal.TokenResponse objects.
|
||||
* Rejected if an error was sent in the callback
|
||||
*/
|
||||
public findThenable(query: any): Thenable<any[]> {
|
||||
@@ -112,8 +110,8 @@ export default class TokenCache implements adal.TokenCache {
|
||||
|
||||
/**
|
||||
* Wrapper to make callback-based remove method into a thenable method
|
||||
* @param {TokenResponse[]} entries Array of entries to remove from the token cache
|
||||
* @returns {Thenable<void>} Promise to remove the given tokens from the token cache
|
||||
* @param entries Array of entries to remove from the token cache
|
||||
* @returns Promise to remove the given tokens from the token cache
|
||||
* Rejected if an error was sent in the callback
|
||||
*/
|
||||
public removeThenable(entries: adal.TokenResponse[]): Thenable<void> {
|
||||
@@ -186,8 +184,8 @@ export default class TokenCache implements adal.TokenCache {
|
||||
if (splitValues.length === 2 && splitValues[0] && splitValues[1]) {
|
||||
try {
|
||||
return <EncryptionParams>{
|
||||
key: new Buffer(splitValues[0], 'hex'),
|
||||
initializationVector: new Buffer(splitValues[1], 'hex')
|
||||
key: Buffer.from(splitValues[0], 'hex'),
|
||||
initializationVector: Buffer.from(splitValues[1], 'hex')
|
||||
};
|
||||
} catch (e) {
|
||||
// Swallow the error and fall through to generate new params
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
@@ -15,7 +13,6 @@ import * as constants from './constants';
|
||||
* this API from our code
|
||||
*
|
||||
* @export
|
||||
* @class ApiWrapper
|
||||
*/
|
||||
export class ApiWrapper {
|
||||
// Data APIs
|
||||
|
||||
@@ -16,8 +16,7 @@ import { AzureResourceResourceTreeNode } from '../../resourceTreeNode';
|
||||
|
||||
export function registerAzureResourceDatabaseCommands(appContext: AppContext): void {
|
||||
appContext.apiWrapper.registerCommand('azure.resource.connectsqldb', async (node?: TreeNode) => {
|
||||
if (!node)
|
||||
{
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@ import { AzureResourceResourceTreeNode } from '../../resourceTreeNode';
|
||||
|
||||
export function registerAzureResourceDatabaseServerCommands(appContext: AppContext): void {
|
||||
appContext.apiWrapper.registerCommand('azure.resource.connectsqlserver', async (node?: TreeNode) => {
|
||||
if (!node)
|
||||
{
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
@@ -13,7 +13,8 @@ import {
|
||||
IAzureResourceAccountService,
|
||||
IAzureResourceSubscriptionService,
|
||||
IAzureResourceSubscriptionFilterService,
|
||||
IAzureResourceTenantService } from '../azureResource/interfaces';
|
||||
IAzureResourceTenantService
|
||||
} from '../azureResource/interfaces';
|
||||
import { AzureResourceServiceNames } from '../azureResource/constants';
|
||||
import { AzureResourceTreeProvider } from '../azureResource/tree/treeProvider';
|
||||
import { registerAzureResourceCommands } from '../azureResource/commands';
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
'use strict';
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as fs from 'fs';
|
||||
@@ -23,7 +26,7 @@ let controllers: ControllerBase[] = [];
|
||||
// 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() {
|
||||
var platform = process.platform;
|
||||
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');
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { WizardPageBase } from '../../wizardPageBase';
|
||||
import { CreateClusterWizard } from '../createClusterWizard';
|
||||
import * as nls from 'vscode-nls';
|
||||
@@ -347,7 +345,7 @@ export class ClusterProfilePage extends WizardPageBase<CreateClusterWizard> {
|
||||
case ClusterPoolType.Spark:
|
||||
return localize('bdc-create.SparkPoolDisplayName', 'Spark pool');
|
||||
default:
|
||||
throw 'unknown pool type';
|
||||
throw new Error('unknown pool type');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +362,7 @@ export class ClusterProfilePage extends WizardPageBase<CreateClusterWizard> {
|
||||
case ClusterPoolType.Spark:
|
||||
return localize('bdc-create.SparkPoolDescription', 'TODO: Add description');
|
||||
default:
|
||||
throw 'unknown pool type';
|
||||
throw new Error('unknown pool type');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { WizardPageBase } from '../../wizardPageBase';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { DacFxDataModel } from './models';
|
||||
@@ -15,19 +14,16 @@ export abstract class BasePage {
|
||||
|
||||
/**
|
||||
* This method constructs all the elements of the page.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
public async abstract start(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* This method is called when the user is entering the page.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
public async abstract onPageEnter(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* This method is called when the user is leaving the page.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async onPageLeave(): Promise<boolean> {
|
||||
return true;
|
||||
@@ -35,7 +31,6 @@ export abstract class BasePage {
|
||||
|
||||
/**
|
||||
* Override this method to cleanup what you don't need cached in the page.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
public async cleanup(): Promise<boolean> {
|
||||
return true;
|
||||
@@ -136,4 +131,3 @@ export abstract class BasePage {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
|
||||
@@ -2,13 +2,9 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { RequestType, NotificationType } from 'vscode-languageclient';
|
||||
|
||||
/**
|
||||
* @interface IMessage
|
||||
*/
|
||||
export interface IMessage {
|
||||
jsonrpc: string;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as crypto from 'crypto';
|
||||
@@ -97,7 +96,7 @@ export function generateGuid(): string {
|
||||
}
|
||||
|
||||
export function verifyPlatform(): Thenable<boolean> {
|
||||
if (os.platform() === 'darwin' && parseFloat(os.release()) < 16.0) {
|
||||
if (os.platform() === 'darwin' && parseFloat(os.release()) < 16) {
|
||||
return Promise.resolve(false);
|
||||
} else {
|
||||
return Promise.resolve(true);
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { ErrorAction, CloseAction } from 'vscode-languageclient';
|
||||
import TelemetryReporter from 'vscode-extension-telemetry';
|
||||
import { PlatformInformation } from 'service-downloader/out/platform';
|
||||
@@ -20,7 +18,6 @@ import { IMessage, ITelemetryEventProperties, ITelemetryEventMeasures } from './
|
||||
|
||||
/**
|
||||
* Handle Language Service client errors
|
||||
* @class LanguageClientErrorHandler
|
||||
*/
|
||||
export class LanguageClientErrorHandler {
|
||||
|
||||
@@ -53,11 +50,6 @@ export class LanguageClientErrorHandler {
|
||||
/**
|
||||
* Callback for language service client error
|
||||
*
|
||||
* @param {Error} error
|
||||
* @param {Message} message
|
||||
* @param {number} count
|
||||
* @returns {ErrorAction}
|
||||
*
|
||||
* @memberOf LanguageClientErrorHandler
|
||||
*/
|
||||
error(error: Error, message: IMessage, count: number): ErrorAction {
|
||||
@@ -71,8 +63,6 @@ export class LanguageClientErrorHandler {
|
||||
/**
|
||||
* Callback for language service client closed
|
||||
*
|
||||
* @returns {CloseAction}
|
||||
*
|
||||
* @memberOf LanguageClientErrorHandler
|
||||
*/
|
||||
closed(): CloseAction {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { ImportDataModel } from './models';
|
||||
@@ -15,19 +14,16 @@ export abstract class BasePage {
|
||||
|
||||
/**
|
||||
* This method constructs all the elements of the page.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
public async abstract start(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* This method is called when the user is entering the page.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
public async abstract onPageEnter(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* This method is called when the user is leaving the page.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async onPageLeave(): Promise<boolean> {
|
||||
return true;
|
||||
@@ -35,7 +31,6 @@ export abstract class BasePage {
|
||||
|
||||
/**
|
||||
* Override this method to cleanup what you don't need cached in the page.
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
public async cleanup(): Promise<boolean> {
|
||||
return true;
|
||||
@@ -136,4 +131,3 @@ export abstract class BasePage {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
@@ -133,7 +131,6 @@ export class SummaryPage extends ImportPage {
|
||||
|
||||
/**
|
||||
* Gets the connection string to send to the middleware
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
private async getConnectionString(): Promise<string> {
|
||||
let options = this.model.server.options;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import { normalize, join } from 'path';
|
||||
@@ -12,10 +12,10 @@ const TEST_SETUP_COMPLETED_TEXT: string = 'Test Setup Completed';
|
||||
const EXTENSION_LOADED_TEXT: string = 'Test Extension Loaded';
|
||||
const ALL_EXTENSION_LOADED_TEXT: string = 'All Extensions Loaded';
|
||||
|
||||
var statusBarItemTimer: NodeJS.Timer;
|
||||
let statusBarItemTimer: NodeJS.Timer;
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
var statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
||||
let statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
||||
vscode.commands.registerCommand('test.setupIntegrationTest', async () => {
|
||||
let extensionInstallersFolder = normalize(join(__dirname, '../extensionInstallers'));
|
||||
let installers = fs.readdirSync(extensionInstallersFolder);
|
||||
|
||||
@@ -41,8 +41,8 @@ export enum EngineType {
|
||||
BigDataCluster
|
||||
}
|
||||
|
||||
var connectionProviderMapping = {};
|
||||
var authenticationTypeMapping = {};
|
||||
let connectionProviderMapping = {};
|
||||
let authenticationTypeMapping = {};
|
||||
connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' };
|
||||
|
||||
authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' };
|
||||
@@ -80,7 +80,7 @@ export class TestServerProfile {
|
||||
public get engineType(): EngineType { return this._profile.engineType; }
|
||||
}
|
||||
|
||||
var TestingServers: TestServerProfile[] = [
|
||||
let TestingServers: TestServerProfile[] = [
|
||||
new TestServerProfile(
|
||||
{
|
||||
serverName: getConfigValue(EnvironmentVariable_STANDALONE_SERVER),
|
||||
@@ -121,7 +121,7 @@ function getEnumMappingEntry(mapping: any, enumValue: any): INameDisplayNamePair
|
||||
if (entry) {
|
||||
return entry;
|
||||
} else {
|
||||
throw `Unknown enum type: ${enumValue.toString()}`;
|
||||
throw new Error(`Unknown enum type: ${enumValue.toString()}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export var context = {
|
||||
export let context = {
|
||||
RunTest: true
|
||||
};
|
||||
54
extensions/mssql/src/api/mssqlapis.d.ts
vendored
54
extensions/mssql/src/api/mssqlapis.d.ts
vendored
@@ -10,24 +10,17 @@ import * as vscode from 'vscode';
|
||||
|
||||
/**
|
||||
* The APIs provided by Mssql extension
|
||||
*
|
||||
* @export
|
||||
* @interface MssqlExtensionApi
|
||||
*/
|
||||
export interface MssqlExtensionApi {
|
||||
/**
|
||||
* Gets the object explorer API that supports querying over the connections supported by this extension
|
||||
*
|
||||
* @returns {IMssqlObjectExplorerBrowser}
|
||||
* @memberof IMssqlExtensionApi
|
||||
*/
|
||||
getMssqlObjectExplorerBrowser(): MssqlObjectExplorerBrowser;
|
||||
|
||||
/**
|
||||
* Get the Cms Service APIs to communicate with CMS connections supported by this extension
|
||||
*
|
||||
* @returns {Promise<CmsService>}
|
||||
* @memberof IMssqlExtensionApi
|
||||
*/
|
||||
getCmsServiceProvider(): Promise<CmsService>;
|
||||
}
|
||||
@@ -35,25 +28,16 @@ export interface MssqlExtensionApi {
|
||||
/**
|
||||
* A browser supporting actions over the object explorer connections provided by this extension.
|
||||
* Currently this is the
|
||||
*
|
||||
* @export
|
||||
* @interface MssqlObjectExplorerBrowser
|
||||
*/
|
||||
export interface MssqlObjectExplorerBrowser {
|
||||
/**
|
||||
* Gets the matching node given a context object, e.g. one from a right-click on a node in Object Explorer
|
||||
*
|
||||
* @param {azdata.ObjectExplorerContext} objectExplorerContext
|
||||
* @returns {Promise<T>}
|
||||
*/
|
||||
getNode<T extends ITreeNode>(objectExplorerContext: azdata.ObjectExplorerContext): Promise<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A tree node in the object explorer tree
|
||||
*
|
||||
* @export
|
||||
* @interface ITreeNode
|
||||
*/
|
||||
export interface ITreeNode {
|
||||
getNodeInfo(): azdata.NodeInfo;
|
||||
@@ -63,10 +47,6 @@ export interface ITreeNode {
|
||||
/**
|
||||
* A HDFS file node. This is a leaf node in the object explorer tree, and its contents
|
||||
* can be queried
|
||||
*
|
||||
* @export
|
||||
* @interface IFileNode
|
||||
* @extends {ITreeNode}
|
||||
*/
|
||||
export interface IFileNode extends ITreeNode {
|
||||
getFileContentsAsString(maxBytes?: number): Promise<string>;
|
||||
@@ -79,64 +59,31 @@ export interface IFileNode extends ITreeNode {
|
||||
export interface CmsService {
|
||||
/**
|
||||
* Connects to or creates a Central management Server
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {string} description
|
||||
* @param {azdata.ConnectionInfo} connectiondetails
|
||||
* @param {string} ownerUri
|
||||
* @returns {Thenable<azdata.ListRegisteredServersResult>}
|
||||
*/
|
||||
createCmsServer(name: string, description:string, connectiondetails: azdata.ConnectionInfo, ownerUri: string): Thenable<ListRegisteredServersResult>;
|
||||
|
||||
/**
|
||||
* gets all Registered Servers inside a CMS on a particular level
|
||||
*
|
||||
* @param {string} ownerUri
|
||||
* @param {string} relativePath
|
||||
* @returns {Thenable<azdata.ListRegisteredServersResult>}
|
||||
*/
|
||||
getRegisteredServers(ownerUri: string, relativePath: string): Thenable<ListRegisteredServersResult>;
|
||||
|
||||
/**
|
||||
* Adds a Registered Server inside a CMS on a particular level
|
||||
*
|
||||
* @param {string} ownerUri
|
||||
* @param {string} relativePath
|
||||
* @param {string} registeredServerName
|
||||
* @param {string} registeredServerDescription
|
||||
* @param {azdata.ConnectionInfo} connectiondetails
|
||||
* @returns {Thenable<boolean>>}
|
||||
*/
|
||||
addRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string, registeredServerDescription:string, connectionDetails:azdata.ConnectionInfo): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Removes a Registered Server inside a CMS on a particular level
|
||||
*
|
||||
* @param {string} ownerUri
|
||||
* @param {string} relativePath
|
||||
* @param {string} registeredServerName
|
||||
* @returns {Thenable<boolean>}
|
||||
*/
|
||||
removeRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Adds a Server Group inside a CMS on a particular level
|
||||
*
|
||||
* @param {string} ownerUri
|
||||
* @param {string} relativePath
|
||||
* @param {string} groupName
|
||||
* @param {string} groupDescription
|
||||
* @param {azdata.ConnectionInfo} connectiondetails
|
||||
*/
|
||||
addServerGroup (ownerUri: string, relativePath: string, groupName: string, groupDescription:string): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Removes a Server Group inside a CMS on a particular level
|
||||
*
|
||||
* @param {string} ownerUri
|
||||
* @param {string} relativePath
|
||||
* @param {string} groupName
|
||||
* @param {string} groupDescription
|
||||
*/
|
||||
removeServerGroup (ownerUri: string, relativePath: string, groupName: string): Thenable<boolean>;
|
||||
}
|
||||
@@ -162,4 +109,3 @@ export interface ListRegisteredServersResult {
|
||||
registeredServersList: Array<RegisteredServerResult>;
|
||||
registeredServerGroups: Array<RegisteredServerGroup>;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
@@ -13,7 +11,6 @@ import * as azdata from 'azdata';
|
||||
* this API from our code
|
||||
*
|
||||
* @export
|
||||
* @class ApiWrapper
|
||||
*/
|
||||
export class ApiWrapper {
|
||||
// Data APIs
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { NotificationType, RequestType } from 'vscode-languageclient';
|
||||
import { ITelemetryEventProperties, ITelemetryEventMeasures } from './telemetry';
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
export default require('error-ex')('EscapeException');
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { SqlOpsDataClient, SqlOpsFeature } from 'dataprotocol-client';
|
||||
import { ClientCapabilities, StaticFeature, RPCMessageType, ServerCapabilities } from 'vscode-languageclient';
|
||||
@@ -12,7 +11,6 @@ import * as contracts from './contracts';
|
||||
import * as azdata from 'azdata';
|
||||
import * as Utils from './utils';
|
||||
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
|
||||
import { ConnectParams } from 'dataprotocol-client/lib/protocol';
|
||||
|
||||
export class TelemetryFeature implements StaticFeature {
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vscode-nls';
|
||||
@@ -74,7 +73,9 @@ export abstract class Command extends vscode.Disposable {
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.disposable && this.disposable.dispose();
|
||||
if (this.disposable) {
|
||||
this.disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected get apiWrapper(): ApiWrapper {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
|
||||
@@ -10,7 +10,6 @@ import * as azdata from 'azdata';
|
||||
* A tree node in the object explorer tree
|
||||
*
|
||||
* @export
|
||||
* @interface ITreeNode
|
||||
*/
|
||||
export interface ITreeNode {
|
||||
getNodeInfo(): azdata.NodeInfo;
|
||||
@@ -22,7 +21,6 @@ export interface ITreeNode {
|
||||
* can be queried
|
||||
*
|
||||
* @export
|
||||
* @interface IFileNode
|
||||
* @extends {ITreeNode}
|
||||
*/
|
||||
export interface IFileNode extends ITreeNode {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// This code is originally from https://github.com/harrisiirak/webhdfs
|
||||
// License: https://github.com/harrisiirak/webhdfs/blob/master/LICENSE
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as url from 'url';
|
||||
import * as fs from 'fs';
|
||||
import * as querystring from 'querystring';
|
||||
@@ -53,10 +51,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Generate WebHDFS REST API endpoint URL for given operation
|
||||
*
|
||||
* @param {string} operation WebHDFS operation name
|
||||
* @param {string} path
|
||||
* @param {object} params
|
||||
* @returns {string} WebHDFS REST API endpoint URL
|
||||
* @param operation WebHDFS operation name
|
||||
* @returns WebHDFS REST API endpoint URL
|
||||
*/
|
||||
private getOperationEndpoint(operation: string, path: string, params?: object): string {
|
||||
let endpoint = this._url;
|
||||
@@ -73,8 +69,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Gets localized status message for given status code
|
||||
*
|
||||
* @param {number} statusCode Http status code
|
||||
* @returns {string} status message
|
||||
* @param statusCode Http status code
|
||||
* @returns status message
|
||||
*/
|
||||
private toStatusMessage(statusCode: number): string {
|
||||
let statusMessage: string = undefined;
|
||||
@@ -93,9 +89,9 @@ export class WebHDFS {
|
||||
/**
|
||||
* Gets status message from response
|
||||
*
|
||||
* @param {request.Response} response response object
|
||||
* @param {boolean} strict If set true then RemoteException must be present in the body
|
||||
* @returns {string} Error message interpreted by status code
|
||||
* @param response response object
|
||||
* @param strict If set true then RemoteException must be present in the body
|
||||
* @returns Error message interpreted by status code
|
||||
*/
|
||||
private getStatusMessage(response: request.Response): string {
|
||||
if (!response) { return undefined; }
|
||||
@@ -107,8 +103,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Gets remote exception message from response body
|
||||
*
|
||||
* @param {any} responseBody response body
|
||||
* @returns {string} Error message interpreted by status code
|
||||
* @param responseBody response body
|
||||
* @returns Error message interpreted by status code
|
||||
*/
|
||||
private getRemoteExceptionMessage(responseBody: any): string {
|
||||
if (!responseBody) { return undefined; }
|
||||
@@ -128,10 +124,10 @@ export class WebHDFS {
|
||||
/**
|
||||
* Generates error message descriptive as much as possible
|
||||
*
|
||||
* @param {string} statusMessage status message
|
||||
* @param {string} [remoteExceptionMessage] remote exception message
|
||||
* @param {any} [error] error
|
||||
* @returns {string} error message
|
||||
* @param statusMessage status message
|
||||
* @param [remoteExceptionMessage] remote exception message
|
||||
* @param [error] error
|
||||
* @returns error message
|
||||
*/
|
||||
private getErrorMessage(statusMessage: string, remoteExceptionMessage?: string, error?: any): string {
|
||||
statusMessage = statusMessage === '' ? undefined : statusMessage;
|
||||
@@ -146,10 +142,10 @@ export class WebHDFS {
|
||||
/**
|
||||
* Parse error state from response and return valid Error object
|
||||
*
|
||||
* @param {request.Response} response response object
|
||||
* @param {any} [responseBody] response body
|
||||
* @param {any} [error] error
|
||||
* @returns {HdfsError} HdfsError object
|
||||
* @param response response object
|
||||
* @param [responseBody] response body
|
||||
* @param [error] error
|
||||
* @returns HdfsError object
|
||||
*/
|
||||
private parseError(response: request.Response, responseBody?: any, error?: any): HdfsError {
|
||||
let statusMessage: string = this.getStatusMessage(response);
|
||||
@@ -165,8 +161,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Check if response is redirect
|
||||
*
|
||||
* @param {request.Response} response response object
|
||||
* @returns {boolean} if response is redirect
|
||||
* @param response response object
|
||||
* @returns if response is redirect
|
||||
*/
|
||||
private isRedirect(response: request.Response): boolean {
|
||||
return [301, 307].indexOf(response.statusCode) !== -1 &&
|
||||
@@ -176,8 +172,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Check if response is successful
|
||||
*
|
||||
* @param {request.Response} response response object
|
||||
* @returns {boolean} if response is successful
|
||||
* @param response response object
|
||||
* @returns if response is successful
|
||||
*/
|
||||
private isSuccess(response: request.Response): boolean {
|
||||
return [200, 201].indexOf(response.statusCode) !== -1;
|
||||
@@ -186,8 +182,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Check if response is error
|
||||
*
|
||||
* @param {request.Response} response response object
|
||||
* @returns {boolean} if response is error
|
||||
* @param response response object
|
||||
* @returns if response is error
|
||||
*/
|
||||
private isError(response: request.Response): boolean {
|
||||
return [400, 401, 402, 403, 404, 500].indexOf(response.statusCode) !== -1;
|
||||
@@ -196,10 +192,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Send a request to WebHDFS REST API
|
||||
*
|
||||
* @param {string} method HTTP method
|
||||
* @param {string} url
|
||||
* @param {object} opts Options for request
|
||||
* @param {(error: HdfsError, response: request.Response) => void} callback
|
||||
* @param method HTTP method
|
||||
* @param opts Options for request
|
||||
* @returns void
|
||||
*/
|
||||
private sendRequest(method: string, url: string, opts: object,
|
||||
@@ -234,10 +228,6 @@ export class WebHDFS {
|
||||
|
||||
/**
|
||||
* Change file permissions
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {string} mode
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public chmod(path: string, mode: string, callback: (error: HdfsError) => void): void {
|
||||
@@ -253,10 +243,8 @@ export class WebHDFS {
|
||||
/**
|
||||
* Change file owner
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {string} userId User name
|
||||
* @param {string} groupId Group name
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @param userId User name
|
||||
* @param groupId Group name
|
||||
* @returns void
|
||||
*/
|
||||
public chown(path: string, userId: string, groupId: string, callback: (error: HdfsError) => void): void {
|
||||
@@ -279,8 +267,6 @@ export class WebHDFS {
|
||||
/**
|
||||
* Read directory contents
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {(error: HdfsError, files: any[]) => void)} callback
|
||||
* @returns void
|
||||
*/
|
||||
public readdir(path: string, callback: (error: HdfsError, files: any[]) => void): void {
|
||||
@@ -305,10 +291,6 @@ export class WebHDFS {
|
||||
|
||||
/**
|
||||
* Make new directory
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {string} [permission=0755]
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public mkdir(path: string, permission: string = '0755', callback: (error: HdfsError) => void): void {
|
||||
@@ -327,10 +309,6 @@ export class WebHDFS {
|
||||
|
||||
/**
|
||||
* Rename path
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {string} destination
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public rename(path: string, destination: string, callback: (error: HdfsError) => void): void {
|
||||
@@ -350,9 +328,6 @@ export class WebHDFS {
|
||||
|
||||
/**
|
||||
* Get file status for given path
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {(error: HdfsError, fileStatus: any) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public stat(path: string, callback: (error: HdfsError, fileStatus: any) => void): void {
|
||||
@@ -376,8 +351,6 @@ export class WebHDFS {
|
||||
* Wraps stat method
|
||||
*
|
||||
* @see WebHDFS.stat
|
||||
* @param {string} path
|
||||
* @param {(error: HdfsError, exists: boolean) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public exists(path: string, callback: (error: HdfsError, exists: boolean) => void): void {
|
||||
@@ -392,12 +365,7 @@ export class WebHDFS {
|
||||
/**
|
||||
* Write data to the file
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {string | Buffer} data
|
||||
* @param {boolean} append If set to true then append data to the file
|
||||
* @param {object} opts
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns {fs.WriteStream}
|
||||
* @param append If set to true then append data to the file
|
||||
*/
|
||||
public writeFile(path: string, data: string | Buffer, append: boolean, opts: object,
|
||||
callback: (error: HdfsError) => void): fs.WriteStream {
|
||||
@@ -427,11 +395,6 @@ export class WebHDFS {
|
||||
* Append data to the file
|
||||
*
|
||||
* @see writeFile
|
||||
* @param {string} path
|
||||
* @param {string | Buffer} data
|
||||
* @param {object} opts
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns {fs.WriteStream}
|
||||
*/
|
||||
public appendFile(path: string, data: string | Buffer, opts: object, callback: (error: HdfsError) => void): fs.WriteStream {
|
||||
return this.writeFile(path, data, true, opts, callback);
|
||||
@@ -442,8 +405,6 @@ export class WebHDFS {
|
||||
*
|
||||
* @fires Request#data
|
||||
* @fires WebHDFS#finish
|
||||
* @param {path} path
|
||||
* @param {(error: HdfsError, buffer: Buffer) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public readFile(path: string, callback: (error: HdfsError, buffer: Buffer) => void): void {
|
||||
@@ -475,10 +436,7 @@ export class WebHDFS {
|
||||
* Create writable stream for given path
|
||||
*
|
||||
* @fires WebHDFS#finish
|
||||
* @param {string} path
|
||||
* @param {boolean} [append] If set to true then append data to the file
|
||||
* @param {object} [opts]
|
||||
* @returns {fs.WriteStream}
|
||||
* @param [append] If set to true then append data to the file
|
||||
*
|
||||
* @example
|
||||
* let hdfs = WebHDFS.createClient();
|
||||
@@ -593,9 +551,6 @@ export class WebHDFS {
|
||||
*
|
||||
* @fires Request#data
|
||||
* @fires WebHDFS#finish
|
||||
* @param {string} path
|
||||
* @param {object} [opts]
|
||||
* @returns {fs.ReadStream}
|
||||
*
|
||||
* @example
|
||||
* let hdfs = WebHDFS.createClient();
|
||||
@@ -677,10 +632,6 @@ export class WebHDFS {
|
||||
/**
|
||||
* Create symbolic link to the destination path
|
||||
*
|
||||
* @param {string} src
|
||||
* @param {string} destination
|
||||
* @param {boolean} [createParent=false]
|
||||
* @param {(error: HdfsError) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public symlink(src: string, destination: string, createParent: boolean = false, callback: (error: HdfsError) => void): void {
|
||||
@@ -702,9 +653,6 @@ export class WebHDFS {
|
||||
/**
|
||||
* Unlink path
|
||||
*
|
||||
* @param {string} path
|
||||
* @param {boolean} [recursive=false]
|
||||
* @param {(error: any) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public unlink(path: string, recursive: boolean = false, callback: (error: HdfsError) => void): void {
|
||||
@@ -720,9 +668,6 @@ export class WebHDFS {
|
||||
|
||||
/**
|
||||
* @alias WebHDFS.unlink
|
||||
* @param {string} path
|
||||
* @param {boolean} [recursive=false]
|
||||
* @param {(error: any) => void} callback
|
||||
* @returns void
|
||||
*/
|
||||
public rmdir(path: string, recursive: boolean = false, callback: (error: HdfsError) => void): void {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
|
||||
'use strict';
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import vscode = require('vscode');
|
||||
|
||||
@@ -56,7 +58,7 @@ export interface IPrompter {
|
||||
/**
|
||||
* Prompts for multiple questions
|
||||
*
|
||||
* @returns {[questionId: string]: T} Map of question IDs to results, or undefined if
|
||||
* @returns Map of question IDs to results, or undefined if
|
||||
* the user canceled the question session
|
||||
*/
|
||||
prompt<T>(questions: IQuestion[], ignoreFocusOut?: boolean): Promise<{ [questionId: string]: any }>;
|
||||
|
||||
@@ -18,8 +18,7 @@ export class OpenSparkYarnHistoryTask {
|
||||
async execute(sqlConnProfile: azdata.IConnectionProfile, isSpark: boolean): Promise<void> {
|
||||
try {
|
||||
let sqlClusterConnection = SqlClusterLookUp.findSqlClusterConnection(sqlConnProfile, this.appContext);
|
||||
if (!sqlClusterConnection)
|
||||
{
|
||||
if (!sqlClusterConnection) {
|
||||
let name = isSpark ? 'Spark' : 'Yarn';
|
||||
this.appContext.apiWrapper.showErrorMessage(`Please connect to the Spark cluster before View ${name} History.`);
|
||||
return;
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as childProcess from 'child_process';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as nls from 'vscode-nls';
|
||||
@@ -170,7 +168,7 @@ export function getOSPlatform(): Platform {
|
||||
}
|
||||
|
||||
export function getOSPlatformId(): string {
|
||||
var platformId = undefined;
|
||||
let platformId = undefined;
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
platformId = 'win-x64';
|
||||
|
||||
@@ -123,8 +123,7 @@ function connToConnectionParam(connection: azdata.connection.Connection): Connec
|
||||
return <ConnectionParam>result;
|
||||
}
|
||||
|
||||
class ConnectionParam implements azdata.connection.Connection, azdata.IConnectionProfile, azdata.ConnectionInfo
|
||||
{
|
||||
class ConnectionParam implements azdata.connection.Connection, azdata.IConnectionProfile, azdata.ConnectionInfo {
|
||||
public connectionName: string;
|
||||
public serverName: string;
|
||||
public databaseName: string;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import * as vscode from 'vscode';
|
||||
import * as opener from 'opener';
|
||||
import TelemetryReporter from 'vscode-extension-telemetry';
|
||||
@@ -138,7 +137,6 @@ export class Telemetry {
|
||||
|
||||
/**
|
||||
* Handle Language Service client errors
|
||||
* @class LanguageClientErrorHandler
|
||||
*/
|
||||
export class LanguageClientErrorHandler implements ErrorHandler {
|
||||
|
||||
@@ -160,11 +158,6 @@ export class LanguageClientErrorHandler implements ErrorHandler {
|
||||
/**
|
||||
* Callback for language service client error
|
||||
*
|
||||
* @param {Error} error
|
||||
* @param {Message} message
|
||||
* @param {number} count
|
||||
* @returns {ErrorAction}
|
||||
*
|
||||
* @memberOf LanguageClientErrorHandler
|
||||
*/
|
||||
error(error: Error, message: Message, count: number): ErrorAction {
|
||||
@@ -178,8 +171,6 @@ export class LanguageClientErrorHandler implements ErrorHandler {
|
||||
/**
|
||||
* Callback for language service client closed
|
||||
*
|
||||
* @returns {CloseAction}
|
||||
*
|
||||
* @memberOf LanguageClientErrorHandler
|
||||
*/
|
||||
closed(): CloseAction {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
@@ -163,7 +162,7 @@ export function generateGuid(): string {
|
||||
}
|
||||
|
||||
export function verifyPlatform(): Thenable<boolean> {
|
||||
if (os.platform() === 'darwin' && parseFloat(os.release()) < 16.0) {
|
||||
if (os.platform() === 'darwin' && parseFloat(os.release()) < 16) {
|
||||
return Promise.resolve(false);
|
||||
} else {
|
||||
return Promise.resolve(true);
|
||||
|
||||
@@ -3,17 +3,12 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @class ApiWrapper
|
||||
*/
|
||||
export class ApiWrapper {
|
||||
public createOutputChannel(name: string): vscode.OutputChannel {
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// CONFIG VALUES ///////////////////////////////////////////////////////////
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
// This code is originally from https://github.com/Microsoft/vscode/blob/master/src/vs/base/node/ports.ts
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as net from 'net';
|
||||
|
||||
export class StrictPortFindOptions {
|
||||
@@ -36,9 +34,9 @@ export async function strictFindFreePort(options: StrictPortFindOptions): Promis
|
||||
/**
|
||||
* Get a random integer between `min` and `max`.
|
||||
*
|
||||
* @param {number} min - min number
|
||||
* @param {number} max - max number
|
||||
* @return {number} a random integer
|
||||
* @param min - min number
|
||||
* @param max - max number
|
||||
* @return a random integer
|
||||
*/
|
||||
function getRandomInt(min, max): number {
|
||||
return Math.floor(Math.random() * (max - min + 1) + min);
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
'use strict';
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as childProcess from 'child_process';
|
||||
import * as fs from 'fs-extra';
|
||||
@@ -108,7 +111,7 @@ export function getOSPlatform(): Platform {
|
||||
}
|
||||
|
||||
export function getOSPlatformId(): string {
|
||||
var platformId = undefined;
|
||||
let platformId = undefined;
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
platformId = 'win-x64';
|
||||
|
||||
@@ -31,9 +31,9 @@ export function jsIndexToCharIndex(jsIdx: number, text: string): number {
|
||||
for (let i = 0; i + 1 < text.length && i < jsIdx; i++) {
|
||||
let charCode = text.charCodeAt(i);
|
||||
// check for surrogate pair
|
||||
if (charCode >= 0xd800 && charCode <= 0xdbff) {
|
||||
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
||||
let nextCharCode = text.charCodeAt(i + 1);
|
||||
if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) {
|
||||
if (nextCharCode >= 0xDC00 && nextCharCode <= 0xDFFF) {
|
||||
charIdx--;
|
||||
i++;
|
||||
}
|
||||
@@ -60,9 +60,9 @@ export function charCountToJsCountDiff(text: string): number {
|
||||
for (let i = 0; i + 1 < text.length; i++) {
|
||||
let charCode = text.charCodeAt(i);
|
||||
// check for surrogate pair
|
||||
if (charCode >= 0xd800 && charCode <= 0xdbff) {
|
||||
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
|
||||
let nextCharCode = text.charCodeAt(i + 1);
|
||||
if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) {
|
||||
if (nextCharCode >= 0xDC00 && nextCharCode <= 0xDFFF) {
|
||||
diff++;
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { nb } from 'azdata';
|
||||
import { Kernel, KernelMessage } from '@jupyterlab/services';
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
@@ -224,7 +222,6 @@ export class PerNotebookServerInstance implements IServerInstance {
|
||||
/**
|
||||
* Starts a Jupyter instance using the provided a start command. Server is determined to have
|
||||
* started when the log message with URL to connect to is emitted.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
protected async startInternal(): Promise<void> {
|
||||
if (this.isStarted) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
|
||||
'use strict';
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import vscode = require('vscode');
|
||||
|
||||
@@ -56,7 +58,7 @@ export interface IPrompter {
|
||||
/**
|
||||
* Prompts for multiple questions
|
||||
*
|
||||
* @returns {[questionId: string]: T} Map of question IDs to results, or undefined if
|
||||
* @returns Map of question IDs to results, or undefined if
|
||||
* the user canceled the question session
|
||||
*/
|
||||
prompt<T>(questions: IQuestion[], ignoreFocusOut?: boolean): Promise<{ [questionId: string]: any }>;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
|
||||
@@ -3,16 +3,12 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
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
|
||||
* @class ApiWrapper
|
||||
*/
|
||||
export class ApiWrapper {
|
||||
// Data APIs
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
"sourceMap": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"declaration": true
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as Proto from '../protocol';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import API from '../utils/api';
|
||||
import { VersionDependentRegistration } from '../utils/dependentRegistration';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
|
||||
class SmartSelection implements vscode.SelectionRangeProvider {
|
||||
public static readonly minVersion = API.v350;
|
||||
|
||||
public constructor(
|
||||
private readonly client: ITypeScriptServiceClient
|
||||
) { }
|
||||
|
||||
public async provideSelectionRanges(
|
||||
document: vscode.TextDocument,
|
||||
positions: vscode.Position[],
|
||||
token: vscode.CancellationToken,
|
||||
): Promise<vscode.SelectionRange[] | undefined> {
|
||||
const file = this.client.toOpenedFilePath(document);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const args: Proto.FileRequestArgs & { locations: Proto.Location[] } = {
|
||||
file,
|
||||
locations: positions.map(typeConverters.Position.toLocation)
|
||||
};
|
||||
const response = await this.client.execute('selectionRange', args, token);
|
||||
if (response.type !== 'response' || !response.body) {
|
||||
return undefined;
|
||||
}
|
||||
return response.body.map(SmartSelection.convertSelectionRange);
|
||||
}
|
||||
|
||||
private static convertSelectionRange(
|
||||
selectionRange: Proto.SelectionRange
|
||||
): vscode.SelectionRange {
|
||||
return new vscode.SelectionRange(
|
||||
typeConverters.Range.fromTextSpan(selectionRange.textSpan),
|
||||
selectionRange.parent ? SmartSelection.convertSelectionRange(selectionRange.parent) : undefined,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function register(
|
||||
selector: vscode.DocumentSelector,
|
||||
client: ITypeScriptServiceClient,
|
||||
) {
|
||||
return new VersionDependentRegistration(client, SmartSelection.minVersion, () =>
|
||||
vscode.languages.registerSelectionRangeProvider(selector, new SmartSelection(client)));
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import { CURSOR, withRandomFileEditor } from './testUtils';
|
||||
|
||||
const onDocumentChange = (doc: vscode.TextDocument): Promise<vscode.TextDocument> => {
|
||||
return new Promise<vscode.TextDocument>(resolve => {
|
||||
const sub = vscode.workspace.onDidChangeTextDocument(e => {
|
||||
if (e.document !== doc) {
|
||||
return;
|
||||
}
|
||||
sub.dispose();
|
||||
resolve(e.document);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const type = async (document: vscode.TextDocument, text: string): Promise<vscode.TextDocument> => {
|
||||
const onChange = onDocumentChange(document);
|
||||
await vscode.commands.executeCommand('type', { text });
|
||||
await onChange;
|
||||
return document;
|
||||
};
|
||||
|
||||
suite('OnEnter', () => {
|
||||
test('should indent after if block with braces', () => {
|
||||
return withRandomFileEditor(`if (true) {${CURSOR}`, 'js', async (_editor, document) => {
|
||||
await type(document, '\nx');
|
||||
assert.strictEqual(document.getText(), `if (true) {\n x`);
|
||||
});
|
||||
});
|
||||
|
||||
test('should indent within empty object literal', () => {
|
||||
return withRandomFileEditor(`({${CURSOR}})`, 'js', async (_editor, document) => {
|
||||
await type(document, '\nx');
|
||||
assert.strictEqual(document.getText(), `({\n x\n})`);
|
||||
});
|
||||
});
|
||||
|
||||
test('should indent after simple jsx tag with attributes', () => {
|
||||
return withRandomFileEditor(`const a = <div onclick={bla}>${CURSOR}`, 'jsx', async (_editor, document) => {
|
||||
await type(document, '\nx');
|
||||
assert.strictEqual(document.getText(), `const a = <div onclick={bla}>\n x`);
|
||||
});
|
||||
});
|
||||
|
||||
test('should indent after simple jsx tag with attributes', () => {
|
||||
return withRandomFileEditor(`const a = <div onclick={bla}>${CURSOR}`, 'jsx', async (_editor, document) => {
|
||||
await type(document, '\nx');
|
||||
assert.strictEqual(document.getText(), `const a = <div onclick={bla}>\n x`);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,68 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import { join } from 'path';
|
||||
|
||||
function rndName() {
|
||||
return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10);
|
||||
}
|
||||
|
||||
export function createRandomFile(contents = '', fileExtension = 'txt'): Thenable<vscode.Uri> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const tmpFile = join(os.tmpdir(), rndName() + '.' + fileExtension);
|
||||
fs.writeFile(tmpFile, contents, (error) => {
|
||||
if (error) {
|
||||
return reject(error);
|
||||
}
|
||||
|
||||
resolve(vscode.Uri.file(tmpFile));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function deleteFile(file: vscode.Uri): Thenable<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.unlink(file.fsPath, (err) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export const CURSOR = '$$CURSOR$$';
|
||||
|
||||
export function withRandomFileEditor(
|
||||
contents: string,
|
||||
fileExtension: string,
|
||||
run: (editor: vscode.TextEditor, doc: vscode.TextDocument) => Thenable<void>
|
||||
): Thenable<boolean> {
|
||||
const cursorIndex = contents.indexOf(CURSOR);
|
||||
return createRandomFile(contents.replace(CURSOR, ''), fileExtension).then(file => {
|
||||
return vscode.workspace.openTextDocument(file).then(doc => {
|
||||
return vscode.window.showTextDocument(doc).then((editor) => {
|
||||
if (cursorIndex >= 0) {
|
||||
const pos = doc.positionAt(cursorIndex);
|
||||
editor.selection = new vscode.Selection(pos, pos);
|
||||
}
|
||||
return run(editor, doc).then(_ => {
|
||||
if (doc.isDirty) {
|
||||
return doc.save().then(() => {
|
||||
return deleteFile(file);
|
||||
});
|
||||
} else {
|
||||
return deleteFile(file);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
'use strict';
|
||||
|
||||
// @ts-ignore
|
||||
const pkg = require('../package.json');
|
||||
// const pkg = require('../package.json');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
|
||||
|
||||
100
src/sql/azdata.proposed.d.ts
vendored
100
src/sql/azdata.proposed.d.ts
vendored
@@ -60,8 +60,8 @@ declare module 'azdata' {
|
||||
export namespace credentials {
|
||||
/**
|
||||
* Register a credential provider to handle credential requests.
|
||||
* @param {CredentialProvider} provider The provider to register
|
||||
* @return {Disposable} Handle to the provider for disposal
|
||||
* @param provider The provider to register
|
||||
* @return Handle to the provider for disposal
|
||||
*/
|
||||
export function registerProvider(provider: CredentialProvider): vscode.Disposable;
|
||||
|
||||
@@ -69,8 +69,8 @@ declare module 'azdata' {
|
||||
* Retrieves a provider from the extension host if one has been registered. Any credentials
|
||||
* accessed with the returned provider will have the namespaceId appended to credential ID
|
||||
* to prevent extensions from trampling over each others' credentials.
|
||||
* @param {string} namespaceId ID that will be appended to credential IDs.
|
||||
* @return {Thenable<CredentialProvider>} Promise that returns the namespaced provider
|
||||
* @param namespaceId ID that will be appended to credential IDs.
|
||||
* @return Promise that returns the namespaced provider
|
||||
*/
|
||||
export function getProvider(namespaceId: string): Thenable<CredentialProvider>;
|
||||
}
|
||||
@@ -98,14 +98,14 @@ declare module 'azdata' {
|
||||
|
||||
/**
|
||||
* Get the credentials for an active connection
|
||||
* @param {string} connectionId The id of the connection
|
||||
* @returns {{ [name: string]: string}} A dictionary containing the credentials as they would be included in the connection's options dictionary
|
||||
* @param connectionId The id of the connection
|
||||
* @returns A dictionary containing the credentials as they would be included in the connection's options dictionary
|
||||
*/
|
||||
export function getCredentials(connectionId: string): Thenable<{ [name: string]: string }>;
|
||||
|
||||
/**
|
||||
* Get ServerInfo for a connectionId
|
||||
* @param {string} connectionId The id of the connection
|
||||
* @param connectionId The id of the connection
|
||||
* @returns ServerInfo
|
||||
*/
|
||||
export function getServerInfo(connectionId: string): Thenable<ServerInfo>;
|
||||
@@ -134,35 +134,35 @@ declare module 'azdata' {
|
||||
* Get an Object Explorer node corresponding to the given connection and path. If no path
|
||||
* is given, it returns the top-level node for the given connection. If there is no node at
|
||||
* the given path, it returns undefined.
|
||||
* @param {string} connectionId The id of the connection that the node exists on
|
||||
* @param {string?} nodePath The path of the node to get
|
||||
* @returns {ObjectExplorerNode} The node corresponding to the given connection and path,
|
||||
* @param connectionId The id of the connection that the node exists on
|
||||
* @param nodePath The path of the node to get
|
||||
* @returns The node corresponding to the given connection and path,
|
||||
* or undefined if no such node exists.
|
||||
*/
|
||||
export function getNode(connectionId: string, nodePath?: string): Thenable<ObjectExplorerNode>;
|
||||
|
||||
/**
|
||||
* Get all active Object Explorer connection nodes
|
||||
* @returns {ObjectExplorerNode[]} The Object Explorer nodes for each saved connection
|
||||
* @returns The Object Explorer nodes for each saved connection
|
||||
*/
|
||||
export function getActiveConnectionNodes(): Thenable<ObjectExplorerNode[]>;
|
||||
|
||||
/**
|
||||
* Find Object Explorer nodes that match the given information
|
||||
* @param {string} connectionId The id of the connection that the node exists on
|
||||
* @param {string} type The type of the object to retrieve
|
||||
* @param {string} schema The schema of the object, if applicable
|
||||
* @param {string} name The name of the object
|
||||
* @param {string} database The database the object exists under, if applicable
|
||||
* @param {string[]} parentObjectNames A list of names of parent objects in the tree, ordered from highest to lowest level
|
||||
* @param connectionId The id of the connection that the node exists on
|
||||
* @param type The type of the object to retrieve
|
||||
* @param schema The schema of the object, if applicable
|
||||
* @param name The name of the object
|
||||
* @param database The database the object exists under, if applicable
|
||||
* @param parentObjectNames A list of names of parent objects in the tree, ordered from highest to lowest level
|
||||
* (for example when searching for a table's column, provide the name of its parent table for this argument)
|
||||
*/
|
||||
export function findNodes(connectionId: string, type: string, schema: string, name: string, database: string, parentObjectNames: string[]): Thenable<ObjectExplorerNode[]>;
|
||||
|
||||
/**
|
||||
* Get connectionProfile from sessionId
|
||||
* *@param {string} sessionId The id of the session that the node exists on
|
||||
* @returns {IConnectionProfile} The IConnecitonProfile for the session
|
||||
* @param sessionId The id of the session that the node exists on
|
||||
* @returns The IConnecitonProfile for the session
|
||||
*/
|
||||
export function getSessionConnectionProfile(sessionId: string): Thenable<IConnectionProfile>;
|
||||
|
||||
@@ -2047,11 +2047,7 @@ declare module 'azdata' {
|
||||
* Launches a flyout dialog that will display the information on how to complete device
|
||||
* code OAuth login to the user. Only one flyout can be opened at once and each must be closed
|
||||
* by calling {@link endAutoOAuthDeviceCode}.
|
||||
* @param {string} providerId ID of the provider that's requesting the flyout be opened
|
||||
* @param {string} title
|
||||
* @param {string} message
|
||||
* @param {string} userCode
|
||||
* @param {string} uri
|
||||
* @param providerId ID of the provider that's requesting the flyout be opened
|
||||
*/
|
||||
export function beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Thenable<void>;
|
||||
|
||||
@@ -2063,21 +2059,21 @@ declare module 'azdata' {
|
||||
/**
|
||||
* Notifies the account management service that an account has updated (usually due to the
|
||||
* account going stale).
|
||||
* @param {Account} updatedAccount Account object with updated properties
|
||||
* @param updatedAccount Account object with updated properties
|
||||
*/
|
||||
export function accountUpdated(updatedAccount: Account): void;
|
||||
|
||||
/**
|
||||
* Gets all added accounts.
|
||||
* @returns {Thenable<Account>} Promise to return the accounts
|
||||
* @returns Promise to return the accounts
|
||||
*/
|
||||
export function getAllAccounts(): Thenable<Account[]>;
|
||||
|
||||
/**
|
||||
* Generates a security token by asking the account's provider
|
||||
* @param {Account} account Account to generate security token for (defaults to
|
||||
* @param account Account to generate security token for (defaults to
|
||||
* AzureResource.ResourceManagement if not given)
|
||||
* @return {Thenable<{}>} Promise to return the security token
|
||||
* @return Promise to return the security token
|
||||
*/
|
||||
export function getSecurityToken(account: Account, resource?: AzureResource): Thenable<{}>;
|
||||
|
||||
@@ -2211,16 +2207,16 @@ declare module 'azdata' {
|
||||
export interface AccountProvider {
|
||||
/**
|
||||
* Initializes the account provider with the accounts restored from the memento,
|
||||
* @param {Account[]} storedAccounts Accounts restored from the memento
|
||||
* @return {Thenable<Account[]>} Account objects after being rehydrated (if necessary)
|
||||
* @param storedAccounts Accounts restored from the memento
|
||||
* @return Account objects after being rehydrated (if necessary)
|
||||
*/
|
||||
initialize(storedAccounts: Account[]): Thenable<Account[]>;
|
||||
|
||||
/**
|
||||
* Generates a security token for the provided account
|
||||
* @param {Account} account The account to generate a security token for
|
||||
* @param {AzureResource} resource The resource to get the token for
|
||||
* @return {Thenable<{}>} Promise to return a security token object
|
||||
* @param account The account to generate a security token for
|
||||
* @param resource The resource to get the token for
|
||||
* @return Promise to return a security token object
|
||||
*/
|
||||
getSecurityToken(account: Account, resource: AzureResource): Thenable<{}>;
|
||||
|
||||
@@ -2444,7 +2440,6 @@ declare module 'azdata' {
|
||||
/**
|
||||
* Supports defining a model that can be instantiated as a view in the UI
|
||||
* @export
|
||||
* @interface ModelBuilder
|
||||
*/
|
||||
export interface ModelBuilder {
|
||||
navContainer(): ContainerBuilder<NavContainer, any, any>;
|
||||
@@ -2554,7 +2549,7 @@ declare module 'azdata' {
|
||||
* Creates a collection of child components and adds them all to this container
|
||||
*
|
||||
* @param formComponents the definitions
|
||||
* @param {*} [itemLayout] Optional layout for the child items
|
||||
* @param [itemLayout] Optional layout for the child items
|
||||
*/
|
||||
addFormItems(formComponents: Array<FormComponent | FormComponentGroup>, itemLayout?: FormItemLayout): void;
|
||||
|
||||
@@ -2562,7 +2557,7 @@ declare module 'azdata' {
|
||||
* Creates a child component and adds it to this container.
|
||||
*
|
||||
* @param formComponent the component to be added
|
||||
* @param {*} [itemLayout] Optional layout for this child item
|
||||
* @param [itemLayout] Optional layout for this child item
|
||||
*/
|
||||
addFormItem(formComponent: FormComponent | FormComponentGroup, itemLayout?: FormItemLayout): void;
|
||||
|
||||
@@ -2576,7 +2571,6 @@ declare module 'azdata' {
|
||||
|
||||
/**
|
||||
* Removes a from item from the from
|
||||
* @param formComponent
|
||||
*/
|
||||
removeFormItem(formComponent: FormComponent | FormComponentGroup): boolean;
|
||||
}
|
||||
@@ -2587,18 +2581,16 @@ declare module 'azdata' {
|
||||
/**
|
||||
* Sends any updated properties of the component to the UI
|
||||
*
|
||||
* @returns {Thenable<void>} Thenable that completes once the update
|
||||
* @returns Thenable that completes once the update
|
||||
* has been applied in the UI
|
||||
* @memberof Component
|
||||
*/
|
||||
updateProperties(properties: { [key: string]: any }): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Sends an updated property of the component to the UI
|
||||
*
|
||||
* @returns {Thenable<void>} Thenable that completes once the update
|
||||
* @returns Thenable that completes once the update
|
||||
* has been applied in the UI
|
||||
* @memberof Component
|
||||
*/
|
||||
updateProperty(key: string, value: any): Thenable<void>;
|
||||
|
||||
@@ -2665,7 +2657,7 @@ declare module 'azdata' {
|
||||
* Creates a collection of child components and adds them all to this container
|
||||
*
|
||||
* @param itemConfigs the definitions
|
||||
* @param {*} [itemLayout] Optional layout for the child items
|
||||
* @param [itemLayout] Optional layout for the child items
|
||||
*/
|
||||
addItems(itemConfigs: Array<Component>, itemLayout?: TItemLayout): void;
|
||||
|
||||
@@ -2673,8 +2665,8 @@ declare module 'azdata' {
|
||||
* Creates a child component and adds it to this container.
|
||||
* Adding component to multiple containers is not supported
|
||||
*
|
||||
* @param {Component} component the component to be added
|
||||
* @param {*} [itemLayout] Optional layout for this child item
|
||||
* @param component the component to be added
|
||||
* @param [itemLayout] Optional layout for this child item
|
||||
*/
|
||||
addItem(component: Component, itemLayout?: TItemLayout): void;
|
||||
|
||||
@@ -2683,7 +2675,7 @@ declare module 'azdata' {
|
||||
* Adding component to multiple containers is not supported
|
||||
* @param component the component to be added
|
||||
* @param index the index to insert the component to
|
||||
* @param {*} [itemLayout] Optional layout for this child item
|
||||
* @param [itemLayout] Optional layout for this child item
|
||||
*/
|
||||
insertItem(component: Component, index: number, itemLayout?: TItemLayout): void;
|
||||
|
||||
@@ -2696,7 +2688,7 @@ declare module 'azdata' {
|
||||
/**
|
||||
* Defines the layout for this container
|
||||
*
|
||||
* @param {TLayout} layout object
|
||||
* @param layout object
|
||||
*/
|
||||
setLayout(layout: TLayout): void;
|
||||
}
|
||||
@@ -3372,7 +3364,6 @@ declare module 'azdata' {
|
||||
export namespace window {
|
||||
/**
|
||||
* creates a web view dialog
|
||||
* @param title
|
||||
*/
|
||||
export function createWebViewDialog(title: string): ModalDialog;
|
||||
|
||||
@@ -3736,14 +3727,14 @@ declare module 'azdata' {
|
||||
|
||||
/**
|
||||
* Make connection for the query editor
|
||||
* @param {string} fileUri file URI for the query editor
|
||||
* @param {string} connectionId connection ID
|
||||
* @param fileUri file URI for the query editor
|
||||
* @param connectionId connection ID
|
||||
*/
|
||||
export function connect(fileUri: string, connectionId: string): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Run query if it is a query editor and it is already opened.
|
||||
* @param {string} fileUri file URI for the query editor
|
||||
* @param fileUri file URI for the query editor
|
||||
*/
|
||||
export function runQuery(fileUri: string, options?: Map<string, string>): void;
|
||||
|
||||
@@ -3752,7 +3743,7 @@ declare module 'azdata' {
|
||||
*/
|
||||
export function registerQueryEventListener(listener: queryeditor.QueryEventListener): void;
|
||||
|
||||
export function getQueryDocument(fileUri: string): queryeditor.QueryDocument
|
||||
export function getQueryDocument(fileUri: string): queryeditor.QueryDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3944,8 +3935,8 @@ declare module 'azdata' {
|
||||
export namespace connection {
|
||||
/**
|
||||
* List the databases that can be accessed from the given connection
|
||||
* @param {string} connectionId The ID of the connection
|
||||
* @returns {string[]} An list of names of databases
|
||||
* @param connectionId The ID of the connection
|
||||
* @returns An list of names of databases
|
||||
*/
|
||||
export function listDatabases(connectionId: string): Thenable<string[]>;
|
||||
|
||||
@@ -3960,7 +3951,6 @@ declare module 'azdata' {
|
||||
/**
|
||||
* Opens the connection dialog, calls the callback with the result. If connection was successful
|
||||
* returns the connection otherwise returns undefined
|
||||
* @param callback
|
||||
*/
|
||||
export function openConnectionDialog(providers?: string[], initialConnectionProfile?: IConnectionProfile, connectionCompletionOptions?: IConnectionCompletionOptions): Thenable<connection.Connection>;
|
||||
|
||||
@@ -3974,8 +3964,6 @@ declare module 'azdata' {
|
||||
export namespace nb {
|
||||
/**
|
||||
* All notebook documents currently known to the system.
|
||||
*
|
||||
* @readonly
|
||||
*/
|
||||
export let notebookDocuments: NotebookDocument[];
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ export class Dropdown extends Disposable {
|
||||
super();
|
||||
this._contextView = new ContextView(layoutService.container);
|
||||
this._options = opt || Object.create(null);
|
||||
mixin(this._options, defaults, false) as IDropdownOptions;
|
||||
mixin(this._options, defaults, false);
|
||||
this._el = DOM.append(container, DOM.$('.monaco-dropdown'));
|
||||
this._el.style.width = '100%';
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.labelOnTopContainer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/*
|
||||
IMPORTANT:
|
||||
In order to preserve the uniform grid appearance, all cell styles need to have padding, margin and border sizes.
|
||||
No built-in (selected, editable, highlight, flashing, invalid, loading, :focus) or user-specified CSS
|
||||
classes should alter those!
|
||||
*/
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.slick-header.ui-state-default, .slick-headerrow.ui-state-default, .slick-footerrow.ui-state-default {
|
||||
width: 100%;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
|
||||
const defaultOptions: ICellRangeSelectorOptions = {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.backup-path-list {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
@@ -715,8 +715,8 @@ export class RestoreDialog extends Modal {
|
||||
|
||||
public dispose(): void {
|
||||
super.dispose();
|
||||
for (var key in this._optionsMap) {
|
||||
var widget: Widget = this._optionsMap[key];
|
||||
for (let key in this._optionsMap) {
|
||||
let widget: Widget = this._optionsMap[key];
|
||||
widget.dispose();
|
||||
delete this._optionsMap[key];
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import * as azdata from 'azdata';
|
||||
import * as DialogHelper from 'sql/workbench/browser/modal/dialogHelper';
|
||||
import * as types from 'vs/base/common/types';
|
||||
@@ -189,7 +188,7 @@ export class RestoreViewModel {
|
||||
*/
|
||||
public updateOptionWithPlanDetail(planDetails: { [key: string]: azdata.RestorePlanDetailInfo }): void {
|
||||
if (planDetails) {
|
||||
for (var key in planDetails) {
|
||||
for (let key in planDetails) {
|
||||
let optionElement = this._optionsMap[key];
|
||||
if (optionElement) {
|
||||
let planDetailInfo = planDetails[key];
|
||||
@@ -219,7 +218,7 @@ export class RestoreViewModel {
|
||||
this.defaultBackupFolder = configInfo['defaultBackupFolder'];
|
||||
}
|
||||
|
||||
for (var key in configInfo) {
|
||||
for (let key in configInfo) {
|
||||
let optionElement = this._optionsMap[key];
|
||||
if (optionElement) {
|
||||
let planDetailInfo = configInfo[key];
|
||||
@@ -258,7 +257,7 @@ export class RestoreViewModel {
|
||||
this.updateLastBackupTaken('');
|
||||
this.databaseList = [];
|
||||
this.selectedBackupSets = null;
|
||||
for (var key in this._optionsMap) {
|
||||
for (let key in this._optionsMap) {
|
||||
this._optionsMap[key].defaultValue = this.getDisplayValue(this._optionsMap[key].optionMetadata, this._optionsMap[key].optionMetadata.defaultValue);
|
||||
this._optionsMap[key].currentValue = this._optionsMap[key].defaultValue;
|
||||
this._onSetRestoreOption.fire({ optionName: key, value: this._optionsMap[key].defaultValue, isReadOnly: false });
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.detailView-toggle
|
||||
{
|
||||
display: inline-block;
|
||||
|
||||
@@ -96,7 +96,7 @@ export abstract class JobManagementView extends TabChild implements AfterContent
|
||||
}
|
||||
|
||||
protected _keybindingFor(action: IAction): ResolvedKeybinding {
|
||||
var [kb] = this._keybindingService.lookupKeybindings(action.id);
|
||||
let [kb] = this._keybindingService.lookupKeybindings(action.id);
|
||||
return kb;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.model-card {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.declarative-table {
|
||||
padding: 5px 30px 0px 30px;
|
||||
@@ -5,9 +9,6 @@
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.declarative-table-row {
|
||||
}
|
||||
|
||||
.declarative-table-header {
|
||||
padding: 5px;
|
||||
border: 1px solid gray;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.divContainer {
|
||||
display: block;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.flexContainer {
|
||||
display: flex;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.form-table {
|
||||
display: table;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.modelview-group-container {
|
||||
display: table;
|
||||
|
||||
@@ -12,7 +12,6 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
* An instance of a model-backed component. This will be a UI element
|
||||
*
|
||||
* @export
|
||||
* @interface IComponent
|
||||
*/
|
||||
export interface IComponent extends IDisposable {
|
||||
descriptor: IComponentDescriptor;
|
||||
@@ -44,7 +43,6 @@ export interface IComponentConfig {
|
||||
* world to the frontend UI;
|
||||
*
|
||||
* @export
|
||||
* @interface IComponentDescriptor
|
||||
*/
|
||||
export interface IComponentDescriptor {
|
||||
/**
|
||||
@@ -91,9 +89,8 @@ export interface IModelStore {
|
||||
* Runs on a component immediately if the component exists, or runs on
|
||||
* registration of the component otherwise
|
||||
*
|
||||
* @param {string} componentId unique identifier of the component
|
||||
* @param {(component: IComponent) => void} action some action to perform
|
||||
* @memberof IModelStore
|
||||
* @param componentId unique identifier of the component
|
||||
* @param action some action to perform
|
||||
*/
|
||||
eventuallyRunOnComponent<T>(componentId: string, action: (component: IComponent) => T): Promise<T>;
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.modelview-loadingComponent-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { IModelStore, IComponentDescriptor, IComponent } from './interfaces';
|
||||
import { Extensions, IComponentRegistry } from 'sql/platform/dashboard/common/modelComponentRegistry';
|
||||
import { Deferred } from 'sql/base/common/promise';
|
||||
import { entries } from 'sql/base/common/objects';
|
||||
|
||||
const componentRegistry = <IComponentRegistry>Registry.as(Extensions.ComponentContribution);
|
||||
|
||||
|
||||
class ComponentDescriptor implements IComponentDescriptor {
|
||||
constructor(public readonly id: string, public readonly type: string) {
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.modelview-radiobutton-container {
|
||||
align-items: flex-start;
|
||||
}
|
||||
@@ -5,7 +10,3 @@
|
||||
.modelview-radiobutton-item {
|
||||
align-self: flex-start ;
|
||||
}
|
||||
|
||||
.modelview-radiobutton-title {
|
||||
|
||||
}
|
||||
@@ -5,15 +5,14 @@
|
||||
import 'vs/css!./flexContainer';
|
||||
|
||||
import {
|
||||
Component, Input, Inject, ChangeDetectorRef, forwardRef, ComponentFactoryResolver,
|
||||
ViewChild, ViewChildren, ElementRef, Injector, OnDestroy, QueryList,
|
||||
Component, Input, Inject, ChangeDetectorRef, forwardRef, ElementRef, OnDestroy,
|
||||
} from '@angular/core';
|
||||
|
||||
import { IComponent, IComponentDescriptor, IModelStore } from 'sql/parts/modelComponents/interfaces';
|
||||
import { FlexItemLayout, SplitViewLayout } from 'azdata';
|
||||
import { FlexItem } from './flexContainer.component';
|
||||
import { ContainerBase, ComponentBase } from 'sql/parts/modelComponents/componentBase';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { SplitView, Orientation, Sizing, IView } from 'vs/base/browser/ui/splitview/splitview';
|
||||
|
||||
class SplitPane implements IView {
|
||||
@@ -113,7 +112,7 @@ export default class SplitViewContainer extends ContainerBase<FlexItemLayout> im
|
||||
|
||||
if (this._componentWrappers) {
|
||||
this._componentWrappers.forEach(item => {
|
||||
var component = item.modelStore.getComponent(item.descriptor.id);
|
||||
let component = item.modelStore.getComponent(item.descriptor.id);
|
||||
item.modelStore.validate(component).then(value => {
|
||||
if (value === true) {
|
||||
let view = this.GetCorrespondingView(component, this._orientation);
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.tree-component-node-tile {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.profiler-filter-dialog {
|
||||
height: 300px;
|
||||
padding: 10px;
|
||||
|
||||
@@ -263,7 +263,7 @@ export class ProfilerFilterDialog extends Modal {
|
||||
case NotStartsWith:
|
||||
return ProfilerFilterClauseOperator.NotStartsWith;
|
||||
default:
|
||||
throw `Not a valid operator: ${operator}`;
|
||||
throw new Error(`Not a valid operator: ${operator}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ export class ProfilerFilterDialog extends Modal {
|
||||
case ProfilerFilterClauseOperator.NotStartsWith:
|
||||
return NotStartsWith;
|
||||
default:
|
||||
throw `Not a valid operator: ${operator}`;
|
||||
throw new Error(`Not a valid operator: ${operator}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ function matches(item: any, clauses: ProfilerFilterClause[]): boolean {
|
||||
let expectedValueString: string = expectedValue === undefined ? undefined : expectedValue.toLocaleLowerCase();
|
||||
let actualValueDate = new Date(actualValue).valueOf();
|
||||
let expectedValueDate = new Date(expectedValue).valueOf();
|
||||
let actualValueNumber = new Number(actualValue).valueOf();
|
||||
let expectedValueNumber = new Number(expectedValue).valueOf();
|
||||
let actualValueNumber = Number(actualValue).valueOf();
|
||||
let expectedValueNumber = Number(expectedValue).valueOf();
|
||||
|
||||
if (isValidNumber(actualValue) && isValidNumber(expectedValue)) {
|
||||
actualValue = actualValueNumber;
|
||||
@@ -79,7 +79,7 @@ function matches(item: any, clauses: ProfilerFilterClause[]): boolean {
|
||||
match = !actualValueString || !actualValueString.startsWith(expectedValueString);
|
||||
break;
|
||||
default:
|
||||
throw `Not a valid operator: ${clause.operator}`;
|
||||
throw new Error(`Not a valid operator: ${clause.operator}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ function matches(item: any, clauses: ProfilerFilterClause[]): boolean {
|
||||
}
|
||||
|
||||
function isValidNumber(value: string): boolean {
|
||||
let num = new Number(value);
|
||||
let num = Number(value);
|
||||
return value !== undefined && !isNaN(num.valueOf()) && value.replace(' ', '') !== '';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
@@ -150,8 +147,7 @@ export class CopyAllMessagesAction extends Action {
|
||||
|
||||
constructor(
|
||||
private tree: ITree,
|
||||
@IClipboardService private clipboardService: IClipboardService)
|
||||
{
|
||||
@IClipboardService private clipboardService: IClipboardService) {
|
||||
super(CopyAllMessagesAction.ID, CopyAllMessagesAction.LABEL);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,14 +3,11 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IPanelTab } from 'sql/base/browser/ui/panel/panel';
|
||||
import { ChartView } from './chartView';
|
||||
import QueryRunner from 'sql/platform/query/common/queryRunner';
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export class ChartTab implements IPanelTab {
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { Chart as ChartJs } from 'chart.js';
|
||||
|
||||
import { mixin } from 'sql/base/common/objects';
|
||||
@@ -303,7 +301,7 @@ export class Graph implements IInsight {
|
||||
* color functionality
|
||||
*/
|
||||
|
||||
const defaultColors = [
|
||||
const defaultColors: Array<Color> = [
|
||||
[255, 99, 132],
|
||||
[54, 162, 235],
|
||||
[255, 206, 86],
|
||||
@@ -318,42 +316,71 @@ const defaultColors = [
|
||||
[77, 83, 96]
|
||||
];
|
||||
|
||||
type Color = [number, number, number];
|
||||
|
||||
function rgba(colour, alpha) {
|
||||
interface ILineColor {
|
||||
backgroundColor: string;
|
||||
borderColor: string;
|
||||
pointBackgroundColor: string;
|
||||
pointBorderColor: string;
|
||||
pointHoverBackgroundColor: string;
|
||||
pointHoverBorderColor: string;
|
||||
}
|
||||
|
||||
interface IBarColor {
|
||||
backgroundColor: string;
|
||||
borderColor: string;
|
||||
hoverBackgroundColor: string;
|
||||
hoverBorderColor: string;
|
||||
}
|
||||
|
||||
interface IPieColors {
|
||||
backgroundColor: Array<string>;
|
||||
borderColor: Array<string>;
|
||||
pointBackgroundColor: Array<string>;
|
||||
pointBorderColor: Array<string>;
|
||||
pointHoverBackgroundColor: Array<string>;
|
||||
pointHoverBorderColor: Array<string>;
|
||||
}
|
||||
|
||||
interface IPolarAreaColors {
|
||||
backgroundColor: Array<string>;
|
||||
borderColor: Array<string>;
|
||||
hoverBackgroundColor: Array<string>;
|
||||
hoverBorderColor: Array<string>;
|
||||
}
|
||||
|
||||
function rgba(colour: Color, alpha: number): string {
|
||||
return 'rgba(' + colour.concat(alpha).join(',') + ')';
|
||||
}
|
||||
|
||||
function getRandomInt(min, max) {
|
||||
function getRandomInt(min: number, max: number): number {
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
function getRandomColor() {
|
||||
function getRandomColor(): Color {
|
||||
return [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate colors for line|bar charts
|
||||
* @param index
|
||||
* @returns {number[]|Color}
|
||||
*/
|
||||
function generateColor(index) {
|
||||
function generateColor(index: number): Color {
|
||||
return defaultColors[index] || getRandomColor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate colors for pie|doughnut charts
|
||||
* @param count
|
||||
* @returns {Colors}
|
||||
*/
|
||||
function generateColors(count) {
|
||||
var colorsArr = new Array(count);
|
||||
for (var i = 0; i < count; i++) {
|
||||
function generateColors(count: number): Array<Color> {
|
||||
const colorsArr = new Array(count);
|
||||
for (let i = 0; i < count; i++) {
|
||||
colorsArr[i] = defaultColors[i] || getRandomColor();
|
||||
}
|
||||
return colorsArr;
|
||||
}
|
||||
|
||||
function formatLineColor(colors) {
|
||||
function formatLineColor(colors: Color): ILineColor {
|
||||
return {
|
||||
backgroundColor: rgba(colors, 0.4),
|
||||
borderColor: rgba(colors, 1),
|
||||
@@ -364,7 +391,7 @@ function formatLineColor(colors) {
|
||||
};
|
||||
}
|
||||
|
||||
function formatBarColor(colors) {
|
||||
function formatBarColor(colors: Color): IBarColor {
|
||||
return {
|
||||
backgroundColor: rgba(colors, 0.6),
|
||||
borderColor: rgba(colors, 1),
|
||||
@@ -373,34 +400,30 @@ function formatBarColor(colors) {
|
||||
};
|
||||
}
|
||||
|
||||
function formatPieColors(colors) {
|
||||
function formatPieColors(colors: Array<Color>): IPieColors {
|
||||
return {
|
||||
backgroundColor: colors.map(function (color) { return rgba(color, 0.6); }),
|
||||
borderColor: colors.map(function () { return '#fff'; }),
|
||||
pointBackgroundColor: colors.map(function (color) { return rgba(color, 1); }),
|
||||
pointBorderColor: colors.map(function () { return '#fff'; }),
|
||||
pointHoverBackgroundColor: colors.map(function (color) { return rgba(color, 1); }),
|
||||
pointHoverBorderColor: colors.map(function (color) { return rgba(color, 1); })
|
||||
backgroundColor: colors.map(color => rgba(color, 0.6)),
|
||||
borderColor: colors.map(() => '#fff'),
|
||||
pointBackgroundColor: colors.map(color => rgba(color, 1)),
|
||||
pointBorderColor: colors.map(() => '#fff'),
|
||||
pointHoverBackgroundColor: colors.map(color => rgba(color, 1)),
|
||||
pointHoverBorderColor: colors.map(color => rgba(color, 1))
|
||||
};
|
||||
}
|
||||
|
||||
function formatPolarAreaColors(colors) {
|
||||
function formatPolarAreaColors(colors: Array<Color>): IPolarAreaColors {
|
||||
return {
|
||||
backgroundColor: colors.map(function (color) { return rgba(color, 0.6); }),
|
||||
borderColor: colors.map(function (color) { return rgba(color, 1); }),
|
||||
hoverBackgroundColor: colors.map(function (color) { return rgba(color, 0.8); }),
|
||||
hoverBorderColor: colors.map(function (color) { return rgba(color, 1); })
|
||||
backgroundColor: colors.map(color => rgba(color, 0.6)),
|
||||
borderColor: colors.map(color => rgba(color, 1)),
|
||||
hoverBackgroundColor: colors.map(color => rgba(color, 0.8)),
|
||||
hoverBorderColor: colors.map(color => rgba(color, 1))
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate colors by chart type
|
||||
* @param chartType
|
||||
* @param index
|
||||
* @param count
|
||||
* @returns {Color}
|
||||
*/
|
||||
function getColors(chartType, index, count) {
|
||||
function getColors(chartType: string, index: number, count: number): Color | ILineColor | IBarColor | IPieColors | IPolarAreaColors {
|
||||
if (chartType === 'pie' || chartType === 'doughnut') {
|
||||
return formatPieColors(generateColors(count));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
|
||||
import { IInsightData } from 'sql/workbench/parts/dashboard/widgets/insights/interfaces';
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* Disable repl hover highlight in tree. */
|
||||
.monaco-workbench .message-tree .monaco-tree .monaco-tree-rows > .monaco-tree-row:hover:not(.highlighted):not(.selected):not(.focused) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user