Skip to content

Commit e13be08

Browse files
committed
Telemetry update
1 parent 70de8d9 commit e13be08

File tree

12 files changed

+78
-3
lines changed

12 files changed

+78
-3
lines changed

.circleci/config.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,23 @@ jobs:
2626
- persist_to_workspace:
2727
root: .
2828
paths: .
29+
build_next:
30+
<<: *defaults
31+
steps:
32+
- attach_workspace:
33+
at: ~/sp-dev-fx-controls-react
34+
- run:
35+
name: Stamp beta to package version
36+
command: node scripts/update-package-version.js $CIRCLE_SHA1
37+
- run:
38+
name: Update version number for telemetry
39+
command: npm run versionUpdater
40+
- run:
41+
name: build
42+
command: npm run build
43+
- persist_to_workspace:
44+
root: .
45+
paths: .
2946
test:
3047
<<: *defaults
3148
steps:
@@ -113,12 +130,18 @@ workflows:
113130
filters:
114131
branches:
115132
only: dev
116-
- test:
133+
- build_next:
117134
requires:
118135
- build
119136
filters:
120137
branches:
121138
only: dev
139+
- test:
140+
requires:
141+
- build_next
142+
filters:
143+
branches:
144+
only: dev
122145
- publish_next:
123146
requires:
124147
- test

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Releases
22

3+
## 1.1.0
4+
5+
- Telemetry added
6+
37
## 1.0.0
48
- **New control**: WebPartTilte control got added.
59
- **Enhancement**: ListView control got extended with the ability to specify a set of preselected items.

docs/documentation/docs/about/release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Releases
22

3+
## 1.1.0
4+
5+
- Telemetry added
6+
37
## 1.0.0
48
- **New control**: WebPartTilte control got added.
59
- **Enhancement**: ListView control got extended with the ability to specify a set of preselected items.

gulpfile.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
const gulp = require('gulp');
44
const build = require('@microsoft/sp-build-web');
5+
const fs = require('fs');
6+
7+
// Update the version number in the version.ts file
8+
gulp.task('versionUpdater', (done) => {
9+
const pkgContents = require('./package.json');
10+
const filePath = './src/common/appInsights/version.ts';
11+
const fileContents = `export const version: string = "{versionPlaceholder}";`;
12+
const newContents = fileContents.replace("{versionPlaceholder}", pkgContents.version);
13+
console.log(`Updating version number to: ${pkgContents.version}`);
14+
fs.writeFileSync(filePath, newContents, { encoding: "utf8" });
15+
done();
16+
});
517

618
build.initialize(gulp);
719

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@pnp/spfx-controls-react",
33
"description": "Reusable React controls for SharePoint Framework solutions",
4-
"version": "1.0.0",
4+
"version": "1.1.0",
55
"engines": {
66
"node": ">=0.10.0"
77
},
@@ -10,9 +10,12 @@
1010
"clean": "gulp clean",
1111
"test": "gulp test",
1212
"prepublishOnly": "gulp",
13+
"versionUpdater": "gulp versionUpdater",
1314
"karma": "karma start --circle true"
1415
},
15-
"dependencies": {},
16+
"dependencies": {
17+
"applicationinsights-js": "1.0.14"
18+
},
1619
"devDependencies": {
1720
"@microsoft/sp-build-web": "~1.3.0",
1821
"@microsoft/sp-core-library": "~1.3.0",

src/common/appInsights/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { AppInsights } from "applicationinsights-js";
2+
import { version } from './version';
3+
import {Environment,EnvironmentType} from "@microsoft/sp-core-library";
4+
5+
AppInsights.downloadAndSetup({ instrumentationKey: "9f59b81e-d2ed-411e-a961-8bcf3f7f04d0" });
6+
7+
export function track(componentName: string): void {
8+
AppInsights.trackEvent(componentName, {
9+
version,
10+
debug: DEBUG ? "true" : "false",
11+
environment: EnvironmentType[Environment.type]
12+
});
13+
}

src/common/appInsights/version.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const version: string = "1.1.0";

src/controls/fileTypeIcon/FileTypeIcon.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import { findIndex } from '@microsoft/sp-lodash-subset';
33
import { IFileTypeIconProps, ApplicationType, ApplicationIconList, IconType, IconSizes, ImageSize, IImageResult, ICON_GENERIC_16, ICON_GENERIC_48, ICON_GENERIC_96 } from './IFileTypeIcon';
4+
import * as appInsights from '../../common/appInsights';
45

56
const ICON_GENERIC = 'Page';
67
const ICON_DEFAULT_SIZE = 'icon16';
@@ -11,6 +12,8 @@ const ICON_DEFAULT_SIZE = 'icon16';
1112
export class FileTypeIcon extends React.Component<IFileTypeIconProps, {}> {
1213
constructor(props: IFileTypeIconProps) {
1314
super(props);
15+
16+
appInsights.track('ReactFileTypeIcon');
1417
}
1518

1619
/**

src/controls/listView/ListView.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { findIndex, has, sortBy, isEqual, cloneDeep } from '@microsoft/sp-lodash
66
import { FileTypeIcon, IconType } from '../fileTypeIcon/index';
77
import * as strings from 'ControlStrings';
88
import { IGroupsItems } from './IListView';
9+
import * as appInsights from '../../common/appInsights';
910

1011
/**
1112
* File type icon component
@@ -16,6 +17,8 @@ export class ListView extends React.Component<IListViewProps, IListViewState> {
1617
constructor(props: IListViewProps) {
1718
super(props);
1819

20+
appInsights.track('ReactListView');
21+
1922
// Initialize state
2023
this.state = {
2124
items: []

src/controls/placeholder/PlaceholderComponent.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22
import { IPlaceholderProps } from './IPlaceholderComponent';
33
import { PrimaryButton } from 'office-ui-fabric-react/lib/Button';
44
import styles from './PlaceholderComponent.module.scss';
5+
import * as appInsights from '../../common/appInsights';
56

67
/**
78
* Placeholder component
@@ -13,6 +14,8 @@ export class Placeholder extends React.Component<IPlaceholderProps, {}> {
1314
constructor(props: IPlaceholderProps) {
1415
super(props);
1516

17+
appInsights.track('ReactPlaceholder');
18+
1619
this._handleBtnClick = this._handleBtnClick.bind(this);
1720
}
1821

0 commit comments

Comments
 (0)