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 @@