From 9a05d81215773b9f69defb81b4123ce5c41fcfe5 Mon Sep 17 00:00:00 2001 From: Lucy Zhang Date: Mon, 18 Oct 2021 18:32:05 -0700 Subject: [PATCH] use setContent instead of addElement (#17386) --- .../notebook/browser/notebook.component.ts | 64 +++++++++++-------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/src/sql/workbench/contrib/notebook/browser/notebook.component.ts b/src/sql/workbench/contrib/notebook/browser/notebook.component.ts index 6d32177edc..34ec2ca8df 100644 --- a/src/sql/workbench/contrib/notebook/browser/notebook.component.ts +++ b/src/sql/workbench/contrib/notebook/browser/notebook.component.ts @@ -476,21 +476,28 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe viewsDropdownMenuActionViewItem.setActionContext(this._notebookParams.notebookUri); } - this._actionBar.setContent([ - { element: buttonDropdownContainer }, - { action: this._runAllCellsAction }, - { element: Taskbar.createTaskbarSeparator() }, - { element: kernelContainer }, - { element: attachToContainer }, - { element: spacerElement }, - ]); - if (this._showToolbarActions) { - this._actionBar.addElement(viewsDropdownContainer); - this._actionBar.addAction(collapseCellsAction); - this._actionBar.addAction(clearResultsButton); - this._actionBar.addAction(this._trustedAction); - this._actionBar.addAction(runParametersAction); + this._actionBar.setContent([ + { element: buttonDropdownContainer }, + { action: this._runAllCellsAction }, + { element: Taskbar.createTaskbarSeparator() }, + { element: kernelContainer }, + { element: attachToContainer }, + { element: spacerElement }, + { element: viewsDropdownContainer }, + { action: collapseCellsAction }, + { action: clearResultsButton }, + { action: this._trustedAction }, + { action: runParametersAction }, + ]); + } else { + this._actionBar.setContent([ + { element: buttonDropdownContainer }, + { action: this._runAllCellsAction }, + { element: Taskbar.createTaskbarSeparator() }, + { element: kernelContainer }, + { element: attachToContainer }, + ]); } } else { let kernelContainer = document.createElement('div'); @@ -523,18 +530,25 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe this._actionBar = new Taskbar(taskbar, { actionViewItemProvider: action => this.actionItemProvider(action as Action) }); this._actionBar.context = this._notebookParams.notebookUri; - this._actionBar.setContent([ - { action: addCodeCellButton }, - { action: addTextCellButton }, - { element: kernelContainer }, - { element: attachToContainer }, - { action: this._runAllCellsAction }, - ]); - if (this._showToolbarActions) { - this._actionBar.addAction(this._trustedAction); - this._actionBar.addAction(clearResultsButton); - this._actionBar.addAction(collapseCellsAction); + this._actionBar.setContent([ + { action: addCodeCellButton }, + { action: addTextCellButton }, + { element: kernelContainer }, + { element: attachToContainer }, + { action: this._trustedAction }, + { action: this._runAllCellsAction }, + { action: clearResultsButton }, + { action: collapseCellsAction }, + ]); + } else { + this._actionBar.setContent([ + { action: addCodeCellButton }, + { action: addTextCellButton }, + { element: kernelContainer }, + { element: attachToContainer }, + { action: this._runAllCellsAction }, + ]); } } }