Skip to content

Commit

Permalink
Merged PR 275: Added back Telemetrics to the React files.
Browse files Browse the repository at this point in the history
Added back Telemetrics to the React files.
  • Loading branch information
pkrk98 committed Jan 31, 2018
1 parent 856d5c0 commit 4b2ffc2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/KanbanDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as tc from "TelemetryClient";

import { initializeIcons } from "@uifabric/icons";

import { DialogView } from "src/Views/Dialog/Components/DialogView";
import "./KanbanDialog.scss";

import { Telemetry } from "src/TelemetryClientSettings";
import * as Constants from "src/Shared/Constants";

export class KanbanDialog {
private _onValidationUpdated: (isValid: boolean) => void;
private _onCancel: (refresh?: boolean) => void;
Expand All @@ -14,6 +18,7 @@ export class KanbanDialog {
public show() {
const configuration = VSS.getConfiguration();
const boardId = configuration.id;
Telemetry.Client().trackEvent(Constants.TelemetryDialogOpened);
this.kanbanDialogNode = document.getElementById("dialogContent");
ReactDOM.render(<DialogView id={boardId} onCanceled={this._onDialogCanceled} />, this.kanbanDialogNode);
}
Expand Down
7 changes: 6 additions & 1 deletion src/Shared/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ export const DoneButton: string = "Done";

export const CopySettingsMessage: string = "Applying settings";
export const CopySettingsSubtitle: string = "This will only take a moment";
export const AllDoneMessage: string = "All done";
export const AllDoneMessage: string = "All done";

export const TelemetryDialogOpened: string = "Dialog opened";
export const TelemetryCopyCompleted: string = "Copy Completed";
export const TelemetryDialogCancelled: string = "Dialog Cancelled";
export const TelemetryAdvancedMapping: string = "Advanced mapping selected";
8 changes: 7 additions & 1 deletion src/TelemetryClientSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ import * as tc from "TelemetryClient";
export const telemetrySettings: tc.TelemetryClientSettings = {
key: "__INSTRUMENTATIONKEY__",
extensioncontext: "ImportExportKanban"
};
};

export class Telemetry {
public static Client(): any {
return tc.TelemetryClient.getClient(telemetrySettings);
}
}
3 changes: 3 additions & 0 deletions src/Views/CopySettings/Components/CopySettingsView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from "react";
import * as TC from "TelemetryClient";

import { CopySettingsActionsCreator } from "src/Views/CopySettings/Actions/CopySettingsActionsCreator";
import { DialogActionsCreator } from "src/Views/Dialog/Actions/DialogActionsCreator";
Expand All @@ -12,6 +13,7 @@ import { SelectTeam } from "src/Views/CopySettings/Components/SelectTeam";
import * as Constants from "src/Shared/Constants";
import { ServicesClient } from "src/Shared/ServicesClient";
import { PrimaryButton } from "office-ui-fabric-react/lib/Button";
import { Telemetry } from "src/TelemetryClientSettings";

export interface ICopySettingsViewProps {
sharedActions: DialogActionsCreator;
Expand Down Expand Up @@ -115,6 +117,7 @@ export class CopySettingsView extends React.Component<ICopySettingsViewProps, Co
}

private _onOpenAdvancedMappings = () => {
Telemetry.Client().trackEvent(Constants.TelemetryAdvancedMapping);
this._copySettingsActionsCreator.enabledAdvancedMappings(true);
}

Expand Down
5 changes: 5 additions & 0 deletions src/Views/Dialog/Components/DialogButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import * as React from "react";
import * as TC from "TelemetryClient";

import { PrimaryButton, DefaultButton } from "office-ui-fabric-react/lib/Button";
import { css } from "office-ui-fabric-react/lib/Utilities";
import * as Constants from "src/Shared/Constants";
import { Telemetry } from "src/TelemetryClientSettings";

export interface IDialogButtonsProps {
enabled: boolean;
Expand Down Expand Up @@ -32,10 +35,12 @@ export class DialogButtons extends React.Component<IDialogButtonsProps, {}> {
}

private _onPrimaryButtonClicked = () => {
Telemetry.Client().trackEvent(Constants.TelemetryCopyCompleted);
this.props.okButtonClicked();
}

private _onCancelButtonClicked = () => {
Telemetry.Client().trackEvent(Constants.TelemetryDialogCancelled);
this.props.cancelButtonClicked();
}
}

0 comments on commit 4b2ffc2

Please sign in to comment.