| | |
| | | // parameters
|
| | | int daysBack = WicketUtils.getDaysBack(params);
|
| | | if (daysBack < 1) {
|
| | | daysBack = 14;
|
| | | daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);
|
| | | }
|
| | | String objectId = WicketUtils.getObject(params);
|
| | |
|
| | |
| | | List<Activity> recentActivity = ActivityUtils.getRecentActivity(models,
|
| | | daysBack, objectId, getTimeZone());
|
| | |
|
| | | String headerPattern;
|
| | | if (daysBack == 1) {
|
| | | // today
|
| | | if (recentActivity.size() == 0) {
|
| | | headerPattern = getString("gb.todaysActivityNone");
|
| | | } else {
|
| | | headerPattern = getString("gb.todaysActivityStats");
|
| | | }
|
| | | } else {
|
| | | // multiple days
|
| | | if (recentActivity.size() == 0) {
|
| | | headerPattern = getString("gb.recentActivityNone");
|
| | | } else {
|
| | | headerPattern = getString("gb.recentActivityStats");
|
| | | }
|
| | | }
|
| | | |
| | | if (recentActivity.size() == 0) {
|
| | | // no activity, skip graphs and activity panel
|
| | | add(new Label("subheader", MessageFormat.format(getString("gb.recentActivityNone"),
|
| | | add(new Label("subheader", MessageFormat.format(headerPattern,
|
| | | daysBack)));
|
| | | add(new Label("activityPanel"));
|
| | | } else {
|
| | |
| | | int totalAuthors = uniqueAuthors.size();
|
| | |
|
| | | // add the subheader with stat numbers
|
| | | add(new Label("subheader", MessageFormat.format(getString("gb.recentActivityStats"),
|
| | | add(new Label("subheader", MessageFormat.format(headerPattern,
|
| | | daysBack, totalCommits, totalAuthors)));
|
| | |
|
| | | // create the activity charts
|
| | |
| | | ActivityPage.class);
|
| | |
|
| | | PageParameters currentParameters = getPageParameters();
|
| | | int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 14);
|
| | | int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);
|
| | | if (currentParameters != null && !currentParameters.containsKey("db")) {
|
| | | currentParameters.put("db", daysBack);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | // build google charts
|
| | | int w = 310;
|
| | | int h = 150;
|
| | | GoogleCharts charts = new GoogleCharts();
|
| | |
|
| | | // sort in reverse-chronological order and then reverse that
|
| | |
| | | for (Activity metric : recentActivity) {
|
| | | chart.addValue(df.format(metric.startDate), metric.getCommitCount());
|
| | | }
|
| | | chart.setWidth(w);
|
| | | chart.setHeight(h);
|
| | | charts.addChart(chart);
|
| | |
|
| | | // active repositories pie chart
|
| | |
| | | for (Metric metric : repositoryMetrics.values()) {
|
| | | chart.addValue(metric.name, metric.count);
|
| | | }
|
| | | chart.setWidth(w);
|
| | | chart.setHeight(h);
|
| | | chart.setShowLegend(false);
|
| | | charts.addChart(chart);
|
| | |
|
| | | // active authors pie chart
|
| | |
| | | for (Metric metric : authorMetrics.values()) {
|
| | | chart.addValue(metric.name, metric.count);
|
| | | }
|
| | | chart.setWidth(w);
|
| | | chart.setHeight(h);
|
| | | chart.setShowLegend(false);
|
| | | charts.addChart(chart);
|
| | |
|
| | | return charts;
|