From 273f6b658ab77fbdb424b80da117c24a83ebcfad Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sat, 15 Aug 2020 17:15:28 -0700 Subject: [PATCH] Add separate config for enabling nb convert and fix css (#11811) --- src/sql/base/browser/ui/taskbar/media/icons.css | 6 +++--- .../notebook/browser/notebook.contribution.ts | 15 ++++++--------- .../contrib/query/browser/queryEditor.ts | 12 +++++++++++- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/sql/base/browser/ui/taskbar/media/icons.css b/src/sql/base/browser/ui/taskbar/media/icons.css index 6f736a2e05..9ebe9573ef 100644 --- a/src/sql/base/browser/ui/taskbar/media/icons.css +++ b/src/sql/base/browser/ui/taskbar/media/icons.css @@ -120,7 +120,7 @@ } .carbon-taskbar .codicon.export { - background-origin: initial; - background-position: left; - background-size: 11px + background-origin: initial !important; + background-position: left !important; + background-size: 11px !important; } diff --git a/src/sql/workbench/contrib/notebook/browser/notebook.contribution.ts b/src/sql/workbench/contrib/notebook/browser/notebook.contribution.ts index 2004d097f0..5b96419881 100644 --- a/src/sql/workbench/contrib/notebook/browser/notebook.contribution.ts +++ b/src/sql/workbench/contrib/notebook/browser/notebook.contribution.ts @@ -210,15 +210,12 @@ configurationRegistry.registerConfiguration({ 'type': 'boolean', 'default': false, 'description': localize('notebook.showAllKernels', "(Preview) show all kernels for the current notebook provider.") - } - } -}); - -configurationRegistry.registerConfiguration({ - 'id': 'notebook', - 'title': 'Notebook', - 'type': 'object', - 'properties': { + }, + 'notebook.showNotebookConvertActions': { + 'type': 'boolean', + 'default': false, + 'description': localize('notebook.showNotebookConvertActions', "(Preview) Show buttons for converting a Notebook to and from SQL.") + }, 'notebook.allowAzureDataStudioCommands': { 'type': 'boolean', 'default': false, diff --git a/src/sql/workbench/contrib/query/browser/queryEditor.ts b/src/sql/workbench/contrib/query/browser/queryEditor.ts index 05162a6de3..bf95ba5d9d 100644 --- a/src/sql/workbench/contrib/query/browser/queryEditor.ts +++ b/src/sql/workbench/contrib/query/browser/queryEditor.ts @@ -259,6 +259,7 @@ export class QueryEditor extends BaseEditor { const separator = Taskbar.createTaskbarSeparator(); let content: ITaskbarContent[]; const previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures']; + const notebookConvertActionsEnabled = this.configurationService.getValue('notebook')['showNotebookConvertActions']; if (previewFeaturesEnabled) { content = [ { action: this._runQueryAction }, @@ -270,8 +271,11 @@ export class QueryEditor extends BaseEditor { { element: separator }, { action: this._estimatedQueryPlanAction }, // Preview { action: this._toggleSqlcmdMode }, // Preview - { action: this._exportAsNotebookAction } // Preview ]; + + if (notebookConvertActionsEnabled) { + content.push({ action: this._exportAsNotebookAction }); + } } else { content = [ { action: this._runQueryAction }, @@ -281,6 +285,12 @@ export class QueryEditor extends BaseEditor { { action: this._changeConnectionAction }, { action: this._listDatabasesAction } ]; + const notebookConvertActionsEnabled = this.configurationService.getValue('notebook')['notebook.showNotebookConvertActions']; + if (notebookConvertActionsEnabled) { + content.push( + { element: separator }, + { action: this._exportAsNotebookAction }); + } } this.taskbar.setContent(content);