Run with Parameters learn more link to use correct format and kernels (#15547)

* indicate to users correct format and kernels

* add test for unsupported kernel

* replace with enum
This commit is contained in:
Vasu Bhog
2021-05-25 17:39:19 -07:00
committed by GitHub
parent 399406b732
commit 730367494b
5 changed files with 99 additions and 20 deletions

View File

@@ -32,6 +32,7 @@ import { URI } from 'vs/base/common/uri';
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { KernelsLanguage } from 'sql/workbench/services/notebook/common/notebookConstants';
const msgLoading = localize('loading', "Loading kernels...");
export const msgChanging = localize('changing', "Changing kernel...");
@@ -45,6 +46,7 @@ const msgLocalHost = localize('localhost', "localhost");
export const noKernel: string = localize('noKernel', "No Kernel");
const baseIconClass = 'codicon';
const maskedIconClass = 'masked-icon';
export const kernelNotSupported: string = localize('kernelNotSupported', "This notebook cannot run with parameters as the kernel is not supported. Please use the supported kernels and format. [Learn more](https://docs.microsoft.com/sql/azure-data-studio/notebooks/notebooks-parameterization).");
export const noParameterCell: string = localize('noParametersCell', "This notebook cannot run with parameters until a parameter cell is added. [Learn more](https://docs.microsoft.com/sql/azure-data-studio/notebooks/notebooks-parameterization).");
export const noParametersInCell: string = localize('noParametersInCell', "This notebook cannot run with parameters until there are parameters added to the parameter cell. [Learn more](https://docs.microsoft.com/sql/azure-data-studio/notebooks/notebooks-parameterization).");
@@ -304,6 +306,16 @@ export class RunParametersAction extends TooltipFromLabelAction {
*/
public async run(context: URI): Promise<void> {
const editor = this._notebookService.findNotebookEditor(context);
// Only run action for kernels that are supported (Python, PySpark, PowerShell)
let supportedKernels: string[] = [KernelsLanguage.Python, KernelsLanguage.PowerShell];
if (!supportedKernels.includes(editor.model.languageInfo.name)) {
// If the kernel is not supported indicate to user to use supported kernels
this.notificationService.notify({
severity: Severity.Info,
message: kernelNotSupported,
});
return;
}
// Set defaultParameters to the parameter values in parameter cell
let defaultParameters = new Map<string, string>();
for (let cell of editor?.cells) {