diff --git a/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts b/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts index 719d2548a9..c1b26c6604 100644 --- a/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts +++ b/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts @@ -66,7 +66,7 @@ export class ConfigurePythonWizard { } else { wizardTitle = localize('configurePython.wizardNameWithoutKernel', "Configure Python to run kernels"); } - this._wizard = azdata.window.createWizard(wizardTitle, 600); + this._wizard = azdata.window.createWizard(wizardTitle, 'ConfigurePythonWizard', 600); let page0 = azdata.window.createWizardPage(localize('configurePython.page0Name', "Configure Python Runtime")); let page1 = azdata.window.createWizardPage(localize('configurePython.page1Name', "Install Dependencies")); diff --git a/extensions/resource-deployment/src/interfaces.ts b/extensions/resource-deployment/src/interfaces.ts index 66e4a8cb3e..f9773f73d2 100644 --- a/extensions/resource-deployment/src/interfaces.ts +++ b/extensions/resource-deployment/src/interfaces.ts @@ -127,6 +127,7 @@ export interface WizardInfoBase extends FieldInfoBase { type?: DeploymentType; actionText?: string; title: string; + name?: string; pages: PageInfoBase[]; isSummaryPageAutoGenerated?: boolean } diff --git a/extensions/resource-deployment/src/ui/deployAzureSQLVMWizard/deployAzureSQLVMWizard.ts b/extensions/resource-deployment/src/ui/deployAzureSQLVMWizard/deployAzureSQLVMWizard.ts index 749d9ccad3..ba8db24336 100644 --- a/extensions/resource-deployment/src/ui/deployAzureSQLVMWizard/deployAzureSQLVMWizard.ts +++ b/extensions/resource-deployment/src/ui/deployAzureSQLVMWizard/deployAzureSQLVMWizard.ts @@ -28,6 +28,7 @@ export class DeployAzureSQLVMWizard extends WizardBase, M extends Model return this._model; } - constructor(private title: string, private _model: M, public toolsService: IToolsService) { - this.wizardObject = azdata.window.createWizard(title); + constructor(private title: string, name: string, private _model: M, public toolsService: IToolsService) { + this.wizardObject = azdata.window.createWizard(title, name); } public async open(): Promise { diff --git a/src/sql/azdata.proposed.d.ts b/src/sql/azdata.proposed.d.ts index da745b729a..8ff109ba86 100644 --- a/src/sql/azdata.proposed.d.ts +++ b/src/sql/azdata.proposed.d.ts @@ -523,6 +523,10 @@ declare module 'azdata' { } export interface Wizard { + /** + * The name used to identify the wizard in telemetry + */ + name?: string; /** * Width of the wizard */ @@ -542,9 +546,10 @@ declare module 'azdata' { /** * Create a wizard with the given title and width * @param title The title of the wizard + * @param name The name used to identify the wizard in telemetry * @param width The width of the wizard, default value is 'narrow' */ - export function createWizard(title: string, width?: DialogWidth): Wizard; + export function createWizard(title: string, name?: string, width?: DialogWidth): Wizard; } export interface DashboardTab extends Tab { diff --git a/src/sql/workbench/api/browser/mainThreadModelViewDialog.ts b/src/sql/workbench/api/browser/mainThreadModelViewDialog.ts index c6dafc4b3d..2376d72e47 100644 --- a/src/sql/workbench/api/browser/mainThreadModelViewDialog.ts +++ b/src/sql/workbench/api/browser/mainThreadModelViewDialog.ts @@ -166,7 +166,9 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape public $setWizardDetails(handle: number, details: IModelViewWizardDetails): Thenable { let wizard = this._wizards.get(handle); if (!wizard) { - wizard = new Wizard(details.title, + wizard = new Wizard( + details.title, + details.name || 'WizardPage', this.getButton(details.doneButton), this.getButton(details.cancelButton), this.getButton(details.nextButton), diff --git a/src/sql/workbench/api/common/extHostModelViewDialog.ts b/src/sql/workbench/api/common/extHostModelViewDialog.ts index 868d90384d..0ce30df127 100644 --- a/src/sql/workbench/api/common/extHostModelViewDialog.ts +++ b/src/sql/workbench/api/common/extHostModelViewDialog.ts @@ -382,7 +382,7 @@ class WizardImpl implements azdata.window.Wizard { private _operationHandler: BackgroundOperationHandler; private _width: DialogWidth; - constructor(public title: string, private _extHostModelViewDialog: ExtHostModelViewDialog, extHostTaskManagement: ExtHostBackgroundTaskManagementShape) { + constructor(public title: string, public name: string, private _extHostModelViewDialog: ExtHostModelViewDialog, extHostTaskManagement: ExtHostBackgroundTaskManagementShape) { this.doneButton = this._extHostModelViewDialog.createButton(DONE_LABEL); this.cancelButton = this._extHostModelViewDialog.createButton(CANCEL_LABEL); this.generateScriptButton = this._extHostModelViewDialog.createButton(GENERATE_SCRIPT_LABEL); @@ -761,8 +761,8 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape { return page; } - public createWizard(title: string, width: azdata.window.DialogWidth = 'wide'): azdata.window.Wizard { - let wizard = new WizardImpl(title, this, this._extHostTaskManagement); + public createWizard(title: string, name: string = 'ModelViewWizard', width: azdata.window.DialogWidth = 'wide'): azdata.window.Wizard { + let wizard = new WizardImpl(title, name, this, this._extHostTaskManagement); wizard.width = width; this.getHandle(wizard); return wizard; @@ -795,6 +795,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape { } return this._proxy.$setWizardDetails(handle, { title: wizard.title, + name: wizard.name, width: wizard.width, pages: wizard.pages.map(page => this.getHandle(page)), currentPage: wizard.currentPage, diff --git a/src/sql/workbench/api/common/sqlExtHost.api.impl.ts b/src/sql/workbench/api/common/sqlExtHost.api.impl.ts index f2e5f95b9b..bb0be526b3 100644 --- a/src/sql/workbench/api/common/sqlExtHost.api.impl.ts +++ b/src/sql/workbench/api/common/sqlExtHost.api.impl.ts @@ -437,8 +437,8 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp createWizardPage(title: string): azdata.window.WizardPage { return extHostModelViewDialog.createWizardPage(title, extension); }, - createWizard(title: string, width?: azdata.window.DialogWidth): azdata.window.Wizard { - return extHostModelViewDialog.createWizard(title, width); + createWizard(title: string, name?: string, width?: azdata.window.DialogWidth): azdata.window.Wizard { + return extHostModelViewDialog.createWizard(title, name, width); }, createModelViewDashboard(title: string, options?: azdata.ModelViewDashboardOptions): azdata.window.ModelViewDashboard { return extHostModelViewDialog.createModelViewDashboard(title, options, extension); diff --git a/src/sql/workbench/api/common/sqlExtHostTypes.ts b/src/sql/workbench/api/common/sqlExtHostTypes.ts index ce3d3f37cf..4598e4fb79 100644 --- a/src/sql/workbench/api/common/sqlExtHostTypes.ts +++ b/src/sql/workbench/api/common/sqlExtHostTypes.ts @@ -280,6 +280,7 @@ export interface IModelViewWizardPageDetails { export interface IModelViewWizardDetails { title: string; + name?: string; pages: number[]; currentPage: number; doneButton: number; diff --git a/src/sql/workbench/browser/modal/modal.ts b/src/sql/workbench/browser/modal/modal.ts index 37fb9b5880..67af20548f 100644 --- a/src/sql/workbench/browser/modal/modal.ts +++ b/src/sql/workbench/browser/modal/modal.ts @@ -392,12 +392,15 @@ export abstract class Modal extends Disposable implements IThemable { /** * Hides the modal and removes key listeners */ - protected hide() { + protected hide(reason?: string) { this._modalShowingContext.get()!.pop(); this._bodyContainer!.remove(); this.disposableStore.clear(); this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.ModalDialogClosed) - .withAdditionalProperties({ name: this._name }) + .withAdditionalProperties({ + name: this._name, + reason: reason + }) .send(); this.restoreKeyboardFocus(); } diff --git a/src/sql/workbench/services/dashboard/browser/newDashboardTabDialogImpl.ts b/src/sql/workbench/services/dashboard/browser/newDashboardTabDialogImpl.ts index 39230fc397..f00a30baf5 100644 --- a/src/sql/workbench/services/dashboard/browser/newDashboardTabDialogImpl.ts +++ b/src/sql/workbench/services/dashboard/browser/newDashboardTabDialogImpl.ts @@ -203,7 +203,7 @@ export class NewDashboardTabDialog extends Modal { } public close() { - this.hide(); + this.hide('close'); } private addNewTabs() { @@ -214,7 +214,7 @@ export class NewDashboardTabDialog extends Modal { } public cancel() { - this.hide(); + this.hide('cancel'); } public open(dashboardTabs: Array, openedTabs: Array) { diff --git a/src/sql/workbench/services/dialog/browser/customDialogService.ts b/src/sql/workbench/services/dialog/browser/customDialogService.ts index 6f889c2f89..c473fd8090 100644 --- a/src/sql/workbench/services/dialog/browser/customDialogService.ts +++ b/src/sql/workbench/services/dialog/browser/customDialogService.ts @@ -27,7 +27,7 @@ export class CustomDialogService { } public showWizard(wizard: Wizard, options?: IModalOptions): void { - let wizardModal = this._instantiationService.createInstance(WizardModal, wizard, 'WizardPage', options || DefaultWizardOptions); + let wizardModal = this._instantiationService.createInstance(WizardModal, wizard, options || DefaultWizardOptions); this._wizardModals.set(wizard, wizardModal); wizardModal.render(); wizardModal.open(); diff --git a/src/sql/workbench/services/dialog/browser/dialogModal.ts b/src/sql/workbench/services/dialog/browser/dialogModal.ts index 10870586e4..673f275b48 100644 --- a/src/sql/workbench/services/dialog/browser/dialogModal.ts +++ b/src/sql/workbench/services/dialog/browser/dialogModal.ts @@ -132,7 +132,7 @@ export class DialogModal extends Modal { if (await this._dialog.validateClose()) { this._onDone.fire(); this.dispose(); - this.hide(); + this.hide('close'); } clearTimeout(buttonSpinnerHandler); this._doneButton.element.classList.remove('validating'); @@ -143,15 +143,7 @@ export class DialogModal extends Modal { public cancel(): void { this._onCancel.fire(); this.dispose(); - this.hide(); - } - - protected hide(): void { - super.hide(); - } - - protected show(): void { - super.show(); + this.hide('cancel'); } /** diff --git a/src/sql/workbench/services/dialog/browser/wizardModal.ts b/src/sql/workbench/services/dialog/browser/wizardModal.ts index e83e4b50c8..901e42ff0b 100644 --- a/src/sql/workbench/services/dialog/browser/wizardModal.ts +++ b/src/sql/workbench/services/dialog/browser/wizardModal.ts @@ -46,7 +46,6 @@ export class WizardModal extends Modal { constructor( private _wizard: Wizard, - name: string, options: IModalOptions, @ILayoutService layoutService: ILayoutService, @IThemeService themeService: IThemeService, @@ -57,7 +56,7 @@ export class WizardModal extends Modal { @ILogService logService: ILogService, @ITextResourcePropertiesService textResourcePropertiesService: ITextResourcePropertiesService ) { - super(_wizard.title, name, telemetryService, layoutService, clipboardService, themeService, logService, textResourcePropertiesService, contextKeyService, options); + super(_wizard.title, _wizard.name, telemetryService, layoutService, clipboardService, themeService, logService, textResourcePropertiesService, contextKeyService, options); this._useDefaultMessageBoxLocation = false; } @@ -264,14 +263,14 @@ export class WizardModal extends Modal { } this._onDone.fire(); this.dispose(); - this.hide(); + this.hide('done'); } } public cancel(): void { this._onCancel.fire(); this.dispose(); - this.hide(); + this.hide('cancel'); } private async validateNavigation(newPage: number): Promise { @@ -288,14 +287,6 @@ export class WizardModal extends Modal { return navigationValid; } - protected hide(): void { - super.hide(); - } - - protected show(): void { - super.show(); - } - /** * Overridable to change behavior of escape key */ diff --git a/src/sql/workbench/services/dialog/common/dialogTypes.ts b/src/sql/workbench/services/dialog/common/dialogTypes.ts index 52c4530bb5..499e9fa578 100644 --- a/src/sql/workbench/services/dialog/common/dialogTypes.ts +++ b/src/sql/workbench/services/dialog/common/dialogTypes.ts @@ -200,6 +200,7 @@ export class Wizard { public width: DialogWidth | undefined; constructor(public title: string, + public readonly name: string, public doneButton: DialogButton, public cancelButton: DialogButton, public nextButton: DialogButton, diff --git a/src/sql/workbench/services/profiler/browser/profilerFilterDialog.ts b/src/sql/workbench/services/profiler/browser/profilerFilterDialog.ts index 49999fa31b..b71cd07de8 100644 --- a/src/sql/workbench/services/profiler/browser/profilerFilterDialog.ts +++ b/src/sql/workbench/services/profiler/browser/profilerFilterDialog.ts @@ -107,7 +107,7 @@ export class ProfilerFilterDialog extends Modal { this._loadFilterButton = this.addFooterButton(LoadFilterText, () => this.loadSavedFilter(), 'left'); this._applyButton = this.addFooterButton(ApplyText, () => this.filterSession()); this._okButton = this.addFooterButton(OkText, () => this.handleOkButtonClick()); - this._cancelButton = this.addFooterButton(CancelText, () => this.hide()); + this._cancelButton = this.addFooterButton(CancelText, () => this.hide('cancel')); this._register(attachButtonStyler(this._okButton, this._themeService)); this._register(attachButtonStyler(this._cancelButton, this._themeService)); this._register(attachButtonStyler(this._applyButton, this._themeService)); @@ -139,7 +139,7 @@ export class ProfilerFilterDialog extends Modal { /* espace key */ protected onClose() { - this.hide(); + this.hide('close'); } /* enter key */ @@ -149,7 +149,7 @@ export class ProfilerFilterDialog extends Modal { private handleOkButtonClick(): void { this.filterSession(); - this.hide(); + this.hide('ok'); } private handleClearButtonClick() {