Add telemetry for ModelView wizards (#12596)

* Add telemetry for ModelView wizards

* Remove unnecessary params

* Fix compile error
This commit is contained in:
Charles Gagnon
2020-09-23 17:08:22 -07:00
committed by GitHub
parent 8bc7079d78
commit 807a4ae8c4
18 changed files with 40 additions and 42 deletions

View File

@@ -166,7 +166,9 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
public $setWizardDetails(handle: number, details: IModelViewWizardDetails): Thenable<void> {
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),

View File

@@ -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,

View File

@@ -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);

View File

@@ -280,6 +280,7 @@ export interface IModelViewWizardPageDetails {
export interface IModelViewWizardDetails {
title: string;
name?: string;
pages: number[];
currentPage: number;
doneButton: number;

View File

@@ -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();
}

View File

@@ -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<IDashboardTab>, openedTabs: Array<IDashboardTab>) {

View File

@@ -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();

View File

@@ -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');
}
/**

View File

@@ -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<boolean> {
@@ -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
*/

View File

@@ -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,

View File

@@ -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() {