diff --git a/README.md b/README.md
index 9982b03..4d0aa51 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,8 @@ Options :
* *org* : an array of Github organizations,
* *apiUrl* : url of your Github API (optional, default is `https://api.github.com`),
* *descendingOrder* : allow to change ordering of pull requests (optional, default is `true`).
+ * *labels* : display labels of pull requests (optional, default is `false`).
+ * *milestones* : display milestones of pull requests (optional, default is `false`).
* *token* : authorization token for API calls (optional, it can allow access to more repos and increase API rate limit) NB: if a token is set, OAuth will be ignored for the team
* *oauthAppClientId* : clientId of the OAuth app the team depends on (optional)
* **githubOAuth** : OAuth config (optional)
diff --git a/app/scripts/controllers/main.js b/app/scripts/controllers/main.js
index 99f666b..721dc0c 100644
--- a/app/scripts/controllers/main.js
+++ b/app/scripts/controllers/main.js
@@ -22,6 +22,18 @@ angular.module('gtrApp')
$scope.descendingOrder = true;
}
+ if (typeof(config.teams[team].labels) !== 'undefined') {
+ $scope.labels = config.teams[team].labels;
+ } else {
+ $scope.labels = false;
+ }
+
+ if (typeof(config.teams[team].milestones) !== 'undefined') {
+ $scope.milestones = config.teams[team].milestones;
+ } else {
+ $scope.milestones = false;
+ }
+
var statePriorities = {
'error': 4,
'failure': 3,
diff --git a/app/scripts/services/pullFetcher.js b/app/scripts/services/pullFetcher.js
index 4506ee4..fbcd83a 100644
--- a/app/scripts/services/pullFetcher.js
+++ b/app/scripts/services/pullFetcher.js
@@ -71,10 +71,26 @@ angular.module('gtrApp')
});
};
+ var addLabelsToPull = function (pull) {
+ return request(pull.issue_url + '/labels').then(function (response) {
+ pull.labels = response.data;
+ });
+ };
+
+ var removeMilestoneToPull = function (pull) {
+ pull.milestone = null;
+ };
+
var getRepoPulls = function (repo) {
return request(repo.pulls_url.replace('{/number}', ''))
.then(function (response) {
var filtered = response.data.filter(filterPulls);
+ if (currentTeam.labels) {
+ filtered.map(addLabelsToPull);
+ }
+ if (!currentTeam.milestones) {
+ filtered.map(removeMilestoneToPull);
+ }
return $q.all(filtered.map(addStatusToPull)).then(function() {
return filtered;
diff --git a/app/styles/main.css b/app/styles/main.css
index 98e0e4d..b598f3f 100644
--- a/app/styles/main.css
+++ b/app/styles/main.css
@@ -170,3 +170,19 @@ ul {
.pr-counter {
margin-right: 10px;
}
+
+.badge {
+ padding: 4px 8px;
+ border-radius: 4px;
+ font-size: 0.875em;
+ color: black;
+}
+
+.badge-label {
+ margin-left: 4px;
+}
+
+.badge-milestone {
+ background-color: white;
+ margin-right: 4px;
+}
diff --git a/app/views/main.html b/app/views/main.html
index a9663b9..5c0d423 100644
--- a/app/views/main.html
+++ b/app/views/main.html
@@ -19,8 +19,13 @@
-
- #{{ pr.number }} {{ pr.title }}
+
+
+ #{{ pr.number }} {{ pr.title }}
+ {{ label.name }}
+
+ {{ pr.milestone.title }}
{{ pr.head.repo.full_name }}
{{pr.updated_at | date:"dd/MM/yyyy"}}
diff --git a/config/config.json.dist b/config/config.json.dist
index 843ea65..8eed299 100644
--- a/config/config.json.dist
+++ b/config/config.json.dist
@@ -7,7 +7,9 @@
"projects": ["repo1", "repo2"],
"orgs": ["orgname1", "orgname2"],
"token": "apiToken",
- "descendingOrder": true
+ "descendingOrder": true,
+ "labels": true,
+ "milestones": true
},
"teamWithOAuth": {
"members": ["username4", "username2", "username5"],
diff --git a/config/config_test.json b/config/config_test.json
index b51f356..3c04c9a 100644
--- a/config/config_test.json
+++ b/config/config_test.json
@@ -23,13 +23,15 @@
"burton": {
"members": ["papy", "worker"],
"orgs": ["m6web"],
- "apiUrl": "/api/v3"
+ "apiUrl": "/api/v3",
+ "labels": true
},
"service-polls": {
"descendingOrder": false,
"projects": ["service-polls"],
"orgs": ["m6web", "replay"],
- "apiUrl": "/api/v3"
+ "apiUrl": "/api/v3",
+ "milestones": true
}
}
}
diff --git a/test/e2e/main.js b/test/e2e/main.js
index a1551b1..75cf9bd 100644
--- a/test/e2e/main.js
+++ b/test/e2e/main.js
@@ -79,6 +79,7 @@ describe('Test GTR screen', function () {
backend.whenGET('/api/v3/repos/m6web/service-polls/pulls').respond([{
'id': 6467,
'html_url': 'http://example.com/m6web/service-polls/pull/54',
+ 'issue_url': '/api/v3/repos/m6web/service-polls/issues/54',
'number': 54,
'title': 'PR 54',
'state': 'open',
@@ -97,11 +98,13 @@ describe('Test GTR screen', function () {
'full_name': 'm6web/service-polls',
'name': 'service-polls'
}
- }
+ },
+ 'milestone': null
},
{
'id': 6468,
'html_url': 'http://example.com/m6web/service-polls/pull/55',
+ 'issue_url': '/api/v3/repos/m6web/service-polls/issues/55',
'number': 55,
'title': 'PR 55',
'state': 'open',
@@ -120,11 +123,15 @@ describe('Test GTR screen', function () {
'full_name': 'm6web/service-polls',
'name': 'service-polls'
}
+ },
+ 'milestone': {
+ 'title': 'release-1.1.0'
}
},
{
'id': 6469,
'html_url': 'http://example.com/m6web/service-polls/pull/56',
+ 'issue_url': '/api/v3/repos/m6web/service-polls/issues/56',
'number': 56,
'title': 'PR 56',
'state': 'open',
@@ -143,11 +150,15 @@ describe('Test GTR screen', function () {
'full_name': 'm6web/service-polls',
'name': 'service-polls'
}
+ },
+ 'milestone': {
+ 'title': 'release-1.0.0'
}
}]);
backend.whenGET('/api/v3/repos/replay/bundle-polls-client/pulls').respond([{
'id': 5895,
'html_url': 'http://example.com/replay/bundle-polls-client/pull/49',
+ 'issue_url': '/api/v3/repos/replay/bundle-polls-client/issues/49',
'number': 49,
'title': 'PR 49',
'state': 'open',
@@ -166,11 +177,13 @@ describe('Test GTR screen', function () {
'full_name': 'replay/bundle-polls-client',
'name': 'bundle-polls-client'
}
- }
+ },
+ 'milestone': null
},
{
'id': 5896,
'html_url': 'http://example.com/replay/bundle-polls-client/pull/50',
+ 'issue_url': '/api/v3/repos/replay/bundle-polls-client/issues/50',
'number': 50,
'title': 'PR 50',
'state': 'open',
@@ -189,7 +202,8 @@ describe('Test GTR screen', function () {
'full_name': 'replay/bundle-polls-client',
'name': 'bundle-polls-client'
}
- }
+ },
+ 'milestone': null
}]);
//Statuses
@@ -220,6 +234,14 @@ describe('Test GTR screen', function () {
'state': 'success'
}]);
+ // Labels
+ backend.whenGET('/api/v3/repos/m6web/service-polls/issues/55/labels').respond([
+ {
+ 'name': 'need_review',
+ 'color': 'b60205'
+ }
+ ]);
+
// Others
backend.whenGET(/.*/).passThrough();
});
@@ -288,7 +310,7 @@ describe('Test GTR screen', function () {
expect(pulls).toEqual([{
index: 0,
- text: '#55 PR 55\nm6web/service-polls 28/08/2014',
+ text: '#55 PR 55 need_review\nm6web/service-polls 28/08/2014',
class: '',
avatar: 'http://example.com/papy.jpg',
pullUrl: 'http://example.com/m6web/service-polls/pull/55'
@@ -310,14 +332,14 @@ describe('Test GTR screen', function () {
},
{
index: 1,
- text: '#55 PR 55\nm6web/service-polls 28/08/2014',
+ text: '#55 PR 55\nrelease-1.1.0 m6web/service-polls 28/08/2014',
class: '',
avatar: 'http://example.com/papy.jpg',
pullUrl: 'http://example.com/m6web/service-polls/pull/55'
},
{
index: 2,
- text: '#56 PR 56\nm6web/service-polls 28/10/2014',
+ text: '#56 PR 56\nrelease-1.0.0 m6web/service-polls 28/10/2014',
class: 'success',
avatar: 'http://example.com/bieber.jpg',
pullUrl: 'http://example.com/m6web/service-polls/pull/56'