| | |
| | |
|
| | | import com.gitblit.models.Metric;
|
| | | import com.gitblit.utils.MetricUtils;
|
| | | import com.gitblit.utils.TimeUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | |
|
| | | public class MetricsPage extends RepositoryPage {
|
| | |
| | | public MetricsPage(PageParameters params) {
|
| | | super(params);
|
| | | Repository r = getRepository();
|
| | | add(new Label("branchTitle", objectId));
|
| | | if (StringUtils.isEmpty(objectId)) {
|
| | | add(new Label("branchTitle", getRepositoryModel().HEAD));
|
| | | } else {
|
| | | add(new Label("branchTitle", objectId));
|
| | | }
|
| | | Metric metricsTotal = null;
|
| | | List<Metric> metrics = MetricUtils.getDateMetrics(r, objectId, true, null);
|
| | | List<Metric> metrics = MetricUtils.getDateMetrics(r, objectId, true, null, getTimeZone());
|
| | | metricsTotal = metrics.remove(0);
|
| | | if (metricsTotal == null) {
|
| | | add(new Label("branchStats", ""));
|
| | | } else {
|
| | | add(new Label("branchStats",
|
| | | MessageFormat.format("{0} commits and {1} tags in {2}", metricsTotal.count,
|
| | | metricsTotal.tag, TimeUtils.duration(metricsTotal.duration))));
|
| | | MessageFormat.format(getString("gb.branchStats"), metricsTotal.count,
|
| | | metricsTotal.tag, getTimeUtils().duration(metricsTotal.duration))));
|
| | | }
|
| | | insertLinePlot("commitsChart", metrics);
|
| | | insertBarPlot("dayOfWeekChart", getDayOfWeekMetrics(r, objectId));
|
| | |
| | | }
|
| | |
|
| | | private List<Metric> getDayOfWeekMetrics(Repository repository, String objectId) {
|
| | | List<Metric> list = MetricUtils.getDateMetrics(repository, objectId, false, "E");
|
| | | List<Metric> list = MetricUtils.getDateMetrics(repository, objectId, false, "E", getTimeZone());
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("E");
|
| | | Calendar cal = Calendar.getInstance();
|
| | |
|