From e9de3f7fd55dd4d4535cd7b2fc2bee8094152e39 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sat, 17 Mar 2012 12:09:01 -0400
Subject: [PATCH] Implemented RPC administration of indexed branches
---
src/com/gitblit/wicket/panels/BranchesPanel.java | 35 ++++++++++++++++++++---------------
1 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/src/com/gitblit/wicket/panels/BranchesPanel.java b/src/com/gitblit/wicket/panels/BranchesPanel.java
index 8e58d67..5886209 100644
--- a/src/com/gitblit/wicket/panels/BranchesPanel.java
+++ b/src/com/gitblit/wicket/panels/BranchesPanel.java
@@ -29,19 +29,21 @@
import org.apache.wicket.model.StringResourceModel;
import org.eclipse.jgit.lib.Repository;
+import com.gitblit.Constants;
import com.gitblit.SyndicationServlet;
import com.gitblit.models.RefModel;
import com.gitblit.models.RepositoryModel;
import com.gitblit.utils.JGitUtils;
-import com.gitblit.utils.JGitUtils.SearchType;
import com.gitblit.utils.StringUtils;
+import com.gitblit.wicket.GitBlitWebApp;
+import com.gitblit.wicket.GitBlitWebSession;
import com.gitblit.wicket.WicketUtils;
+import com.gitblit.wicket.pages.BasePage;
import com.gitblit.wicket.pages.BranchesPage;
import com.gitblit.wicket.pages.CommitPage;
import com.gitblit.wicket.pages.LogPage;
import com.gitblit.wicket.pages.MetricsPage;
import com.gitblit.wicket.pages.SearchPage;
-import com.gitblit.wicket.pages.SummaryPage;
import com.gitblit.wicket.pages.TreePage;
public class BranchesPanel extends BasePanel {
@@ -73,10 +75,11 @@
null), BranchesPage.class, WicketUtils.newRepositoryParameter(model.name)));
} else {
// branches page
- // show repository summary page link
- add(new LinkPanel("branches", "title", model.name, SummaryPage.class,
- WicketUtils.newRepositoryParameter(model.name)));
+ add(new Label("branches", new StringResourceModel("gb.branches", this, null)));
}
+
+ GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();
+ final Class<? extends BasePage> searchPageClass = app.getSearchPageClass();
ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);
DataView<RefModel> branchesView = new DataView<RefModel>("branch", branchesDp) {
@@ -94,22 +97,22 @@
String author = entry.getAuthorIdent().getName();
LinkPanel authorLink = new LinkPanel("branchAuthor", "list", author,
- SearchPage.class, WicketUtils.newSearchParameter(model.name, entry.getName(),
- author, SearchType.AUTHOR));
- setPersonSearchTooltip(authorLink, author, SearchType.AUTHOR);
+ searchPageClass, WicketUtils.newSearchParameter(model.name,
+ entry.getName(), author, Constants.SearchType.AUTHOR));
+ setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);
item.add(authorLink);
-
+
// short message
String shortMessage = entry.getShortMessage();
- String trimmedMessage = StringUtils.trimShortLog(shortMessage);
- LinkPanel shortlog = new LinkPanel("branchLog", "list subject",
- trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
- model.name, entry.getName()));
+ String trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
+ LinkPanel shortlog = new LinkPanel("branchLog", "list subject", trimmedMessage,
+ CommitPage.class, WicketUtils.newObjectParameter(model.name,
+ entry.getName()));
if (!shortMessage.equals(trimmedMessage)) {
WicketUtils.setHtmlTooltip(shortlog, shortMessage);
}
item.add(shortlog);
-
+
if (maxCount <= 0) {
Fragment fragment = new Fragment("branchLinks", "branchPageLinks", this);
fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils
@@ -142,7 +145,9 @@
this, null), BranchesPage.class, WicketUtils.newRepositoryParameter(model.name)));
}
// We always have 1 branch
- hasBranches = branches.size() > 1;
+ hasBranches = (branches.size() > 1)
+ || ((branches.size() == 1) && !branches.get(0).displayName
+ .equalsIgnoreCase("master"));
}
public BranchesPanel hideIfEmpty() {
--
Gitblit v1.9.1