Adding Dacpac extension telemetry and core wizard/page telemetry updates(#13859)

* Dacpac telmetry code changes

* Removed added spaces

* Generate deployScript accessibility changed back to public

* code review suggessions updates

* dacpac extension tests fixes

* Updated time and filesize methods allowing general return values

* Telemetry code updates

* Dacpac Telemetry potential data loss capture and PII error excluded

* Dacpac telemetry code updates for comments

* Wizard pages navigation telemetry event capture moved to the core

* DacpacTelemetry code updates

* Extension wizard cancel telemetry for data loss

* Dacpac telemetry pagename and small code updates

* final Dacpac telemetry code updates...
This commit is contained in:
Sai Avishkar Sreerama
2021-01-21 17:00:37 -06:00
committed by GitHub
parent 07d798c949
commit 0316d9ac57
16 changed files with 282 additions and 63 deletions

View File

@@ -151,7 +151,7 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
public $setWizardPageDetails(handle: number, details: IModelViewWizardPageDetails): Thenable<void> {
let page = this._wizardPages.get(handle);
if (!page) {
page = new WizardPage(details.title, details.content);
page = new WizardPage(details.title, details.content, details.pageName);
page.onValidityChanged(valid => this._proxy.$onPanelValidityChanged(handle, valid));
this._wizardPages.set(handle, page);
this._wizardPageHandles.set(page, handle);
@@ -161,6 +161,7 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
page.content = details.content;
page.enabled = details.enabled;
page.description = details.description;
page.pageName = details.pageName;
if (details.customButtons !== undefined) {
page.customButtons = details.customButtons.map(buttonHandle => this.getButton(buttonHandle));
}

View File

@@ -324,7 +324,8 @@ class WizardPageImpl extends ModelViewPanelImpl implements azdata.window.WizardP
constructor(public title: string,
extHostModelViewDialog: ExtHostModelViewDialog,
extHostModelView: ExtHostModelViewShape,
extension: IExtensionDescription) {
extension: IExtensionDescription,
public pageName?: string) {
super('modelViewWizardPage', extHostModelViewDialog, extHostModelView, extension);
}
@@ -758,8 +759,8 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
this._pageInfoChangedCallbacks.set(handle, callback);
}
public createWizardPage(title: string, extension?: IExtensionDescription): azdata.window.WizardPage {
let page = new WizardPageImpl(title, this, this._extHostModelView, extension);
public createWizardPage(title: string, extension?: IExtensionDescription, pageName?: string): azdata.window.WizardPage {
let page = new WizardPageImpl(title, this, this._extHostModelView, extension, pageName);
page.handle = this.getHandle(page);
return page;
}
@@ -781,7 +782,8 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
customButtons: page.customButtons ? page.customButtons.map(button => this.getHandle(button)) : undefined,
enabled: page.enabled,
title: page.title,
description: page.description
description: page.description,
pageName: page.pageName
});
}

View File

@@ -435,8 +435,8 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
closeDialog(dialog: azdata.window.Dialog) {
return extHostModelViewDialog.closeDialog(dialog);
},
createWizardPage(title: string): azdata.window.WizardPage {
return extHostModelViewDialog.createWizardPage(title, extension);
createWizardPage(title: string, pageName?: string): azdata.window.WizardPage {
return extHostModelViewDialog.createWizardPage(title, extension, pageName);
},
createWizard(title: string, name?: string, width?: azdata.window.DialogWidth): azdata.window.Wizard {
return extHostModelViewDialog.createWizard(title, name, width);

View File

@@ -278,6 +278,7 @@ export interface IModelViewWizardPageDetails {
enabled: boolean;
customButtons: number[];
description: string;
pageName?: string;
}
export interface IModelViewWizardDetails {

View File

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

View File

@@ -3,6 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
import 'vs/css!./media/dialogModal';
import { Modal, IModalOptions } from 'sql/workbench/browser/modal/modal';
import { Wizard, DialogButton, WizardPage } from 'sql/workbench/services/dialog/common/dialogTypes';
@@ -49,14 +50,14 @@ export class WizardModal extends Modal {
options: IModalOptions,
@ILayoutService layoutService: ILayoutService,
@IThemeService themeService: IThemeService,
@IAdsTelemetryService telemetryService: IAdsTelemetryService,
@IAdsTelemetryService private _telemetryEventService: IAdsTelemetryService,
@IContextKeyService contextKeyService: IContextKeyService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IClipboardService clipboardService: IClipboardService,
@ILogService logService: ILogService,
@ITextResourcePropertiesService textResourcePropertiesService: ITextResourcePropertiesService
) {
super(_wizard.title, _wizard.name, telemetryService, layoutService, clipboardService, themeService, logService, textResourcePropertiesService, contextKeyService, options);
super(_wizard.title, _wizard.name, _telemetryEventService, layoutService, clipboardService, themeService, logService, textResourcePropertiesService, contextKeyService, options);
this._useDefaultMessageBoxLocation = false;
}
@@ -175,6 +176,7 @@ export class WizardModal extends Modal {
public async showPage(index: number, validate: boolean = true, focus: boolean = false, readHeader: boolean = true): Promise<void> {
let pageToShow = this._wizard.pages[index];
const prevPageIndex = this._wizard.currentPage;
if (!pageToShow) {
this.done(validate).catch(err => onUnexpectedError(err));
return;
@@ -209,6 +211,15 @@ export class WizardModal extends Modal {
this._doneButton.enabled = this._wizard.doneButton.enabled && pageToShow.valid;
}
});
if (index !== prevPageIndex) {
this._telemetryEventService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.WizardPagesNavigation)
.withAdditionalProperties({
wizardName: this._wizard.name,
pageNavigationFrom: this._wizard.pages[prevPageIndex].pageName ?? prevPageIndex,
pageNavigationTo: this._wizard.pages[index].pageName ?? index
}).send();
}
}
private setButtonsForPage(index: number) {
@@ -268,9 +279,10 @@ export class WizardModal extends Modal {
}
public cancel(): void {
const currentPage = this._wizard.pages[this._wizard.currentPage];
this._onCancel.fire();
this.dispose();
this.hide('cancel');
this.hide('cancel', currentPage.pageName ?? this._wizard.currentPage.toString());
}
private async validateNavigation(newPage: number): Promise<boolean> {

View File

@@ -157,7 +157,7 @@ export class WizardPage extends DialogTab {
private _onUpdate: Emitter<void> = new Emitter<void>();
public readonly onUpdate: Event<void> = this._onUpdate.event;
constructor(public title: string, content?: string) {
constructor(public title: string, content?: string, public pageName?: string) {
super(title, content);
}

View File

@@ -140,14 +140,16 @@ suite('MainThreadModelViewDialog Tests', () => {
content: 'content1',
enabled: true,
customButtons: [],
description: 'description1'
description: 'description1',
pageName: 'pageName1'
};
page2Details = {
title: 'page2',
content: 'content2',
enabled: true,
customButtons: [button1Handle, button2Handle],
description: 'description2'
description: 'description2',
pageName: undefined
};
wizardDetails = {
backButton: backButtonHandle,
@@ -302,7 +304,8 @@ suite('MainThreadModelViewDialog Tests', () => {
content: 'content_3',
customButtons: [],
enabled: true,
description: undefined
description: undefined,
pageName: undefined
};
// If I open the wizard and then add a page