From 858c1e826d5d0a56707b98b3bcd744c4bb152402 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 9 Aug 2020 16:09:51 -0700 Subject: [PATCH] Put export as SQL/Notebook under preview flag (#11726) * Put export as SQL/Notebook under preview flag * add sqlcmd under preview * Remove comment --- extensions/mssql/package.json | 2 +- .../contrib/query/browser/queryEditor.ts | 45 ++++++++++--------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/extensions/mssql/package.json b/extensions/mssql/package.json index a509b6b62e..62e2be7d76 100644 --- a/extensions/mssql/package.json +++ b/extensions/mssql/package.json @@ -474,7 +474,7 @@ "notebook/toolbar": [ { "command": "mssql.exportNotebookToSql", - "when": "providerId == sql" + "when": "config.workbench.enablePreviewFeatures && providerId == sql" } ] }, diff --git a/src/sql/workbench/contrib/query/browser/queryEditor.ts b/src/sql/workbench/contrib/query/browser/queryEditor.ts index b9b12cc487..05162a6de3 100644 --- a/src/sql/workbench/contrib/query/browser/queryEditor.ts +++ b/src/sql/workbench/contrib/query/browser/queryEditor.ts @@ -256,26 +256,31 @@ export class QueryEditor extends BaseEditor { private setTaskbarContent(): void { // Create HTML Elements for the taskbar - let separator = Taskbar.createTaskbarSeparator(); - - // Set the content in the order we desire - let content: ITaskbarContent[] = [ - { action: this._runQueryAction }, - { action: this._cancelQueryAction }, - { element: separator }, - { action: this._toggleConnectDatabaseAction }, - { action: this._changeConnectionAction }, - { action: this._listDatabasesAction }, - { element: separator }, - { action: this._estimatedQueryPlanAction }, - { action: this._toggleSqlcmdMode }, - { action: this._exportAsNotebookAction } - ]; - - // Remove the estimated query plan action if preview features are not enabled - let previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures']; - if (!previewFeaturesEnabled) { - content.splice(7, 1); + const separator = Taskbar.createTaskbarSeparator(); + let content: ITaskbarContent[]; + const previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures']; + if (previewFeaturesEnabled) { + content = [ + { action: this._runQueryAction }, + { action: this._cancelQueryAction }, + { element: separator }, + { action: this._toggleConnectDatabaseAction }, + { action: this._changeConnectionAction }, + { action: this._listDatabasesAction }, + { element: separator }, + { action: this._estimatedQueryPlanAction }, // Preview + { action: this._toggleSqlcmdMode }, // Preview + { action: this._exportAsNotebookAction } // Preview + ]; + } else { + content = [ + { action: this._runQueryAction }, + { action: this._cancelQueryAction }, + { element: separator }, + { action: this._toggleConnectDatabaseAction }, + { action: this._changeConnectionAction }, + { action: this._listDatabasesAction } + ]; } this.taskbar.setContent(content);