diff --git a/src/sql/parts/notebook/media/dark/save_inverse.svg b/src/sql/parts/notebook/media/dark/save_inverse.svg
new file mode 100644
index 0000000000..1758622f77
--- /dev/null
+++ b/src/sql/parts/notebook/media/dark/save_inverse.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/sql/parts/notebook/media/light/save.svg b/src/sql/parts/notebook/media/light/save.svg
new file mode 100644
index 0000000000..6ebd2a1d3c
--- /dev/null
+++ b/src/sql/parts/notebook/media/light/save.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/sql/parts/notebook/notebook.component.ts b/src/sql/parts/notebook/notebook.component.ts
index c3e72cc48e..33efd46f37 100644
--- a/src/sql/parts/notebook/notebook.component.ts
+++ b/src/sql/parts/notebook/notebook.component.ts
@@ -31,7 +31,7 @@ import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
-import { KernelsDropdown, AttachToDropdown, AddCellAction, TrustedAction } from 'sql/parts/notebook/notebookActions';
+import { KernelsDropdown, AttachToDropdown, AddCellAction, TrustedAction, SaveNotebookAction } from 'sql/parts/notebook/notebookActions';
import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
export const NOTEBOOK_SELECTOR: string = 'notebook-component';
@@ -252,15 +252,18 @@ export class NotebookComponent extends AngularDisposable implements OnInit {
this._trustedAction = this.instantiationService.createInstance(TrustedAction, 'notebook.Trusted');
this._trustedAction.enabled = false;
+ let saveNotebookButton = this.instantiationService.createInstance(SaveNotebookAction, 'notebook.SaveNotebook', localize('save', 'Save'), 'notebook-button icon-save');
+
let taskbar = this.toolbar.nativeElement;
this._actionBar = new Taskbar(taskbar, this.contextMenuService);
this._actionBar.context = this;
this._actionBar.setContent([
{ element: kernelContainer },
{ element: attachToContainer },
- { action: addCodeCellButton},
- { action: addTextCellButton},
- { action: this._trustedAction}
+ { action: addCodeCellButton },
+ { action: addTextCellButton },
+ { action: saveNotebookButton },
+ { action: this._trustedAction }
]);
}
diff --git a/src/sql/parts/notebook/notebook.css b/src/sql/parts/notebook/notebook.css
index 3bf2adce55..155981d051 100644
--- a/src/sql/parts/notebook/notebook.css
+++ b/src/sql/parts/notebook/notebook.css
@@ -61,4 +61,13 @@
.vs-dark .notebookEditor .notebook-button.icon-notTrusted,
.hc-black .notebookEditor .notebook-button.icon-notTrusted{
background-image: url("./media/dark/nottrusted_inverse.svg");
+}
+
+.notebookEditor .notebook-button.icon-save{
+ background-image: url("./media/light/save.svg");
+}
+
+.vs-dark .notebookEditor .notebook-button.icon-save,
+.hc-black .notebookEditor .notebook-button.icon-save{
+ background-image: url("./media/dark/save_inverse.svg");
}
\ No newline at end of file
diff --git a/src/sql/parts/notebook/notebookActions.ts b/src/sql/parts/notebook/notebookActions.ts
index 3b9dc00464..c0777acf85 100644
--- a/src/sql/parts/notebook/notebookActions.ts
+++ b/src/sql/parts/notebook/notebookActions.ts
@@ -48,6 +48,28 @@ export class AddCellAction extends Action {
}
}
+export class SaveNotebookAction extends Action {
+ private static readonly notebookSavedMsg = localize('notebookSavedMsg', 'Notebook saved successfully.');
+ private static readonly notebookFailedSaveMsg = localize('notebookFailedSaveMsg', 'Failed to save Notebook.');
+ constructor(
+ id: string, label: string, cssClass: string,
+ @INotificationService private _notificationService: INotificationService
+ ) {
+ super(id, label, cssClass);
+ }
+
+ public async run(context: NotebookComponent): TPromise {
+ const actions: INotificationActions = { primary: [] };
+ let saved = await context.save();
+ if (saved) {
+ this._notificationService.notify({ severity: Severity.Info, message: SaveNotebookAction.notebookSavedMsg, actions });
+ } else {
+ this._notificationService.error(SaveNotebookAction.notebookFailedSaveMsg);
+ }
+ return saved;
+ }
+}
+
export interface IToggleableState {
baseClass?: string;
shouldToggleTooltip?: boolean;