package com.gitblit.wicket.pages;\r
\r
import java.text.MessageFormat;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
import java.text.ParseException;\r
import java.text.SimpleDateFormat;\r
+import java.util.ArrayList;\r
import java.util.Date;\r
+import java.util.List;\r
\r
import org.apache.wicket.Component;\r
import org.apache.wicket.PageParameters;\r
// global, no readme on summary page\r
add(new Label("readme").setVisible(false));\r
}\r
- \r
- Charts charts = createCharts(metrics);\r
- add(new HeaderContributor(charts));\r
- \r
+\r
+ if (metrics == null || metrics.isEmpty()) {\r
+ add(new Label("commitsChart").setVisible(false));\r
+ } else {\r
+ Charts charts = createCharts(metrics);\r
+ add(new HeaderContributor(charts));\r
+ }\r
}\r
\r
@Override\r
protected String getPageName() {\r
return getString("gb.summary");\r
}\r
- \r
+\r
private Charts createCharts(List<Metric> metrics) {\r
- \r
+\r
Charts charts = new Flotr2Charts();\r
- \r
+\r
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");\r
String displayFormat = "MMM dd";\r
if(metrics.size() > 0 && metrics.get(0).name.length() == 7){\r
displayFormat = "yyyy MMM";\r
}\r
df.setTimeZone(getTimeZone());\r
- \r
+\r
// build google charts\r
Chart chart = charts.createLineChart("commitsChart", getString("gb.activity"), "day", getString("gb.commits"));\r
chart.setDateFormat(displayFormat);\r
- \r
+\r
for (Metric metric : metrics) {\r
Date date;\r
try {\r