summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/wicket/panels
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/gitblit/wicket/panels')
-rw-r--r--src/com/gitblit/wicket/panels/BranchesPanel.java6
-rw-r--r--src/com/gitblit/wicket/panels/LogPanel.java46
-rw-r--r--src/com/gitblit/wicket/panels/TagsPanel.java12
3 files changed, 35 insertions, 29 deletions
diff --git a/src/com/gitblit/wicket/panels/BranchesPanel.java b/src/com/gitblit/wicket/panels/BranchesPanel.java
index dd4596da..d060b147 100644
--- a/src/com/gitblit/wicket/panels/BranchesPanel.java
+++ b/src/com/gitblit/wicket/panels/BranchesPanel.java
@@ -61,14 +61,14 @@ public class BranchesPanel extends Panel {
item.add(WicketUtils.createDateLabel("branchDate", entry.getDate(), GitBlitWebSession.get().getTimezone()));
- item.add(new LinkPanel("branchName", "list name", WicketUtils.trimString(entry.getDisplayName(), 28), LogPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
+ item.add(new LinkPanel("branchName", "list name", WicketUtils.trimString(entry.getDisplayName(), 28), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
// only show branch type on the branches page
boolean remote = entry.getName().startsWith(Constants.R_REMOTES);
item.add(new Label("branchType", remote ? getString("gb.remote"):getString("gb.local")).setVisible(maxCount <= 0));
- item.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
- item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
diff --git a/src/com/gitblit/wicket/panels/LogPanel.java b/src/com/gitblit/wicket/panels/LogPanel.java
index 630be610..077ebb91 100644
--- a/src/com/gitblit/wicket/panels/LogPanel.java
+++ b/src/com/gitblit/wicket/panels/LogPanel.java
@@ -4,9 +4,9 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
+import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
@@ -31,17 +31,26 @@ public class LogPanel extends Panel {
private static final long serialVersionUID = 1L;
- public LogPanel(String wicketId, final String repositoryName, Repository r, int maxCount, boolean showPager) {
+ public LogPanel(String wicketId, final String repositoryName, String objectId, Repository r, int limit, int pageOffset) {
super(wicketId);
-
+ boolean pageResults = limit <= 0;
+ setOutputMarkupId(pageResults);
+
final Map<ObjectId, List<String>> allRefs = JGitUtils.getAllRefs(r);
- List<RevCommit> commits = JGitUtils.getRevLog(r, maxCount);
+ List<RevCommit> commits;
+ if (pageResults) {
+ // Paging result set
+ commits = JGitUtils.getRevLog(r, objectId, pageOffset*GitBlitWebApp.PAGING_ITEM_COUNT, GitBlitWebApp.PAGING_ITEM_COUNT);
+ } else {
+ // Fixed size result set
+ commits = JGitUtils.getRevLog(r, objectId, 0, limit);
+ }
// header
- if (showPager) {
+ if (pageResults) {
// shortlog page
// show repository summary page link
- add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
+ add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
} else {
// summary page
// show shortlog page link
@@ -64,7 +73,7 @@ public class LogPanel extends Panel {
String shortMessage = entry.getShortMessage();
String trimmedMessage = WicketUtils.trimShortLog(shortMessage);
- LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName()));
+ LinkPanel shortlog = new LinkPanel("commitShortMessage", "list subject", trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName()));
if (!shortMessage.equals(trimmedMessage)) {
WicketUtils.setHtmlTitle(shortlog, shortMessage);
}
@@ -72,32 +81,29 @@ public class LogPanel extends Panel {
item.add(new RefsPanel("commitRefs", entry, allRefs));
- item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
- item.add(new BookmarkablePageLink<Void>("diff", DiffPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
- item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("diff", DiffPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
- add(logView);
+ add(logView);
// determine to show pager, more, or neither
- if (maxCount <= 0) {
+ if (limit <= 0) {
// no display limit
add(new Label("moreLogs", "").setVisible(false));
add(new Label("pageLogs", "").setVisible(false));
- } else {
- if (commits.size() == maxCount) {
-
- }
- if (showPager) {
+ } else {
+ if (pageResults) {
// paging
add(new Label("moreLogs", "").setVisible(false));
- if (commits.size() == maxCount) {
+ if (commits.size() == limit) {
// show pager
logView.setItemsPerPage(GitBlitWebApp.PAGING_ITEM_COUNT);
- add(new PagingNavigator("pageLogs", logView));
+ add(new AjaxPagingNavigator("pageLogs", logView));
} else {
// nothing to page
add(new Label("pageLogs", "").setVisible(false));
@@ -105,7 +111,7 @@ public class LogPanel extends Panel {
} else {
// more
add(new Label("pageLogs", "").setVisible(false));
- if (commits.size() == maxCount) {
+ if (commits.size() == limit) {
// show more
add(new LinkPanel("moreLogs", "link", new StringResourceModel("gb.moreLogs", this, null), LogPage.class, WicketUtils.newRepositoryParameter(repositoryName)));
} else {
diff --git a/src/com/gitblit/wicket/panels/TagsPanel.java b/src/com/gitblit/wicket/panels/TagsPanel.java
index 92307b41..454f9b2a 100644
--- a/src/com/gitblit/wicket/panels/TagsPanel.java
+++ b/src/com/gitblit/wicket/panels/TagsPanel.java
@@ -51,7 +51,7 @@ public class TagsPanel extends Panel {
item.add(WicketUtils.createDateLabel("tagDate", entry.getDate(), GitBlitWebSession.get().getTimezone()));
- item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getCommitId().getName())));
+ item.add(new LinkPanel("tagName", "list name", entry.getDisplayName(), CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getCommitId().getName())));
String message;
if (maxCount > 0) {
message = WicketUtils.trimString(entry.getShortLog(), 40);
@@ -59,13 +59,13 @@ public class TagsPanel extends Panel {
message = entry.getShortLog();
}
if (entry.isAnnotatedTag()) {
- item.add(new LinkPanel("tagDescription", "list subject", message, TagPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getObjectId().getName())));
+ item.add(new LinkPanel("tagDescription", "list subject", message, TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getObjectId().getName())));
} else {
- item.add(new LinkPanel("tagDescription", "list subject", message, CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getObjectId().getName())));
+ item.add(new LinkPanel("tagDescription", "list subject", message, CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getObjectId().getName())));
}
- item.add(new BookmarkablePageLink<Void>("view", TagPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getObjectId().getName())).setEnabled(entry.isAnnotatedTag()));
- item.add(new BookmarkablePageLink<Void>("commit", CommitPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getCommitId().getName())));
- item.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newCommitParameter(repositoryName, entry.getName())));
+ item.add(new BookmarkablePageLink<Void>("view", TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getObjectId().getName())).setEnabled(entry.isAnnotatedTag()));
+ item.add(new BookmarkablePageLink<Void>("commit", CommitPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getCommitId().getName())));
+ item.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry.getName())));
WicketUtils.setAlternatingBackground(item, counter);
counter++;