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

@@ -66,7 +66,7 @@ export class ConfigurePythonWizard {
} else { } else {
wizardTitle = localize('configurePython.wizardNameWithoutKernel', "Configure Python to run kernels"); 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 page0 = azdata.window.createWizardPage(localize('configurePython.page0Name', "Configure Python Runtime"));
let page1 = azdata.window.createWizardPage(localize('configurePython.page1Name', "Install Dependencies")); let page1 = azdata.window.createWizardPage(localize('configurePython.page1Name', "Install Dependencies"));

View File

@@ -127,6 +127,7 @@ export interface WizardInfoBase extends FieldInfoBase {
type?: DeploymentType; type?: DeploymentType;
actionText?: string; actionText?: string;
title: string; title: string;
name?: string;
pages: PageInfoBase[]; pages: PageInfoBase[];
isSummaryPageAutoGenerated?: boolean isSummaryPageAutoGenerated?: boolean
} }

View File

@@ -28,6 +28,7 @@ export class DeployAzureSQLVMWizard extends WizardBase<DeployAzureSQLVMWizard, W
constructor(private wizardInfo: AzureSQLVMWizardInfo, private _notebookService: INotebookService, private _toolsService: IToolsService) { constructor(private wizardInfo: AzureSQLVMWizardInfo, private _notebookService: INotebookService, private _toolsService: IToolsService) {
super( super(
constants.WizardTitle, constants.WizardTitle,
'DeployAzureSqlVMWizard',
new DeployAzureSQLVMWizardModel(), new DeployAzureSQLVMWizardModel(),
_toolsService _toolsService
); );

View File

@@ -58,7 +58,7 @@ export class DeployClusterWizard extends WizardBase<DeployClusterWizard, WizardP
} }
constructor(private wizardInfo: BdcWizardInfo, private _kubeService: IKubeService, private _azdataService: IAzdataService, private _notebookService: INotebookService, toolsService: IToolsService) { constructor(private wizardInfo: BdcWizardInfo, private _kubeService: IKubeService, private _azdataService: IAzdataService, private _notebookService: INotebookService, toolsService: IToolsService) {
super(DeployClusterWizard.getTitle(wizardInfo.type), new DeployClusterWizardModel(wizardInfo.type), toolsService); super(DeployClusterWizard.getTitle(wizardInfo.type), 'DeployBdcClusterWizard', new DeployClusterWizardModel(wizardInfo.type), toolsService);
this._saveConfigButton = azdata.window.createButton(localize('deployCluster.SaveConfigFiles', "Save config files"), 'left'); this._saveConfigButton = azdata.window.createButton(localize('deployCluster.SaveConfigFiles', "Save config files"), 'left');
this._saveConfigButton.hidden = true; this._saveConfigButton.hidden = true;
this.addButton(this._saveConfigButton); this.addButton(this._saveConfigButton);

View File

@@ -36,7 +36,7 @@ export class NotebookWizard extends WizardBase<NotebookWizard, NotebookWizardPag
} }
constructor(private _wizardInfo: NotebookWizardInfo, private _notebookService: INotebookService, private _platformService: IPlatformService, toolsService: IToolsService) { constructor(private _wizardInfo: NotebookWizardInfo, private _notebookService: INotebookService, private _platformService: IPlatformService, toolsService: IToolsService) {
super(_wizardInfo.title, new Model(), toolsService); super(_wizardInfo.title, _wizardInfo.name || '', new Model(), toolsService);
if (this._wizardInfo.codeCellInsertionPosition === undefined) { if (this._wizardInfo.codeCellInsertionPosition === undefined) {
this._wizardInfo.codeCellInsertionPosition = 0; this._wizardInfo.codeCellInsertionPosition = 0;
} }

View File

@@ -21,8 +21,8 @@ export abstract class WizardBase<T, P extends WizardPageBase<T>, M extends Model
return this._model; return this._model;
} }
constructor(private title: string, private _model: M, public toolsService: IToolsService) { constructor(private title: string, name: string, private _model: M, public toolsService: IToolsService) {
this.wizardObject = azdata.window.createWizard(title); this.wizardObject = azdata.window.createWizard(title, name);
} }
public async open(): Promise<void> { public async open(): Promise<void> {

View File

@@ -523,6 +523,10 @@ declare module 'azdata' {
} }
export interface Wizard { export interface Wizard {
/**
* The name used to identify the wizard in telemetry
*/
name?: string;
/** /**
* Width of the wizard * Width of the wizard
*/ */
@@ -542,9 +546,10 @@ declare module 'azdata' {
/** /**
* Create a wizard with the given title and width * Create a wizard with the given title and width
* @param title The title of the wizard * @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' * @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 { export interface DashboardTab extends Tab {

View File

@@ -166,7 +166,9 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
public $setWizardDetails(handle: number, details: IModelViewWizardDetails): Thenable<void> { public $setWizardDetails(handle: number, details: IModelViewWizardDetails): Thenable<void> {
let wizard = this._wizards.get(handle); let wizard = this._wizards.get(handle);
if (!wizard) { if (!wizard) {
wizard = new Wizard(details.title, wizard = new Wizard(
details.title,
details.name || 'WizardPage',
this.getButton(details.doneButton), this.getButton(details.doneButton),
this.getButton(details.cancelButton), this.getButton(details.cancelButton),
this.getButton(details.nextButton), this.getButton(details.nextButton),

View File

@@ -382,7 +382,7 @@ class WizardImpl implements azdata.window.Wizard {
private _operationHandler: BackgroundOperationHandler; private _operationHandler: BackgroundOperationHandler;
private _width: DialogWidth; 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.doneButton = this._extHostModelViewDialog.createButton(DONE_LABEL);
this.cancelButton = this._extHostModelViewDialog.createButton(CANCEL_LABEL); this.cancelButton = this._extHostModelViewDialog.createButton(CANCEL_LABEL);
this.generateScriptButton = this._extHostModelViewDialog.createButton(GENERATE_SCRIPT_LABEL); this.generateScriptButton = this._extHostModelViewDialog.createButton(GENERATE_SCRIPT_LABEL);
@@ -761,8 +761,8 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
return page; return page;
} }
public createWizard(title: string, width: azdata.window.DialogWidth = 'wide'): azdata.window.Wizard { public createWizard(title: string, name: string = 'ModelViewWizard', width: azdata.window.DialogWidth = 'wide'): azdata.window.Wizard {
let wizard = new WizardImpl(title, this, this._extHostTaskManagement); let wizard = new WizardImpl(title, name, this, this._extHostTaskManagement);
wizard.width = width; wizard.width = width;
this.getHandle(wizard); this.getHandle(wizard);
return wizard; return wizard;
@@ -795,6 +795,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
} }
return this._proxy.$setWizardDetails(handle, { return this._proxy.$setWizardDetails(handle, {
title: wizard.title, title: wizard.title,
name: wizard.name,
width: wizard.width, width: wizard.width,
pages: wizard.pages.map(page => this.getHandle(page)), pages: wizard.pages.map(page => this.getHandle(page)),
currentPage: wizard.currentPage, currentPage: wizard.currentPage,

View File

@@ -437,8 +437,8 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
createWizardPage(title: string): azdata.window.WizardPage { createWizardPage(title: string): azdata.window.WizardPage {
return extHostModelViewDialog.createWizardPage(title, extension); return extHostModelViewDialog.createWizardPage(title, extension);
}, },
createWizard(title: string, width?: azdata.window.DialogWidth): azdata.window.Wizard { createWizard(title: string, name?: string, width?: azdata.window.DialogWidth): azdata.window.Wizard {
return extHostModelViewDialog.createWizard(title, width); return extHostModelViewDialog.createWizard(title, name, width);
}, },
createModelViewDashboard(title: string, options?: azdata.ModelViewDashboardOptions): azdata.window.ModelViewDashboard { createModelViewDashboard(title: string, options?: azdata.ModelViewDashboardOptions): azdata.window.ModelViewDashboard {
return extHostModelViewDialog.createModelViewDashboard(title, options, extension); return extHostModelViewDialog.createModelViewDashboard(title, options, extension);

View File

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

View File

@@ -392,12 +392,15 @@ export abstract class Modal extends Disposable implements IThemable {
/** /**
* Hides the modal and removes key listeners * Hides the modal and removes key listeners
*/ */
protected hide() { protected hide(reason?: string) {
this._modalShowingContext.get()!.pop(); this._modalShowingContext.get()!.pop();
this._bodyContainer!.remove(); this._bodyContainer!.remove();
this.disposableStore.clear(); this.disposableStore.clear();
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.ModalDialogClosed) this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.ModalDialogClosed)
.withAdditionalProperties({ name: this._name }) .withAdditionalProperties({
name: this._name,
reason: reason
})
.send(); .send();
this.restoreKeyboardFocus(); this.restoreKeyboardFocus();
} }

View File

@@ -203,7 +203,7 @@ export class NewDashboardTabDialog extends Modal {
} }
public close() { public close() {
this.hide(); this.hide('close');
} }
private addNewTabs() { private addNewTabs() {
@@ -214,7 +214,7 @@ export class NewDashboardTabDialog extends Modal {
} }
public cancel() { public cancel() {
this.hide(); this.hide('cancel');
} }
public open(dashboardTabs: Array<IDashboardTab>, openedTabs: Array<IDashboardTab>) { public open(dashboardTabs: Array<IDashboardTab>, openedTabs: Array<IDashboardTab>) {

View File

@@ -27,7 +27,7 @@ export class CustomDialogService {
} }
public showWizard(wizard: Wizard, options?: IModalOptions): void { 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); this._wizardModals.set(wizard, wizardModal);
wizardModal.render(); wizardModal.render();
wizardModal.open(); wizardModal.open();

View File

@@ -132,7 +132,7 @@ export class DialogModal extends Modal {
if (await this._dialog.validateClose()) { if (await this._dialog.validateClose()) {
this._onDone.fire(); this._onDone.fire();
this.dispose(); this.dispose();
this.hide(); this.hide('close');
} }
clearTimeout(buttonSpinnerHandler); clearTimeout(buttonSpinnerHandler);
this._doneButton.element.classList.remove('validating'); this._doneButton.element.classList.remove('validating');
@@ -143,15 +143,7 @@ export class DialogModal extends Modal {
public cancel(): void { public cancel(): void {
this._onCancel.fire(); this._onCancel.fire();
this.dispose(); this.dispose();
this.hide(); this.hide('cancel');
}
protected hide(): void {
super.hide();
}
protected show(): void {
super.show();
} }
/** /**

View File

@@ -46,7 +46,6 @@ export class WizardModal extends Modal {
constructor( constructor(
private _wizard: Wizard, private _wizard: Wizard,
name: string,
options: IModalOptions, options: IModalOptions,
@ILayoutService layoutService: ILayoutService, @ILayoutService layoutService: ILayoutService,
@IThemeService themeService: IThemeService, @IThemeService themeService: IThemeService,
@@ -57,7 +56,7 @@ export class WizardModal extends Modal {
@ILogService logService: ILogService, @ILogService logService: ILogService,
@ITextResourcePropertiesService textResourcePropertiesService: ITextResourcePropertiesService @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; this._useDefaultMessageBoxLocation = false;
} }
@@ -264,14 +263,14 @@ export class WizardModal extends Modal {
} }
this._onDone.fire(); this._onDone.fire();
this.dispose(); this.dispose();
this.hide(); this.hide('done');
} }
} }
public cancel(): void { public cancel(): void {
this._onCancel.fire(); this._onCancel.fire();
this.dispose(); this.dispose();
this.hide(); this.hide('cancel');
} }
private async validateNavigation(newPage: number): Promise<boolean> { private async validateNavigation(newPage: number): Promise<boolean> {
@@ -288,14 +287,6 @@ export class WizardModal extends Modal {
return navigationValid; return navigationValid;
} }
protected hide(): void {
super.hide();
}
protected show(): void {
super.show();
}
/** /**
* Overridable to change behavior of escape key * Overridable to change behavior of escape key
*/ */

View File

@@ -200,6 +200,7 @@ export class Wizard {
public width: DialogWidth | undefined; public width: DialogWidth | undefined;
constructor(public title: string, constructor(public title: string,
public readonly name: string,
public doneButton: DialogButton, public doneButton: DialogButton,
public cancelButton: DialogButton, public cancelButton: DialogButton,
public nextButton: DialogButton, public nextButton: DialogButton,

View File

@@ -107,7 +107,7 @@ export class ProfilerFilterDialog extends Modal {
this._loadFilterButton = this.addFooterButton(LoadFilterText, () => this.loadSavedFilter(), 'left'); this._loadFilterButton = this.addFooterButton(LoadFilterText, () => this.loadSavedFilter(), 'left');
this._applyButton = this.addFooterButton(ApplyText, () => this.filterSession()); this._applyButton = this.addFooterButton(ApplyText, () => this.filterSession());
this._okButton = this.addFooterButton(OkText, () => this.handleOkButtonClick()); 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._okButton, this._themeService));
this._register(attachButtonStyler(this._cancelButton, this._themeService)); this._register(attachButtonStyler(this._cancelButton, this._themeService));
this._register(attachButtonStyler(this._applyButton, this._themeService)); this._register(attachButtonStyler(this._applyButton, this._themeService));
@@ -139,7 +139,7 @@ export class ProfilerFilterDialog extends Modal {
/* espace key */ /* espace key */
protected onClose() { protected onClose() {
this.hide(); this.hide('close');
} }
/* enter key */ /* enter key */
@@ -149,7 +149,7 @@ export class ProfilerFilterDialog extends Modal {
private handleOkButtonClick(): void { private handleOkButtonClick(): void {
this.filterSession(); this.filterSession();
this.hide(); this.hide('ok');
} }
private handleClearButtonClick() { private handleClearButtonClick() {