mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 01:25:38 -05:00
connect dialog telemetry (#15267)
* add connection dialog telemetry * reset source * add to correct place
This commit is contained in:
@@ -29,6 +29,7 @@ export enum TelemetryView {
|
||||
AgentJobSteps = 'AgentJobSteps',
|
||||
AgentNotebookHistory = 'AgentNotebookHistory',
|
||||
AgentNotebooks = 'AgentNotebooks',
|
||||
ConnectionDialog = 'ConnectionDialog',
|
||||
Shell = 'Shell',
|
||||
ExtensionRecommendationDialog = 'ExtensionRecommendationDialog',
|
||||
ResultsPanel = 'ResultsPanel',
|
||||
@@ -43,6 +44,7 @@ export enum TelemetryError {
|
||||
export enum TelemetryAction {
|
||||
AddServerGroup = 'AddServerGroup',
|
||||
adsCommandExecuted = 'adsCommandExecuted',
|
||||
ConnectToServer = 'ConnectToServer',
|
||||
BackupCreated = 'BackupCreated',
|
||||
DashboardNavigated = 'DashboardNavigated',
|
||||
DatabaseConnected = 'DatabaseConnected',
|
||||
@@ -89,6 +91,7 @@ export enum NbTelemetryAction {
|
||||
}
|
||||
|
||||
export enum TelemetryPropertyName {
|
||||
ChartMaxRowCountExceeded = 'chartMaxRowCountExceeded'
|
||||
ChartMaxRowCountExceeded = 'chartMaxRowCountExceeded',
|
||||
ConnectionSource = 'connectionSource'
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
constructor(
|
||||
private _title: string,
|
||||
private _name: string,
|
||||
private readonly _telemetryService: IAdsTelemetryService,
|
||||
protected readonly _telemetryService: IAdsTelemetryService,
|
||||
protected readonly layoutService: ILayoutService,
|
||||
protected readonly _clipboardService: IClipboardService,
|
||||
protected readonly _themeService: IThemeService,
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectio
|
||||
import { attachInputBoxStyler } from 'sql/platform/theme/common/styler';
|
||||
import { ITreeItem } from 'sql/workbench/common/views';
|
||||
import { CONNECTIONS_SORT_BY_CONFIG_KEY } from 'sql/platform/connection/common/connectionConfig';
|
||||
import { ConnectionSource } from 'sql/workbench/services/connection/browser/connectionDialogWidget';
|
||||
import { IConnectionTreeDescriptor, IConnectionTreeService } from 'sql/workbench/services/connection/common/connectionTreeService';
|
||||
import { AsyncRecentConnectionTreeDataSource } from 'sql/workbench/services/objectExplorer/browser/asyncRecentConnectionTreeDataSource';
|
||||
import { ServerTreeElement } from 'sql/workbench/services/objectExplorer/browser/asyncServerTree';
|
||||
@@ -66,7 +67,8 @@ export class ConnectionBrowseTab implements IPanelTab {
|
||||
|
||||
export interface SelectedConnectionChangedEventArgs {
|
||||
connectionProfile: IConnectionProfile,
|
||||
connect: boolean
|
||||
connect: boolean,
|
||||
source: ConnectionSource
|
||||
}
|
||||
|
||||
export class ConnectionBrowserView extends Disposable implements IPanelView {
|
||||
@@ -247,14 +249,16 @@ export class ConnectionBrowserView extends Disposable implements IPanelView {
|
||||
this._onSelectedConnectionChanged.fire(
|
||||
{
|
||||
connectionProfile: selectedNode.element.payload,
|
||||
connect: connect
|
||||
connect: connect,
|
||||
source: 'azure'
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (selectedNode instanceof ConnectionProfile) {
|
||||
this._onSelectedConnectionChanged.fire({
|
||||
connectionProfile: selectedNode,
|
||||
connect: connect
|
||||
connect: connect,
|
||||
source: 'savedconnections'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,11 @@ export interface OnShowUIResponse {
|
||||
container: HTMLElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines where the connection information is coming from
|
||||
*/
|
||||
export type ConnectionSource = 'manual' | 'recent' | 'savedconnections' | 'azure';
|
||||
|
||||
export class ConnectionDialogWidget extends Modal {
|
||||
private _body: HTMLElement;
|
||||
private _recentConnection: HTMLElement;
|
||||
@@ -94,6 +99,8 @@ export class ConnectionDialogWidget extends Modal {
|
||||
|
||||
private _connecting = false;
|
||||
|
||||
private _connectionSource: ConnectionSource = 'manual';
|
||||
|
||||
constructor(
|
||||
private providerDisplayNameOptions: string[],
|
||||
private selectedProviderType: string,
|
||||
@@ -265,6 +272,7 @@ export class ConnectionDialogWidget extends Modal {
|
||||
this.browsePanel = new ConnectionBrowseTab(this.instantiationService);
|
||||
|
||||
this._register(this.browsePanel.view.onSelectedConnectionChanged(e => {
|
||||
this._connectionSource = e.source;
|
||||
this.onConnectionClick(e.connectionProfile, e.connect);
|
||||
}));
|
||||
|
||||
@@ -337,6 +345,9 @@ export class ConnectionDialogWidget extends Modal {
|
||||
private connect(element?: IConnectionProfile): void {
|
||||
this.logService.debug('ConnectionDialogWidget: Connect button is clicked');
|
||||
if (this._connectButton.enabled) {
|
||||
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.ConnectionDialog, TelemetryKeys.TelemetryAction.ConnectToServer).withAdditionalProperties(
|
||||
{ [TelemetryKeys.TelemetryPropertyName.ConnectionSource]: this._connectionSource }
|
||||
).send();
|
||||
this._connecting = true;
|
||||
this._connectButton.enabled = false;
|
||||
this._providerTypeSelectBox.disable();
|
||||
@@ -385,6 +396,7 @@ export class ConnectionDialogWidget extends Modal {
|
||||
const leftClick = (element: any, eventish: ICancelableEvent, origin: string) => {
|
||||
// element will be a server group if the tree is clicked rather than a item
|
||||
const isDoubleClick = origin === 'mouse' && (eventish as MouseEvent).detail === 2;
|
||||
this._connectionSource = 'recent';
|
||||
this.onConnectionClick(element, isDoubleClick);
|
||||
};
|
||||
const actionProvider = this.instantiationService.createInstance(RecentConnectionActionsProvider);
|
||||
@@ -405,11 +417,13 @@ export class ConnectionDialogWidget extends Modal {
|
||||
if (this._recentConnectionTree instanceof AsyncServerTree) {
|
||||
this._recentConnectionTree.onMouseClick(e => {
|
||||
if (e.element instanceof ConnectionProfile) {
|
||||
this._connectionSource = 'recent';
|
||||
this.onConnectionClick(e.element, false);
|
||||
}
|
||||
});
|
||||
this._recentConnectionTree.onMouseDblClick(e => {
|
||||
if (e.element instanceof ConnectionProfile) {
|
||||
this._connectionSource = 'recent';
|
||||
this.onConnectionClick(e.element, true);
|
||||
}
|
||||
});
|
||||
@@ -477,6 +491,7 @@ export class ConnectionDialogWidget extends Modal {
|
||||
* @param recentConnections Are there recent connections that should be shown
|
||||
*/
|
||||
public async open(recentConnections: boolean): Promise<void> {
|
||||
this._connectionSource = 'manual';
|
||||
this._panel.showTab(this._recentConnectionTabId);
|
||||
|
||||
this.show();
|
||||
|
||||
Reference in New Issue
Block a user