mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Disable Manage Packages button if python is not installed (#6008)
This commit is contained in:
@@ -224,7 +224,7 @@
|
||||
"notebook/toolbar": [
|
||||
{
|
||||
"command": "jupyter.cmd.managePackages",
|
||||
"when": "providerId == jupyter"
|
||||
"when": "providerId == jupyter && notebook:pythonInstalled"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import { CommandContext, BuiltInCommands } from './constants';
|
||||
|
||||
/**
|
||||
* Wrapper class to act as a facade over VSCode and Data APIs and allow us to test / mock callbacks into
|
||||
@@ -56,6 +57,10 @@ export class ApiWrapper {
|
||||
azdata.tasks.startBackgroundOperation(operationInfo);
|
||||
}
|
||||
|
||||
public setCommandContext(key: CommandContext | string, value: any): Thenable<any> {
|
||||
return vscode.commands.executeCommand(BuiltInCommands.SetContext, key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration for a extensionName
|
||||
* @param extensionName The string name of the extension to get the configuration for
|
||||
|
||||
@@ -6,37 +6,23 @@
|
||||
'use strict';
|
||||
|
||||
// CONFIG VALUES ///////////////////////////////////////////////////////////
|
||||
export const extensionConfigSectionName = 'dataManagement';
|
||||
export const extensionOutputChannel = 'Notebooks';
|
||||
export const configLogDebugInfo = 'logDebugInfo';
|
||||
|
||||
// JUPYTER CONFIG //////////////////////////////////////////////////////////
|
||||
export const pythonBundleVersion = '0.0.1';
|
||||
export const pythonVersion = '3.6.6';
|
||||
export const sparkMagicVersion = '0.12.6.1';
|
||||
export const python3 = 'python3';
|
||||
export const pysparkkernel = 'pysparkkernel';
|
||||
export const sparkkernel = 'sparkkernel';
|
||||
export const pyspark3kernel = 'pyspark3kernel';
|
||||
export const python3DisplayName = 'Python 3';
|
||||
export const defaultSparkKernel = 'pyspark3kernel';
|
||||
export const pythonPathConfigKey = 'pythonPath';
|
||||
export const existingPythonConfigKey = 'useExistingPython';
|
||||
export const notebookConfigKey = 'notebook';
|
||||
|
||||
export const hdfsHost = 'host';
|
||||
export const hdfsUser = 'user';
|
||||
|
||||
export const winPlatform = 'win32';
|
||||
|
||||
export const jupyterNotebookProviderId = 'jupyter';
|
||||
export const jupyterConfigRootFolder = 'jupyter_config';
|
||||
export const jupyterKernelsMasterFolder = 'kernels_master';
|
||||
export const jupyterNewNotebookTask = 'jupyter.task.newNotebook';
|
||||
export const jupyterOpenNotebookTask = 'jupyter.task.openNotebook';
|
||||
export const jupyterNewNotebookCommand = 'jupyter.cmd.newNotebook';
|
||||
export const jupyterCommandSetContext = 'jupyter.setContext';
|
||||
export const jupyterCommandSetKernel = 'jupyter.setKernel';
|
||||
export const jupyterReinstallDependenciesCommand = 'jupyter.reinstallDependencies';
|
||||
export const jupyterAnalyzeCommand = 'jupyter.cmd.analyzeNotebook';
|
||||
export const jupyterManagePackages = 'jupyter.cmd.managePackages';
|
||||
@@ -47,7 +33,7 @@ export enum BuiltInCommands {
|
||||
}
|
||||
|
||||
export enum CommandContext {
|
||||
WizardServiceEnabled = 'wizardservice:enabled'
|
||||
NotebookPythonInstalled = 'notebook:pythonInstalled'
|
||||
}
|
||||
|
||||
export const pythonOfflinePipPackagesUrl = 'https://go.microsoft.com/fwlink/?linkid=2092867';
|
||||
|
||||
@@ -17,6 +17,7 @@ import JupyterServerInstallation from './jupyterServerInstallation';
|
||||
import * as utils from '../common/utils';
|
||||
import { IServerInstance } from './common';
|
||||
import { PerNotebookServerInstance, IInstanceOptions } from './serverInstance';
|
||||
import { CommandContext } from '../common/constants';
|
||||
|
||||
export interface IServerManagerOptions {
|
||||
documentPath: string;
|
||||
@@ -104,6 +105,7 @@ export class LocalJupyterServerManager implements nb.ServerManager, vscode.Dispo
|
||||
private async doStartServer(): Promise<IServerInstance> { // We can't find or create servers until the installation is complete
|
||||
let installation = this.options.jupyterInstallation;
|
||||
await installation.promptForPythonInstall();
|
||||
this.apiWrapper.setCommandContext(CommandContext.NotebookPythonInstalled, true);
|
||||
|
||||
// Calculate the path to use as the notebook-dir for Jupyter based on the path of the uri of the
|
||||
// notebook to open. This will be the workspace folder if the notebook uri is inside a workspace
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { nb } from 'azdata';
|
||||
import { OnInit, Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, OnDestroy } from '@angular/core';
|
||||
|
||||
import { IColorTheme, IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
@@ -288,6 +289,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
await model.requestModelLoad(trusted);
|
||||
model.contentChanged((change) => this.handleContentChanged(change));
|
||||
model.onProviderIdChange((provider) => this.handleProviderIdChanged(provider));
|
||||
model.kernelChanged((kernelArgs) => this.handleKernelChanged(kernelArgs));
|
||||
this._model = this._register(model);
|
||||
this.updateToolbarComponents(this._model.trustedMode);
|
||||
this._modelRegisteredDeferred.resolve(this._model);
|
||||
@@ -372,6 +374,10 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
this.fillInActionsForCurrentContext();
|
||||
}
|
||||
|
||||
private handleKernelChanged(kernelArgs: nb.IKernelChangedArgs) {
|
||||
this.fillInActionsForCurrentContext();
|
||||
}
|
||||
|
||||
findCellIndex(cellModel: ICellModel): number {
|
||||
return this._model.cells.findIndex((cell) => cell.id === cellModel.id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user