mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
update the scripting error notification (#23449)
This commit is contained in:
@@ -27,7 +27,7 @@ import { INotificationService, Severity } from 'vs/platform/notification/common/
|
|||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
|
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
|
||||||
import { AsyncServerTree } from 'sql/workbench/services/objectExplorer/browser/asyncServerTree';
|
import { AsyncServerTree } from 'sql/workbench/services/objectExplorer/browser/asyncServerTree';
|
||||||
import { Action } from 'vs/base/common/actions';
|
import { Action, toAction } from 'vs/base/common/actions';
|
||||||
|
|
||||||
//#region -- Data Explorer
|
//#region -- Data Explorer
|
||||||
export const SCRIPT_AS_CREATE_COMMAND_ID = 'dataExplorer.scriptAsCreate';
|
export const SCRIPT_AS_CREATE_COMMAND_ID = 'dataExplorer.scriptAsCreate';
|
||||||
@@ -211,7 +211,7 @@ async function runScriptingAction(accessor: ServicesAccessor, args: ObjectExplor
|
|||||||
const logService = accessor.get(ILogService);
|
const logService = accessor.get(ILogService);
|
||||||
const selectionHandler = instantiationService.createInstance(TreeSelectionHandler);
|
const selectionHandler = instantiationService.createInstance(TreeSelectionHandler);
|
||||||
const notificationHandle = notificationService.notify({
|
const notificationHandle = notificationService.notify({
|
||||||
message: localize('scriptActionError.inProgress', "Generating script..."),
|
message: localize('scriptingAction.inProgress', "Generating script..."),
|
||||||
severity: Severity.Info,
|
severity: Severity.Info,
|
||||||
progress: {
|
progress: {
|
||||||
infinite: true
|
infinite: true
|
||||||
@@ -227,10 +227,21 @@ async function runScriptingAction(accessor: ServicesAccessor, args: ObjectExplor
|
|||||||
selectionHandler.onTreeActionStateChange(false);
|
selectionHandler.onTreeActionStateChange(false);
|
||||||
notificationHandle.close();
|
notificationHandle.close();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notificationHandle.updateSeverity(Severity.Error);
|
|
||||||
const msg = localize('scriptActionError', "An error occurred while executing the action: {0}.", getErrorMessage(error));
|
const msg = localize('scriptActionError', "An error occurred while executing the action: {0}.", getErrorMessage(error));
|
||||||
logService.error(msg);
|
logService.error(msg);
|
||||||
|
notificationHandle.updateSeverity(Severity.Error);
|
||||||
notificationHandle.updateMessage(msg);
|
notificationHandle.updateMessage(msg);
|
||||||
|
notificationHandle.progress.done();
|
||||||
|
notificationHandle.updateActions({
|
||||||
|
primary: [
|
||||||
|
toAction({
|
||||||
|
id: 'closeScriptingNotification',
|
||||||
|
label: localize('scriptingAction.close', "Close"),
|
||||||
|
run: () => {
|
||||||
|
notificationHandle.close();
|
||||||
|
}
|
||||||
|
})]
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user