mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 09:35:38 -05:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user