| | |
| | | import org.apache.wicket.PageParameters;
|
| | | import org.apache.wicket.behavior.HeaderContributor;
|
| | | import org.apache.wicket.markup.html.basic.Label;
|
| | | import org.apache.wicket.markup.html.panel.Fragment;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | |
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.utils.ActivityUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.CacheControl;
|
| | | import com.gitblit.wicket.CacheControl.LastModified;
|
| | | import com.gitblit.wicket.PageRegistration;
|
| | | import com.gitblit.wicket.PageRegistration.DropDownMenuItem;
|
| | | import com.gitblit.wicket.PageRegistration.DropDownMenuRegistration;
|
| | |
| | | /**
|
| | | * Activity Page shows a list of recent commits across all visible Gitblit
|
| | | * repositories.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | |
|
| | | @CacheControl(LastModified.ACTIVITY)
|
| | | public class ActivityPage extends RootPage {
|
| | |
|
| | | public ActivityPage(PageParameters params) {
|
| | |
| | | // parameters
|
| | | int daysBack = WicketUtils.getDaysBack(params);
|
| | | if (daysBack < 1) {
|
| | | daysBack = 14;
|
| | | daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);
|
| | | }
|
| | | String objectId = WicketUtils.getObject(params);
|
| | |
|
| | | // determine repositories to view and retrieve the activity
|
| | | List<RepositoryModel> models = getRepositories(params);
|
| | | List<Activity> recentActivity = ActivityUtils.getRecentActivity(models, |
| | | 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("chartsPanel").setVisible(false));
|
| | | add(new Label("activityPanel"));
|
| | | } else {
|
| | | // calculate total commits and total authors
|
| | |
| | | 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
|
| | | GoogleCharts charts = createCharts(recentActivity);
|
| | | add(new HeaderContributor(charts));
|
| | | if (GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
|
| | | GoogleCharts charts = createCharts(recentActivity);
|
| | | add(new HeaderContributor(charts));
|
| | | add(new Fragment("chartsPanel", "chartsFragment", this));
|
| | | } else {
|
| | | add(new Label("chartsPanel").setVisible(false));
|
| | | }
|
| | |
|
| | | // add activity panel
|
| | | add(new ActivityPanel("activityPanel", recentActivity));
|
| | |
| | | /**
|
| | | * Creates the daily activity line chart, the active repositories pie chart,
|
| | | * and the active authors pie chart
|
| | | * |
| | | *
|
| | | * @param recentActivity
|
| | | * @return
|
| | | */
|