forked from sierpinski/Blitz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblitzallpullswidget.html
61 lines (59 loc) · 3.03 KB
/
blitzallpullswidget.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<html>
<head>
<script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Custom Styles for this Extension-->
<link rel="stylesheet" type="text/css" href="styles/blitzallpullswidget.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="sdk/scripts/VSS.SDK.js"></script>
<!-- AppInsights -->
<script src="scripts/appinsightsblitz.js"></script>
</head>
<body>
<div class="widget clickable" style="background-color: rgb(0, 155, 204);">
<a href="#" target="_parent" style="color: white !important;">
<h2 class="title" style="color: white !important;">Active</h2>
<div class="big-count" style="color: white !important;"></div>
<div style=" color: white !important;">Pull Requests</div>
</a>
</div>
<script>
// Sets up the initial handshake with the host frame
VSS.init({
// Our extension will explicitly notify the host when we're done loading
explicitNotifyLoaded: true,
// We are using some Team Services APIs, so we will need the module loader to load them in
usePlatformScripts: true,
usePlatformStyles: true
});
// Load Team Services controls
// Load VSTS controls and REST client
VSS.require(["VSS/Controls", "VSS/Controls/Grids","VSS/Controls/Dialogs",
"VSS/Service", "TFS/VersionControl/GitRestClient", "TFS/Dashboards/WidgetHelpers"],
function (Controls, Grids, Dialogs, VSS_Service, Git_Client, WidgetHelpers) {
var gitClient = VSS_Service.getCollectionClient(Git_Client.GitHttpClient);
var currentContext = VSS.getWebContext();
var projCurr = currentContext.project.name;
var uri = currentContext.host.uri + "/" + projCurr + "/_apps/hub/sierpinski.blitz-allpulls-extension.BlitzActivePulls";
WidgetHelpers.IncludeWidgetStyles();
VSS.register("BlitzActivePullsWidget", function () {
return {
load: function (widgetSettings) {
gitClient.getPullRequestsByProject(projCurr).then(function(pullRequests)
{
$(".big-count").html(pullRequests.length);
$("a").attr("href", uri)
}).catch(console.log.bind(console));
return WidgetHelpers.WidgetStatusHelper.Success();
}
}
});
VSS.notifyLoadSucceeded();
});
</script>
</body>
</html>