Skip to content

Commit

Permalink
Merge pull request #44 from keesschollaart81/develop
Browse files Browse the repository at this point in the history
v5.2
  • Loading branch information
keesschollaart81 authored Feb 23, 2021
2 parents 7ebfaab + 72ed0d2 commit 6c5432a
Show file tree
Hide file tree
Showing 10 changed files with 1,983 additions and 3,378 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build_extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: AzD Extension

on: [ push ]

jobs:
vscode-extension:
name: AzD Extension
runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v1

- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: NPM Install & Compile
run: |
npm install
npm run build
npm install -g tfx-cli
- name: Create [dev] Extension
if: github.ref == 'refs/heads/develop'
run: |
tfx extension create --output-path sprint-goal.vsix
- name: Create [prd] Extension
if: github.ref == 'refs/heads/master'
run: |
tfx extension create --output-path sprint-goal.vsix --extension-id sprint-goal --override '{ "name": "Sprint Goal" }'
- name: Publish Extension
env:
AZD_TOKEN: ${{ secrets.AZD_TOKEN }}
run: |
tfx extension publish --vsix sprint-goal.vsix --service-url https://marketplace.visualstudio.com --token $AZD_TOKEN
5 changes: 5 additions & 0 deletions Marketplace.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ After setting the goal, the goal will be shown in the tab-label on every page wi

## Release notes

### Version 5.2 - 23-02-2021

- Updated all dependencies / security patches
- Fix for dark theme

### Version 5.0 - 29-07-2019

- Rich Text field for detailed goal description
Expand Down
5,205 changes: 1,878 additions & 3,327 deletions package-lock.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
},
"author": "Case Online",
"devDependencies": {
"@types/q": "0.0.32",
"@types/applicationinsights-js": "1.0.9",
"@types/tinycolor": "1.1.27",
"ncp": "2.0.0",
"cpx": "1.5.0",
"rimraf": "2.6.2",
"tfx-cli": "0.6.4",
"typescript": "3.0.3",
"webpack": "^4.26.1",
"webpack-cli": "^3.1.2",
"copy-webpack-plugin": "4.6.0"
"ncp": "2.0.0",
"rimraf": "3.0.2",
"typescript": "4.1.5",
"webpack": "^5.24.0",
"webpack-cli": "^4.5.0",
"tfx-cli": "0.8.3",
"copy-webpack-plugin": "7.0.0"
},
"dependencies": {
"@microsoft/applicationinsights-web": "2.5.11",
"applicationinsights-js": "1.0.20",
"jscolor-picker": "2.0.4",
"moment": "2.23.0",
"moment-timezone": "0.5.23",
"roosterjs": "^7.4.1",
"tinycolor2": "1.4.1",
"moment": "2.29.1",
"moment-timezone": "0.5.33",
"roosterjs": "^8.0.1",
"tinycolor2": "1.4.2",
"vanilla-emoji-picker": "^0.2.4",
"vss-web-extension-sdk": "5.140.0"
"vss-web-extension-sdk": "5.141.0"
}
}
59 changes: 33 additions & 26 deletions script/SprintGoalApplicationInsightsWrapper.ts
Original file line number Diff line number Diff line change
@@ -1,71 +1,78 @@
import { ExtensionDataService } from "VSS/SDK/Services/ExtensionData";
import { ApplicationInsights } from '@microsoft/applicationinsights-web'


export class SprintGoalApplicationInsightsWrapper {
private webContext: WebContext;
private context: IExtensionContext;
private isLoaded: boolean;
private telemetryOptOut?: boolean;
private appInsights: ApplicationInsights;

constructor() {
this.isLoaded = false;
}

private load = async () : Promise<void> => {
private load = async (): Promise<void> => {
this.isLoaded = true;

this.context = VSS.getExtensionContext();
this.webContext = VSS.getWebContext();
var dataService: IExtensionDataService = await VSS.getService<IExtensionDataService>(VSS.ServiceIds.ExtensionData);
try{
try {
this.telemetryOptOut = await dataService.getValue<boolean>("telemetryOptOut");
}
catch(error){
catch (error) {
this.telemetryOptOut = false;
}
if (!this.telemetryOptOut){
var appInsights = window["appInsights"] || function (a: any) {
function b(a) { c[a] = function () { var b = arguments; c.queue.push(function () { c[a].apply(c, b) }) } } var c: any = { config: a }, d = document, e = window; setTimeout(function () { var b = d.createElement("script"); b.src = a.url || "https://az416426.vo.msecnd.net/scripts/a/ai.0.js", d.getElementsByTagName("script")[0].parentNode.appendChild(b) }); try { c.cookie = d.cookie } catch (a) { } c.queue = []; for (var f: any = ["Event", "Exception", "Metric", "PageView", "Trace", "Dependency"]; f.length;)b("track" + f.pop()); if (b("setAuthenticatedUserContext"), b("clearAuthenticatedUserContext"), b("startTrackEvent"), b("stopTrackEvent"), b("startTrackPage"), b("stopTrackPage"), b("flush"), !a.disableExceptionTracking) { f = "onerror", b("_" + f); var g = e[f]; e[f] = function (a, b, d, e, h) { var i = g && g(a, b, d, e, h); return !0 !== i && c["_" + f](a, b, d, e, h), i } } return c
}({
instrumentationKey: "4a71e7ad-d598-40c2-930b-2d571f6f149f"
if (!this.telemetryOptOut) {
this.appInsights = new ApplicationInsights({
config: {
instrumentationKey: '4a71e7ad-d598-40c2-930b-2d571f6f149f'
}
});

window["appInsights"] = appInsights, appInsights.queue && 0 === appInsights.queue.length && appInsights.trackPageView();

window["appInsights"].setAuthenticatedUserContext(
this.appInsights.loadAppInsights();
this.appInsights.setAuthenticatedUserContext(
this.webContext.user.id,
this.webContext.collection.id);
}
}

public trackPageView = async (title: string) : Promise<void> => {
public trackPageView = async (title: string): Promise<void> => {
if (!this.isLoaded) await this.load();
if (this.telemetryOptOut) return;

window["appInsights"].trackPageView(
title,
window.location.pathname,
this.getDefaultProps()
);
this.appInsights.trackPageView({
name: title,
uri: window.location.pathname,
properties: this.getDefaultProps()
});
}

public trackEvent = async (name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) : Promise<void> => {
public trackEvent = async (name: string, properties?: { [name: string]: string; }): Promise<void> => {
if (!this.isLoaded) await this.load();
if (this.telemetryOptOut) return;

var joinedProps = { ...this.getDefaultProps(), ...properties};

window["appInsights"].trackEvent(name, joinedProps, measurements)
var joinedProps = { ...this.getDefaultProps(), ...properties };

this.appInsights.trackEvent({
name: name,
properties: joinedProps
});
}

public trackException = async (exception: Error) : Promise<void> => {
public trackException = async (exception: Error): Promise<void> => {
if (!this.isLoaded) await this.load();
if (this.telemetryOptOut) return;

window["appInsights"].trackException(exception, "unhandled", this.getDefaultProps());
this.appInsights.trackException({
exception: exception,
properties: this.getDefaultProps()
});
}

private getDefaultProps = () =>{
return {
private getDefaultProps = () => {
return {
accountName: this.webContext.account.name,
accountId: this.webContext.account.id,
extensionId: this.context.extensionId,
Expand Down
8 changes: 3 additions & 5 deletions script/sprint-goal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Q = require("q");
import * as RoosterJs from 'roosterjs';
import Controls = require("VSS/Controls");
import Menus = require("VSS/Controls/Menus");
Expand All @@ -7,14 +6,13 @@ import EmojiPicker = require("vanilla-emoji-picker");
import { ExtensionDataService } from "VSS/SDK/Services/ExtensionData";
import { SprintGoalApplicationInsightsWrapper } from "./SprintGoalApplicationInsightsWrapper";
import { Helpers } from "./helpers"
import { RunningDocumentsTable } from "VSS/Events/Document";

export class SprintGoal {
private iterationId: string;
private teamId: string;
private storageUri: HTMLAnchorElement;
private waitControl: StatusIndicator.WaitControl;
private editor: RoosterJs.Editor;
private editor: RoosterJs.IEditor;
private helpers: Helpers;

constructor(private ai: SprintGoalApplicationInsightsWrapper) {
Expand Down Expand Up @@ -205,14 +203,14 @@ export class SprintGoal {
sprintGoalInTabLabel: $("#sprintGoalInTabLabelCheckbox").prop("checked"),
goal: $("#goalInput").val(),
details: this.editor.getContent(),
detailsPlain: this.editor.getTextContent(),
detailsPlain: this.editor.getContent(RoosterJs.GetContentMode.PlainText),
goalAchieved: $("#achievedCheckbox").prop("checked")
};

if (this.ai) {
await this.ai.trackEvent("SaveSettings", <any>{
sprintGoalInTabLabel: sprintConfig.sprintGoalInTabLabel,
detailsUsed: `${this.editor.getTextContent()}`.length > 10
detailsUsed: `${this.editor.getContent(RoosterJs.GetContentMode.PlainText)}`.length > 10
});
}

Expand Down
8 changes: 7 additions & 1 deletion static/sprint-goal.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
width: 100%;
}

#vss-extension #detailsText div {
color: var(--text-primary-color) !important;
}

#vss-extension select {
height: 33px;
}
Expand All @@ -99,6 +103,7 @@
text-align: center;
border-radius: 4px;
display: none;
color: black;
}

.footer {
Expand Down Expand Up @@ -189,7 +194,8 @@

</div>

<p class="footer">Experiencing problems with the 'Sprint Goal' extension for Azure DevOps? Or do you have an idea to make 'Sprint Goal' better? Please share this with the developer of 'Sprint Goal' via
<p class="footer">Experiencing problems with the 'Sprint Goal' extension for Azure DevOps? Or do you have an
idea to make 'Sprint Goal' better? Please share this with the developer of 'Sprint Goal' via
<a href="https://twitter.com/keesschollaart" target="_blank">Twitter</a> or by
<a href="mailto:[email protected]">mail</a>
</div>
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"moduleResolution": "node",
"target": "es5",
"outDir": "dist/js",
"skipLibCheck": true,
"types": [
"vss-web-extension-sdk"
],
Expand Down
2 changes: 1 addition & 1 deletion vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "sprint-goal-dev",
"name": "Sprint Goal Dev",
"version": "5.0.3",
"version": "5.2.3",
"publisher": "keesschollaart",
"public": false,
"helpMarkDown": "[More Information](https://github.com/keesschollaart81/vsts-sprint-goal)",
Expand Down
8 changes: 3 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ module.exports = {
/^VSS\/.*/, /^TFS\/.*/, /^q$/
],
plugins: [
new CopyWebpackPlugin([
new CopyWebpackPlugin({
patterns:[
{ from: "./node_modules/moment/min/moment.min.js", to: "moment.js" },
{ from: "./node_modules/jscolor-picker/jscolor.min.js", to: "jscolor.min.js" },
{ from: "./node_modules/vss-web-extension-sdk/lib/VSS.SDK.min.js", to: "VSS.SDK.js" },
{ from: './static', to: path.resolve(__dirname, 'dist', 'widget') }
])
]})
],
node: {
fs: 'empty'
},
resolve: {
extensions: ['.js', '.css', '.scss'],
alias: {
Expand Down

0 comments on commit 6c5432a

Please sign in to comment.