Update product references from 'sqlops' to 'azdata' (#4259)

* Update extensions to use azdata

* Switch core code to use azdata
This commit is contained in:
Karl Burtram
2019-03-01 13:59:37 -08:00
committed by GitHub
parent 220685a522
commit 84890eb1b4
371 changed files with 3208 additions and 3184 deletions

View File

@@ -6,7 +6,7 @@
'use strict';
import * as path from 'path';
import * as sqlops from 'sqlops';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as os from 'os';
import * as nls from 'vscode-nls';
@@ -75,22 +75,22 @@ export class JupyterController implements vscode.Disposable {
let notebookProvider = undefined;
notebookProvider = this.registerNotebookProvider();
sqlops.nb.onDidOpenNotebookDocument(notebook => {
azdata.nb.onDidOpenNotebookDocument(notebook => {
if (!JupyterServerInstallation.isPythonInstalled(this.apiWrapper)) {
this.doConfigurePython(jupyterInstaller);
}
});
// Add command/task handlers
this.apiWrapper.registerTaskHandler(constants.jupyterOpenNotebookTask, (profile: sqlops.IConnectionProfile) => {
this.apiWrapper.registerTaskHandler(constants.jupyterOpenNotebookTask, (profile: azdata.IConnectionProfile) => {
return this.handleOpenNotebookTask(profile);
});
this.apiWrapper.registerTaskHandler(constants.jupyterNewNotebookTask, (profile: sqlops.IConnectionProfile) => {
this.apiWrapper.registerTaskHandler(constants.jupyterNewNotebookTask, (profile: azdata.IConnectionProfile) => {
return this.saveProfileAndCreateNotebook(profile);
});
this.apiWrapper.registerCommand(constants.jupyterNewNotebookCommand, (explorerContext: sqlops.ObjectExplorerContext) => {
this.apiWrapper.registerCommand(constants.jupyterNewNotebookCommand, (explorerContext: azdata.ObjectExplorerContext) => {
return this.saveProfileAndCreateNotebook(explorerContext ? explorerContext.connectionProfile : undefined);
});
this.apiWrapper.registerCommand(constants.jupyterAnalyzeCommand, (explorerContext: sqlops.ObjectExplorerContext) => {
this.apiWrapper.registerCommand(constants.jupyterAnalyzeCommand, (explorerContext: azdata.ObjectExplorerContext) => {
return this.saveProfileAndAnalyzeNotebook(explorerContext);
});
@@ -113,15 +113,15 @@ export class JupyterController implements vscode.Disposable {
extensionContext: this.extensionContext,
apiWrapper: this.apiWrapper
}));
sqlops.nb.registerNotebookProvider(notebookProvider);
azdata.nb.registerNotebookProvider(notebookProvider);
return notebookProvider;
}
private saveProfileAndCreateNotebook(profile: sqlops.IConnectionProfile): Promise<void> {
private saveProfileAndCreateNotebook(profile: azdata.IConnectionProfile): Promise<void> {
return this.handleNewNotebookTask(undefined, profile);
}
private saveProfileAndAnalyzeNotebook(oeContext: sqlops.ObjectExplorerContext): Promise<void> {
private saveProfileAndAnalyzeNotebook(oeContext: azdata.ObjectExplorerContext): Promise<void> {
return this.handleNewNotebookTask(oeContext, oeContext.connectionProfile);
}
@@ -131,11 +131,11 @@ export class JupyterController implements vscode.Disposable {
}
// EVENT HANDLERS //////////////////////////////////////////////////////
public async getDefaultConnection(): Promise<sqlops.ConnectionInfo> {
public async getDefaultConnection(): Promise<azdata.connection.ConnectionProfile> {
return await this.apiWrapper.getCurrentConnection();
}
private async handleOpenNotebookTask(profile: sqlops.IConnectionProfile): Promise<void> {
private async handleOpenNotebookTask(profile: azdata.IConnectionProfile): Promise<void> {
let notebookFileTypeName = localize('notebookFileType', 'Notebooks');
let filter = {};
filter[notebookFileTypeName] = 'ipynb';
@@ -151,7 +151,7 @@ export class JupyterController implements vscode.Disposable {
// in the future might want additional supported types
this.apiWrapper.showErrorMessage(localize('unsupportedFileType', 'Only .ipynb Notebooks are supported'));
} else {
await sqlops.nb.showNotebookDocument(fileUri, {
await azdata.nb.showNotebookDocument(fileUri, {
connectionId: profile.id,
providerId: constants.jupyterNotebookProviderId,
preview: false
@@ -160,11 +160,11 @@ export class JupyterController implements vscode.Disposable {
}
}
private async handleNewNotebookTask(oeContext?: sqlops.ObjectExplorerContext, profile?: sqlops.IConnectionProfile): Promise<void> {
private async handleNewNotebookTask(oeContext?: azdata.ObjectExplorerContext, profile?: azdata.IConnectionProfile): Promise<void> {
// Ensure we get a unique ID for the notebook. For now we're using a different prefix to the built-in untitled files
// to handle this. We should look into improving this in the future
let untitledUri = vscode.Uri.parse(`untitled:Notebook-${untitledCounter++}`);
let editor = await sqlops.nb.showNotebookDocument(untitledUri, {
let editor = await azdata.nb.showNotebookDocument(untitledUri, {
connectionId: profile.id,
providerId: constants.jupyterNotebookProviderId,
preview: false,

View File

@@ -6,7 +6,7 @@
'use strict';
import { nb } from 'sqlops';
import { nb } from 'azdata';
import { Kernel, KernelMessage } from '@jupyterlab/services';
function toShellMessage(msgImpl: KernelMessage.IShellMessage): nb.IShellMessage {

View File

@@ -5,7 +5,7 @@
'use strict';
import { nb } from 'sqlops';
import { nb } from 'azdata';
import * as vscode from 'vscode';
import { ServerConnection, SessionManager } from '@jupyterlab/services';

View File

@@ -5,7 +5,7 @@
'use strict';
import { nb } from 'sqlops';
import { nb } from 'azdata';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();

View File

@@ -8,7 +8,7 @@
import * as fs from 'fs-extra';
import * as path from 'path';
import * as nls from 'vscode-nls';
import * as sqlops from 'sqlops';
import * as azdata from 'azdata';
import { ExecOptions } from 'child_process';
import * as decompress from 'decompress';
import * as request from 'request';
@@ -82,25 +82,25 @@ export default class JupyterServerInstallation {
return installation;
}
private async installDependencies(backgroundOperation: sqlops.BackgroundOperation): Promise<void> {
private async installDependencies(backgroundOperation: azdata.BackgroundOperation): Promise<void> {
if (!fs.existsSync(this._pythonExecutable) || this._forceInstall) {
window.showInformationMessage(msgInstallPkgStart);
this.outputChannel.show(true);
this.outputChannel.appendLine(msgPythonInstallationProgress);
backgroundOperation.updateStatus(sqlops.TaskStatus.InProgress, msgPythonInstallationProgress);
backgroundOperation.updateStatus(azdata.TaskStatus.InProgress, msgPythonInstallationProgress);
await this.installPythonPackage(backgroundOperation);
backgroundOperation.updateStatus(sqlops.TaskStatus.InProgress, msgPythonInstallationComplete);
backgroundOperation.updateStatus(azdata.TaskStatus.InProgress, msgPythonInstallationComplete);
this.outputChannel.appendLine(msgPythonInstallationComplete);
// Install jupyter on Windows because local python is not bundled with jupyter unlike linux and MacOS.
await this.installJupyterProsePackage();
await this.installSparkMagic();
backgroundOperation.updateStatus(sqlops.TaskStatus.Succeeded, msgInstallPkgFinish);
backgroundOperation.updateStatus(azdata.TaskStatus.Succeeded, msgInstallPkgFinish);
window.showInformationMessage(msgInstallPkgFinish);
}
}
private installPythonPackage(backgroundOperation: sqlops.BackgroundOperation): Promise<void> {
private installPythonPackage(backgroundOperation: azdata.BackgroundOperation): Promise<void> {
let bundleVersion = constants.pythonBundleVersion;
let pythonVersion = constants.pythonVersion;
let packageName = 'python-#pythonversion-#platform-#bundleversion.#extension';
@@ -129,10 +129,10 @@ export default class JupyterServerInstallation {
let self = undefined;
return new Promise((resolve, reject) => {
self = this;
backgroundOperation.updateStatus(sqlops.TaskStatus.InProgress, msgDownloadPython(platformId, pythonDownloadUrl));
backgroundOperation.updateStatus(azdata.TaskStatus.InProgress, msgDownloadPython(platformId, pythonDownloadUrl));
fs.mkdirs(this._pythonInstallationPath, (err) => {
if (err) {
backgroundOperation.updateStatus(sqlops.TaskStatus.InProgress, msgPythonDirectoryError);
backgroundOperation.updateStatus(azdata.TaskStatus.InProgress, msgPythonDirectoryError);
reject(err);
}
@@ -141,12 +141,12 @@ export default class JupyterServerInstallation {
let printThreshold = 0.1;
request.get(pythonDownloadUrl, { timeout: 20000 })
.on('error', (downloadError) => {
backgroundOperation.updateStatus(sqlops.TaskStatus.InProgress, msgPythonDownloadError);
backgroundOperation.updateStatus(azdata.TaskStatus.InProgress, msgPythonDownloadError);
reject(downloadError);
})
.on('response', (response) => {
if (response.statusCode !== 200) {
backgroundOperation.updateStatus(sqlops.TaskStatus.InProgress, msgPythonDownloadError);
backgroundOperation.updateStatus(azdata.TaskStatus.InProgress, msgPythonDownloadError);
reject(response.statusMessage);
}
@@ -174,7 +174,7 @@ export default class JupyterServerInstallation {
try {
fs.removeSync(pythonSourcePath);
} catch (err) {
backgroundOperation.updateStatus(sqlops.TaskStatus.InProgress, msgPythonUnpackError);
backgroundOperation.updateStatus(azdata.TaskStatus.InProgress, msgPythonUnpackError);
reject(err);
}
}
@@ -182,19 +182,19 @@ export default class JupyterServerInstallation {
//Delete zip/tar file
fs.unlink(pythonPackagePathLocal, (err) => {
if (err) {
backgroundOperation.updateStatus(sqlops.TaskStatus.InProgress, msgPythonUnpackError);
backgroundOperation.updateStatus(azdata.TaskStatus.InProgress, msgPythonUnpackError);
reject(err);
}
});
resolve();
}).catch(err => {
backgroundOperation.updateStatus(sqlops.TaskStatus.InProgress, msgPythonUnpackError);
backgroundOperation.updateStatus(azdata.TaskStatus.InProgress, msgPythonUnpackError);
reject(err);
});
})
.on('error', (downloadError) => {
backgroundOperation.updateStatus(sqlops.TaskStatus.InProgress, msgPythonDownloadError);
backgroundOperation.updateStatus(azdata.TaskStatus.InProgress, msgPythonDownloadError);
reject(downloadError);
});
});
@@ -254,7 +254,7 @@ export default class JupyterServerInstallation {
})
.catch(err => {
let errorMsg = msgDependenciesInstallationFailed(err);
op.updateStatus(sqlops.TaskStatus.Failed, errorMsg);
op.updateStatus(azdata.TaskStatus.Failed, errorMsg);
this.apiWrapper.showErrorMessage(errorMsg);
this._installCompleteEmitter.fire(errorMsg);
});

View File

@@ -5,7 +5,7 @@
'use strict';
import { nb } from 'sqlops';
import { nb } from 'azdata';
import * as vscode from 'vscode';
import * as path from 'path';
import { ServerConnection } from '@jupyterlab/services';

View File

@@ -5,7 +5,7 @@
'use strict';
import { nb, ServerInfo, connection, IConnectionProfile } from 'sqlops';
import { nb, ServerInfo, connection, IConnectionProfile } from 'azdata';
import { Session, Kernel } from '@jupyterlab/services';
import * as fs from 'fs-extra';
import * as nls from 'vscode-nls';

View File

@@ -5,7 +5,7 @@
'use strict';
import { nb } from 'sqlops';
import { nb } from 'azdata';
import * as vscode from 'vscode';
import { Contents } from '@jupyterlab/services';