From ee0896ea5dbcf0e64b9e96a929a723fe3bd0fe1c Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 16 Jul 2021 16:40:13 -0700 Subject: [PATCH] use modal confirmation dialog (#16247) --- .../profiler/browser/profilerActions.ts | 42 ++++++++----------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/sql/workbench/contrib/profiler/browser/profilerActions.ts b/src/sql/workbench/contrib/profiler/browser/profilerActions.ts index 38cfb9b2ce..3ea98e5aeb 100644 --- a/src/sql/workbench/contrib/profiler/browser/profilerActions.ts +++ b/src/sql/workbench/contrib/profiler/browser/profilerActions.ts @@ -16,7 +16,7 @@ import * as nls from 'vs/nls'; import { IEditorAction } from 'vs/editor/common/editorCommon'; import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; -import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; +import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; export class ProfilerConnect extends Action { private static readonly ConnectText = nls.localize('profilerAction.connect', "Connect"); @@ -150,22 +150,18 @@ export class ProfilerClear extends Action { constructor(id: string, label: string, - @INotificationService private _notificationService: INotificationService) { + @IDialogService private _dialogService: IDialogService) { super(id, label, 'clear-results'); } override async run(input: ProfilerInput): Promise { - this._notificationService.prompt(Severity.Warning, nls.localize('profiler.clearDataPrompt', "Are you sure you want to clear the data?"), [ - { - label: nls.localize('profiler.yes', "Yes"), - run: () => { - input.data.clear(); - } - }, { - label: nls.localize('profiler.no', "No"), - run: () => { } - } - ]); + const result = await this._dialogService.confirm({ + type: 'question', + message: nls.localize('profiler.clearDataPrompt', "Are you sure you want to clear the data?") + }); + if (result.confirmed) { + input.data.clear(); + } } } @@ -315,22 +311,18 @@ export class ProfilerClearSessionFilter extends Action { constructor( id: string, label: string, - @INotificationService private _notificationService: INotificationService + @IDialogService private _dialogService: IDialogService ) { super(id, label, 'clear-filter'); } public override async run(input: ProfilerInput): Promise { - this._notificationService.prompt(Severity.Warning, nls.localize('profiler.clearFilterPrompt', "Are you sure you want to clear the filters?"), [ - { - label: nls.localize('profiler.yes', "Yes"), - run: () => { - input.clearFilter(); - } - }, { - label: nls.localize('profiler.no', "No"), - run: () => { } - } - ]); + const result = await this._dialogService.confirm({ + type: 'question', + message: nls.localize('profiler.clearFilterPrompt', "Are you sure you want to clear the filters?") + }); + if (result.confirmed) { + input.clearFilter(); + } } }