Skip to content

Commit

Permalink
Feature usage updates
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Dec 19, 2017
1 parent dfcf482 commit f66083e
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 17 deletions.
5 changes: 3 additions & 2 deletions src/common/appInsights/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import {Environment,EnvironmentType} from "@microsoft/sp-core-library";

AppInsights.downloadAndSetup({ instrumentationKey: "9f59b81e-d2ed-411e-a961-8bcf3f7f04d0" });

export function track(componentName: string): void {
export function track(componentName: string, properties: any = {}): void {
AppInsights.trackEvent(componentName, {
version,
debug: DEBUG ? "true" : "false",
environment: EnvironmentType[Environment.type]
environment: EnvironmentType[Environment.type],
...properties
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export default class PropertyFieldButtonHost extends React.Component<IPropertyFi
constructor(props: IPropertyFieldButtonWithCalloutHostProps) {
super(props);

appInsights.track('PropertyFieldButton');
appInsights.track('PropertyFieldButton', {
disabled: props.disabled
});
}

public render(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export default class PropertyFieldCheckboxHost extends React.Component<IProperty
constructor(props: IPropertyFieldCheckboxWithCalloutHostProps) {
super(props);

appInsights.track('PropertyFieldCheckbox');
appInsights.track('PropertyFieldCheckbox', {
disabled: props.disabled
});
}

public render(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export default class PropertyFieldToggleWithCalloutHost extends React.Component<
constructor(props: IPropertyFieldChoiceGroupWithCalloutHostProps) {
super(props);

appInsights.track('PropertyFieldToggleWithCallout');
appInsights.track('PropertyFieldToggleWithCallout', {
disabled: props.disabled
});
}

public render(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export default class PropertyFieldColorPickerHost extends React.Component<IPrope
constructor(props: IPropertyFieldColorPickerHostProps, state: IPropertyFieldColorPickerHostState) {
super(props);

appInsights.track('PropertyFieldColorPicker');
appInsights.track('PropertyFieldColorPicker', {
disabled: props.disabled
});

this.state = {
errorMessage: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ export default class PropertyFieldDateTimePickerHost extends React.Component<IPr
constructor(props: IPropertyFieldDateTimePickerHostProps) {
super(props);

appInsights.track('PropertyFieldDateTimePicker');
appInsights.track('PropertyFieldDateTimePicker', {
dateConvention: props.dateConvention ? DateConvention[props.dateConvention] : '',
formatDate: !!props.formatDate,
timeConvention: props.timeConvention ? TimeConvention[props.timeConvention] : '',
disabled: props.disabled
});

// Bind the current object to the external called onSelectDate method
this._onSelectDate = this._onSelectDate.bind(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export default class PropertyFieldDropdownHost extends React.Component<IProperty
constructor(props: IPropertyFieldDropdownWithCalloutHostProps) {
super(props);

appInsights.track('PropertyFieldDropdown');
appInsights.track('PropertyFieldDropdown', {
disabled: props.disabled
});
}

public render(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export default class PropertyFieldLabelHost extends React.Component<IPropertyFie
constructor(props: IPropertyFieldLabelWithCalloutHostProps) {
super(props);

appInsights.track('PropertyFieldLabel');
appInsights.track('PropertyFieldLabel', {
disabled: props.disabled
});
}

public render(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export default class PropertyFieldLinkHost extends React.Component<IPropertyFiel
constructor(props: IPropertyFieldLinkWithCalloutHostProps) {
super(props);

appInsights.track('PropertyFieldLink');
appInsights.track('PropertyFieldLink', {
disabled: props.disabled
});
}

public render(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export default class PropertyFieldListMultiPickerHost extends React.Component<IP
constructor(props: IPropertyFieldListMultiPickerHostProps) {
super(props);

appInsights.track('PropertyFieldListMultiPicker');
appInsights.track('PropertyFieldListMultiPicker', {
disabled: props.disabled
});

this.onChanged = this.onChanged.bind(this);
this.state = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export default class PropertyFieldListPickerHost extends React.Component<IProper
constructor(props: IPropertyFieldListPickerHostProps) {
super(props);

appInsights.track('PropertyFieldListPicker');
appInsights.track('PropertyFieldListPicker', {
disabled: props.disabled
});

this.state = {
results: this.options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export default class PropertyFieldPeoplePickerHost extends React.Component<IProp

appInsights.track('PropertyFieldPeoplePicker');

appInsights.track('PropertyFieldPeoplePicker', {
allowDuplicate: props.allowDuplicate,
principalType: props.principalType ? props.principalType.toString() : '',
disabled: props.disabled
});

this.searchService = new SPPeopleSearchService(props.context);
this.onSearchFieldChanged = this.onSearchFieldChanged.bind(this);
this.onItemChanged = this.onItemChanged.bind(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export default class PropertyFieldSliderWithCalloutHost extends React.Component<
constructor(props: IPropertyFieldSliderWithCalloutHostProps) {
super(props);

appInsights.track('PropertyFieldSliderWithCallout');
appInsights.track('PropertyFieldSliderWithCallout', {
disabled: props.disabled
});
}

public render(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export default class PropertyFieldSpinButtonHost extends React.Component<IProper
constructor(props: IPropertyFieldSpinButtonHostProps, state: IPropertyFieldSpinButtonHostState) {
super(props);

appInsights.track('PropertyFieldSpinButton');
appInsights.track('PropertyFieldSpinButton', {
disabled: props.disabled
});

this.state = {
errorMessage: undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ export default class PropertyFieldTermPickerHost extends React.Component<IProper
constructor(props: IPropertyFieldTermPickerHostProps) {
super(props);

appInsights.track('PropertyFieldTermPicker');
appInsights.track('PropertyFieldTermPicker', {
allowMultipleSelections: props.allowMultipleSelections,
excludeSystemGroup: props.excludeSystemGroup,
limitByTermsetNameOrID: !!props.limitByTermsetNameOrID,
limitByGroupNameOrID: !!props.limitByGroupNameOrID,
disabled: props.disabled
});

this.state = {
activeNodes: typeof this.props.initialValues !== 'undefined' ? this.props.initialValues : [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export default class PropertyFieldTextWithCalloutHost extends React.Component<IP
constructor(props: IPropertyFieldTextWithCalloutHostProps) {
super(props);

appInsights.track('PropertyFieldTextWithCallout');
appInsights.track('PropertyFieldTextWithCallout', {
disabled: props.disabled
});
}

public render(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export default class PropertyFieldToggleWithCalloutHost extends React.Component<
constructor(props: IPropertyFieldToggleWithCalloutHostProps) {
super(props);

appInsights.track('PropertyFieldToggleWithCallout');
appInsights.track('PropertyFieldToggleWithCallout', {
disabled: props.disabled
});
}

public render(): JSX.Element {
Expand Down

0 comments on commit f66083e

Please sign in to comment.