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 GitHub
parent a584aca969
commit 6a136854b0
9 changed files with 820 additions and 478 deletions

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -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.

View File

@@ -5,7 +5,7 @@
'use strict';
import * as sqlops from 'sqlops';
import * as azdata from 'azdata';
import * as Utils from '../utils';
import ControllerBase from './controllerBase';
import * as fs from 'fs';
@@ -29,10 +29,10 @@ export default class MainController extends ControllerBase {
}
public activate(): Promise<boolean> {
sqlops.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/'));
sqlops.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.install', e => this.openurl('http://whoisactive.com/downloads/'));
azdata.tasks.registerTask('sp_whoisactive.documentation', e => this.openurl('http://whoisactive.com/docs/'));
azdata.tasks.registerTask('sp_whoisactive.findBlockLeaders', e => this.onExecute(e, 'findBlockLeaders.sql'));
azdata.tasks.registerTask('sp_whoisactive.getPlans', e => this.onExecute(e, 'getPlans.sql'));
return Promise.resolve(true);
}
@@ -41,12 +41,12 @@ export default class MainController extends ControllerBase {
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();
vscode.workspace.openTextDocument({language: 'sql', content: sqlContent}).then(doc => {
vscode.window.showTextDocument(doc, vscode.ViewColumn.Active, false).then(() => {
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 cproc = require('child_process');
let os = require('os');
let path = require('path');
let config = require('./config');
let tsProject = ts.createProject('tsconfig.json');
@@ -89,7 +90,7 @@ gulp.task("build", gulp.series("clean", "lint", "compile"));
gulp.task("watch", function() {
gulp.watch([config.paths.project.root + '/src/**/*',
config.paths.project.root + '/test/**/*.ts'],
gulp.series('build'))
gulp.series('build'));
});
gulp.task('test', (done) => {
@@ -100,11 +101,11 @@ gulp.task('test', (done) => {
process.env.JUNIT_REPORT_PATH = workspace + '/test-reports/ext_xunit.xml';
let azuredatastudioPath = 'azuredatastudio';
if (process.env['SQLOPS_DEV']) {
if (process.env['VSCODE_DEV']) {
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) => {
if (error) {
@@ -118,6 +119,6 @@ gulp.task('test', (done) => {
});
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/'));
});

View File

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