Create a progress notification for saving files (#9875)

* Create a progress notification for saving files

* Remove unused import
This commit is contained in:
Amir Omidi
2020-04-07 11:12:51 -07:00
committed by GitHub
parent 63006e6e63
commit 592801d74c

View File

@@ -12,7 +12,7 @@ import * as path from 'vs/base/common/path';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import Severity from 'vs/base/common/severity'; import Severity from 'vs/base/common/severity';
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService, INotification } from 'vs/platform/notification/common/notification';
import { getBaseLabel } from 'vs/base/common/labels'; import { getBaseLabel } from 'vs/base/common/labels';
import { ShowFileInFolderAction, OpenFileInFolderAction } from 'sql/workbench/common/workspaceActions'; import { ShowFileInFolderAction, OpenFileInFolderAction } from 'sql/workbench/common/workspaceActions';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -323,6 +323,15 @@ export class ResultSerializer {
*/ */
private async doSave(filePath: string, format: string, sendRequest: () => Promise<SaveResultsResponse | undefined>): Promise<void> { private async doSave(filePath: string, format: string, sendRequest: () => Promise<SaveResultsResponse | undefined>): Promise<void> {
const saveNotification: INotification = {
severity: Severity.Info,
message: nls.localize('savingFile', "Saving file..."),
progress: {
infinite: true
}
};
const notificationHandle = this._notificationService.notify(saveNotification);
// send message to the sqlserverclient for converting results to the requested format and saving to filepath // send message to the sqlserverclient for converting results to the requested format and saving to filepath
try { try {
let result = await sendRequest(); let result = await sendRequest();
@@ -343,6 +352,8 @@ export class ResultSerializer {
severity: Severity.Error, severity: Severity.Error,
message: msgSaveFailed + error message: msgSaveFailed + error
}); });
} finally {
notificationHandle.close();
} }
} }