mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 01:25:38 -05:00
Notebook save functionality through button (#3340)
* 3268: Notebook save using button * 3268: Misc change * Handle promise while saving notebook * Async await functions to run action
This commit is contained in:
@@ -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<boolean> {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user