| | |
| | | import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
| | | import org.eclipse.jgit.lib.Repository;
|
| | |
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.Metric;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.wicket.CacheControl;
|
| | | import com.gitblit.wicket.CacheControl.LastModified;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.charting.GoogleChart;
|
| | | import com.gitblit.wicket.charting.GoogleCharts;
|
| | | import com.gitblit.wicket.charting.GoogleLineChart;
|
| | | import com.gitblit.wicket.charting.Chart;
|
| | | import com.gitblit.wicket.charting.Charts;
|
| | | import com.gitblit.wicket.charting.Flotr2Charts;
|
| | | import com.gitblit.wicket.panels.BranchesPanel;
|
| | | import com.gitblit.wicket.panels.LinkPanel;
|
| | | import com.gitblit.wicket.panels.ReflogPanel;
|
| | | import com.gitblit.wicket.panels.RepositoryUrlPanel;
|
| | | import com.gitblit.wicket.panels.TagsPanel;
|
| | |
|
| | | @CacheControl(LastModified.REPOSITORY)
|
| | | public class OverviewPage extends RepositoryPage {
|
| | |
|
| | | public OverviewPage(PageParameters params) {
|
| | | super(params);
|
| | |
|
| | | int numberRefs = GitBlit.getInteger(Keys.web.summaryRefsCount, 5);
|
| | | int numberRefs = app().settings().getInteger(Keys.web.summaryRefsCount, 5);
|
| | |
|
| | | Repository r = getRepository();
|
| | | final RepositoryModel model = getRepositoryModel();
|
| | |
| | |
|
| | | List<Metric> metrics = null;
|
| | | Metric metricsTotal = null;
|
| | | if (!model.skipSummaryMetrics && GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
|
| | | metrics = GitBlit.self().getRepositoryDefaultMetrics(model, r);
|
| | | if (!model.skipSummaryMetrics && app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {
|
| | | metrics = app().repositories().getRepositoryDefaultMetrics(model, r);
|
| | | metricsTotal = metrics.remove(0);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | // repository description
|
| | | add(new Label("repositoryDescription", getRepositoryModel().description));
|
| | | |
| | |
|
| | | // owner links
|
| | | final List<String> owners = new ArrayList<String>(getRepositoryModel().owners);
|
| | | ListDataProvider<String> ownersDp = new ListDataProvider<String>(owners);
|
| | | DataView<String> ownersView = new DataView<String>("repositoryOwners", ownersDp) {
|
| | | private static final long serialVersionUID = 1L;
|
| | | int counter = 0;
|
| | | @Override
|
| | | public void populateItem(final Item<String> item) {
|
| | | String ownername = item.getModelObject();
|
| | | UserModel ownerModel = GitBlit.self().getUserModel(ownername);
|
| | | UserModel ownerModel = app().users().getUserModel(ownername);
|
| | | if (ownerModel != null) {
|
| | | item.add(new LinkPanel("owner", null, ownerModel.getDisplayName(), UserPage.class,
|
| | | WicketUtils.newUsernameParameter(ownerModel.username)).setRenderBodyOnly(true));
|
| | |
| | | };
|
| | | ownersView.setRenderBodyOnly(true);
|
| | | add(ownersView);
|
| | | |
| | |
|
| | | add(WicketUtils.createTimestampLabel("repositoryLastChange",
|
| | | JGitUtils.getLastChange(r), getTimeZone(), getTimeUtils()));
|
| | | JGitUtils.getLastChange(r).when, getTimeZone(), getTimeUtils()));
|
| | | add(new Label("repositorySize", model.size));
|
| | | |
| | |
|
| | | if (metricsTotal == null) {
|
| | | add(new Label("branchStats", ""));
|
| | | } else {
|
| | |
| | |
|
| | | add(new RepositoryUrlPanel("repositoryUrlPanel", false, user, model));
|
| | |
|
| | | int reflogCount = GitBlit.getInteger(Keys.web.overviewReflogCount, 5);
|
| | | int reflogCount = app().settings().getInteger(Keys.web.overviewReflogCount, 5);
|
| | | ReflogPanel reflog = new ReflogPanel("reflogPanel", getRepositoryModel(), r, reflogCount, 0);
|
| | | add(reflog);
|
| | | add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs).hideIfEmpty());
|
| | |
| | |
|
| | | private void insertActivityGraph(List<Metric> metrics) {
|
| | | if ((metrics != null) && (metrics.size() > 0)
|
| | | && GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
|
| | | && app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {
|
| | |
|
| | | Charts charts = new Flotr2Charts();
|
| | |
|
| | | // daily line chart
|
| | | GoogleChart chart = new GoogleLineChart("chartDaily", "", "unit",
|
| | | Chart chart = charts.createLineChart("chartDaily", "", "unit",
|
| | | getString("gb.commits"));
|
| | | for (Metric metric : metrics) {
|
| | | chart.addValue(metric.name, metric.count);
|
| | | }
|
| | | chart.setWidth(375);
|
| | | chart.setHeight(150);
|
| | | |
| | | GoogleCharts charts = new GoogleCharts();
|
| | |
|
| | | charts.addChart(chart);
|
| | | add(new HeaderContributor(charts));
|
| | | }
|