Pārlūkot izejas kodu

Add stats header to the dashboard activity feed

tags/v1.3.0
James Moger pirms 11 gadiem
vecāks
revīzija
255d3a3cf9

+ 1
- 0
src/main/java/com/gitblit/wicket/pages/DashboardPage.html Parādīt failu

@@ -11,6 +11,7 @@
<div class="row">
<div class="span7">
<div style="color:#888;font-size:1.75em;padding-bottom:5px;" wicket:id="feedheader"></div>
<div class="hidden-phone hidden-tablet" style="text-align:center;">
<table>
<tr>

+ 12
- 5
src/main/java/com/gitblit/wicket/pages/DashboardPage.java Parādīt failu

@@ -201,8 +201,9 @@ public class DashboardPage extends RootPage {
}
}
GoogleCharts charts = createCharts(pushes, authorExclusions);
add(new HeaderContributor(charts));
addCharts(pushes, authorExclusions, daysBack);
} else {
add(new Label("feedheader").setVisible(false));
}
// active repository list
@@ -371,14 +372,16 @@ public class DashboardPage extends RootPage {
* and the active authors pie chart
*
* @param recentPushes
* @return
* @param authorExclusions
* @param daysBack
*/
private GoogleCharts createCharts(List<PushLogEntry> recentPushes, Set<String> authorExclusions) {
private void addCharts(List<PushLogEntry> recentPushes, Set<String> authorExclusions, int daysBack) {
// activity metrics
Map<String, Metric> repositoryMetrics = new HashMap<String, Metric>();
Map<String, Metric> authorMetrics = new HashMap<String, Metric>();
// aggregate repository and author metrics
int totalCommits = 0;
for (PushLogEntry push : recentPushes) {
// aggregate repository metrics
@@ -389,6 +392,7 @@ public class DashboardPage extends RootPage {
repositoryMetrics.get(repository).count += 1;
for (RepositoryCommit commit : push.getCommits()) {
totalCommits++;
String author = StringUtils.removeNewlines(commit.getAuthorIdent().getName());
String authorName = author.toLowerCase();
String authorEmail = StringUtils.removeNewlines(commit.getAuthorIdent().getEmailAddress()).toLowerCase();
@@ -400,6 +404,9 @@ public class DashboardPage extends RootPage {
}
}
}
add(new Label("feedheader", MessageFormat.format(getString("gb.recentActivityStats"),
daysBack, totalCommits, authorMetrics.size())));
// build google charts
GoogleCharts charts = new GoogleCharts();
@@ -422,7 +429,7 @@ public class DashboardPage extends RootPage {
chart.setShowLegend(false);
charts.addChart(chart);
return charts;
add(new HeaderContributor(charts));
}
class RepoListItem implements Serializable {

Notiek ielāde…
Atcelt
Saglabāt