Update whoIsActive extension to use azdata (#7287)

* Update whoIsActive extension to use azdata

* Change path

* Update package-lock
This commit is contained in:
Charles Gagnon
2019-09-19 11:38:18 -07:00
committed by Karl Burtram
parent 2ff4b51fe6
commit 218dad1b17
9 changed files with 820 additions and 478 deletions

View File

@@ -65,6 +65,7 @@ const indentationFilter = [
// except multiple specific files // except multiple specific files
'!**/package.json', '!**/package.json',
'!**/package-lock.json', // {{SQL CARBON EDIT}}
'!**/yarn.lock', '!**/yarn.lock',
'!**/yarn-error.log', '!**/yarn-error.log',

View File

@@ -6,4 +6,4 @@ node_modules
.DS_Store .DS_Store
.idea .idea
test-reports/** test-reports/**
typings/sqlops.proposed.d.ts typings/azdata.d.ts

View File

@@ -24,7 +24,7 @@
{ {
"type": "node", "type": "node",
"request": "attach", "request": "attach",
"name": "Attach to Ops Studio", "name": "Attach to Azure Data Studio",
"protocol": "inspector", "protocol": "inspector",
"port": 5870, "port": 5870,
"restart": true, "restart": true,
@@ -37,7 +37,7 @@
}, },
{ {
"name": "Debug in enlistment", "name": "Debug in enlistment",
"type": "sqlopsExtensionHost", "type": "azuredatastudioExtensionHost",
"request": "launch", "request": "launch",
"windows": { "windows": {
"runtimeExecutable": "${workspaceFolder}/../../scripts/sql.bat" "runtimeExecutable": "${workspaceFolder}/../../scripts/sql.bat"

File diff suppressed because it is too large Load Diff

View File

@@ -2,12 +2,12 @@
"name": "whoisactive", "name": "whoisactive",
"displayName": "whoisactive", "displayName": "whoisactive",
"description": "sp_whoisactive for Azure Data Studio", "description": "sp_whoisactive for Azure Data Studio",
"version": "0.1.1", "version": "0.1.2",
"publisher": "Microsoft", "publisher": "Microsoft",
"preview": true, "preview": true,
"engines": { "engines": {
"vscode": "^1.26.0", "vscode": "^1.26.0",
"azdata": "*" "azdata": "^1.11.0"
}, },
"icon": "images/sqlserver.png", "icon": "images/sqlserver.png",
"license": "SEE LICENSE IN LICENSE.txt", "license": "SEE LICENSE IN LICENSE.txt",
@@ -241,17 +241,17 @@
"compile": "gulp compile", "compile": "gulp compile",
"watch": "gulp watch", "watch": "gulp watch",
"typings": "gulp copytypings", "typings": "gulp copytypings",
"postinstall": "node ./node_modules/vscode/bin/install && node ./node_modules/sqlops/bin/install && gulp copytypings" "postinstall": "node ./node_modules/vscode/bin/install && node ./node_modules/azdata/bin/install && gulp copytypings"
}, },
"dependencies": { "dependencies": {
"fs-extra": "^5.0.0", "fs-extra": "^5.0.0",
"handlebars": "^4.0.11", "handlebars": "^4.0.11",
"openurl": "^1.1.1", "openurl": "^1.1.1"
"sqlops": "github:anthonydresser/sqlops-extension-sqlops"
}, },
"devDependencies": { "devDependencies": {
"@types/mocha": "^2.2.42", "@types/mocha": "^2.2.42",
"@types/node": "^7.0.43", "@types/node": "^7.0.43",
"azdata": "github:microsoft/azdata-extension-azdata",
"child-process-promise": "^2.2.1", "child-process-promise": "^2.2.1",
"del": "^3.0.0", "del": "^3.0.0",
"gulp": "^4.0.0", "gulp": "^4.0.0",

View File

@@ -1,4 +1,3 @@
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.

View File

@@ -5,7 +5,7 @@
'use strict'; 'use strict';
import * as sqlops from 'sqlops'; import * as azdata from 'azdata';
import * as Utils from '../utils'; import * as Utils from '../utils';
import ControllerBase from './controllerBase'; import ControllerBase from './controllerBase';
import * as fs from 'fs'; import * as fs from 'fs';
@@ -29,10 +29,10 @@ export default class MainController extends ControllerBase {
} }
public activate(): Promise<boolean> { public activate(): Promise<boolean> {
sqlops.tasks.registerTask('sp_whoisactive.install', e => this.openurl('http://whoisactive.com/downloads/')); azdata.tasks.registerTask('sp_whoisactive.install', e => this.openurl('http://whoisactive.com/downloads/'));
sqlops.tasks.registerTask('sp_whoisactive.documentation', e => this.openurl('http://whoisactive.com/docs/')); azdata.tasks.registerTask('sp_whoisactive.documentation', e => this.openurl('http://whoisactive.com/docs/'));
sqlops.tasks.registerTask('sp_whoisactive.findBlockLeaders', e => this.onExecute(e, 'findBlockLeaders.sql')); azdata.tasks.registerTask('sp_whoisactive.findBlockLeaders', e => this.onExecute(e, 'findBlockLeaders.sql'));
sqlops.tasks.registerTask('sp_whoisactive.getPlans', e => this.onExecute(e, 'getPlans.sql')); azdata.tasks.registerTask('sp_whoisactive.getPlans', e => this.onExecute(e, 'getPlans.sql'));
return Promise.resolve(true); return Promise.resolve(true);
} }
@@ -41,12 +41,12 @@ export default class MainController extends ControllerBase {
openurl.open(link); openurl.open(link);
} }
private onExecute(connection: sqlops.IConnectionProfile, fileName: string): void { private onExecute(connection: azdata.IConnectionProfile, fileName: string): void {
let sqlContent = fs.readFileSync(path.join(__dirname, '..', 'sql', fileName)).toString(); let sqlContent = fs.readFileSync(path.join(__dirname, '..', 'sql', fileName)).toString();
vscode.workspace.openTextDocument({language: 'sql', content: sqlContent}).then(doc => { vscode.workspace.openTextDocument({language: 'sql', content: sqlContent}).then(doc => {
vscode.window.showTextDocument(doc, vscode.ViewColumn.Active, false).then(() => { vscode.window.showTextDocument(doc, vscode.ViewColumn.Active, false).then(() => {
let filePath = doc.uri.toString(); let filePath = doc.uri.toString();
sqlops.queryeditor.connect(filePath, connection.id).then(() => sqlops.queryeditor.runQuery(filePath)); azdata.queryeditor.connect(filePath, connection.id).then(() => azdata.queryeditor.runQuery(filePath));
}); });
}); });
} }

View File

@@ -12,6 +12,7 @@ let tslint = require('gulp-tslint');
let ts = require('gulp-typescript'); let ts = require('gulp-typescript');
let cproc = require('child_process'); let cproc = require('child_process');
let os = require('os'); let os = require('os');
let path = require('path');
let config = require('./config'); let config = require('./config');
let tsProject = ts.createProject('tsconfig.json'); let tsProject = ts.createProject('tsconfig.json');
@@ -89,7 +90,7 @@ gulp.task("build", gulp.series("clean", "lint", "compile"));
gulp.task("watch", function() { gulp.task("watch", function() {
gulp.watch([config.paths.project.root + '/src/**/*', gulp.watch([config.paths.project.root + '/src/**/*',
config.paths.project.root + '/test/**/*.ts'], config.paths.project.root + '/test/**/*.ts'],
gulp.series('build')) gulp.series('build'));
}); });
gulp.task('test', (done) => { gulp.task('test', (done) => {
@@ -100,11 +101,11 @@ gulp.task('test', (done) => {
process.env.JUNIT_REPORT_PATH = workspace + '/test-reports/ext_xunit.xml'; process.env.JUNIT_REPORT_PATH = workspace + '/test-reports/ext_xunit.xml';
let azuredatastudioPath = 'azuredatastudio'; let azuredatastudioPath = 'azuredatastudio';
if (process.env['SQLOPS_DEV']) { if (process.env['VSCODE_DEV']) {
let suffix = os.platform === 'win32' ? 'bat' : 'sh'; let suffix = os.platform === 'win32' ? 'bat' : 'sh';
azuredatastudioPath = `${process.env['SQLOPS_DEV']}/scripts/sql-cli.${suffix}`; azuredatastudioPath = `${process.env['VSCODE_DEV']}/scripts/sql-cli.${suffix}`;
} }
console.log(`Using SQLOPS Path of ${azuredatastudioPath}`); console.log(`Using ADS Path of ${azuredatastudioPath}`);
cproc.exec(`${azuredatastudioPath} --extensionDevelopmentPath="${workspace}" --extensionTestsPath="${workspace}/out/test" --verbose`, (error, stdout, stderr) => { cproc.exec(`${azuredatastudioPath} --extensionDevelopmentPath="${workspace}" --extensionTestsPath="${workspace}/out/test" --verbose`, (error, stdout, stderr) => {
if (error) { if (error) {
@@ -118,6 +119,6 @@ gulp.task('test', (done) => {
}); });
gulp.task('copytypings', function() { gulp.task('copytypings', function() {
return gulp.src(config.paths.project.root + '/../../src/sql/sqlops.proposed.d.ts') return gulp.src(config.paths.project.root + '/../../src/sql/azdata.d.ts')
.pipe(gulp.dest('typings/')); .pipe(gulp.dest('typings/'));
}); });

View File

@@ -16,7 +16,7 @@
"forin": true, "forin": true,
"indent": [ "indent": [
true, true,
"spaces" "tabs"
], ],
"interface-name": true, "interface-name": true,
"jsdoc-format": true, "jsdoc-format": true,