diff options
author | James Moger <james.moger@gitblit.com> | 2013-05-02 21:37:58 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-05-02 21:37:58 -0400 |
commit | 264ba908941414ea5e750524b2472f7ad0670563 (patch) | |
tree | 4476371a9478a9f78661c1b89ccef4ada11aaadd /src/main/java/com/gitblit/wicket/pages/SummaryPage.java | |
parent | 19352c18bd27ea61b9466110c1be874079f60b63 (diff) | |
download | gitblit-264ba908941414ea5e750524b2472f7ad0670563.tar.gz gitblit-264ba908941414ea5e750524b2472f7ad0670563.zip |
Improved the repository url panel and show git daemon url, appropriately
This will probably be refined some more to merge the http/https and git urls
into a single url panel.
Diffstat (limited to 'src/main/java/com/gitblit/wicket/pages/SummaryPage.java')
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/SummaryPage.java | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/SummaryPage.java b/src/main/java/com/gitblit/wicket/pages/SummaryPage.java index d68add0f..863974b3 100644 --- a/src/main/java/com/gitblit/wicket/pages/SummaryPage.java +++ b/src/main/java/com/gitblit/wicket/pages/SummaryPage.java @@ -42,6 +42,7 @@ import org.wicketstuff.googlecharts.LineStyle; import org.wicketstuff.googlecharts.MarkerType;
import org.wicketstuff.googlecharts.ShapeMarker;
+import com.gitblit.Constants.AccessPermission;
import com.gitblit.Constants.AccessRestrictionType;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
@@ -56,9 +57,9 @@ import com.gitblit.utils.StringUtils; import com.gitblit.wicket.GitBlitWebSession;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.panels.BranchesPanel;
+import com.gitblit.wicket.panels.DetailedRepositoryUrlPanel;
import com.gitblit.wicket.panels.LinkPanel;
import com.gitblit.wicket.panels.LogPanel;
-import com.gitblit.wicket.panels.RepositoryUrlPanel;
import com.gitblit.wicket.panels.TagsPanel;
public class SummaryPage extends RepositoryPage {
@@ -73,8 +74,11 @@ public class SummaryPage extends RepositoryPage { int numberRefs = GitBlit.getInteger(Keys.web.summaryRefsCount, 5);
Repository r = getRepository();
- RepositoryModel model = getRepositoryModel();
+ final RepositoryModel model = getRepositoryModel();
UserModel user = GitBlitWebSession.get().getUser();
+ if (user == null) {
+ user = UserModel.ANONYMOUS;
+ }
List<Metric> metrics = null;
Metric metricsTotal = null;
@@ -124,7 +128,9 @@ public class SummaryPage extends RepositoryPage { List<String> repositoryUrls = new ArrayList<String>();
- if (GitBlit.getBoolean(Keys.git.enableGitServlet, true)) {
+ AccessPermission accessPermission = null;
+ if (GitBlit.getBoolean(Keys.git.enableGitServlet, true)) {
+ accessPermission = user.getRepositoryPermission(model).permission;
AccessRestrictionType accessRestriction = getRepositoryModel().accessRestriction;
switch (accessRestriction) {
case NONE:
@@ -150,13 +156,27 @@ public class SummaryPage extends RepositoryPage { } else {
add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));
}
- repositoryUrls.addAll(GitBlit.self().getOtherCloneUrls(repositoryName, user == null ? "" : user.username));
+ repositoryUrls.addAll(GitBlit.self().getOtherCloneUrls(repositoryName, UserModel.ANONYMOUS.equals(user) ? "" : user.username));
String primaryUrl = ArrayUtils.isEmpty(repositoryUrls) ? "" : repositoryUrls.remove(0);
- add(new RepositoryUrlPanel("repositoryCloneUrl", primaryUrl));
+ add(new DetailedRepositoryUrlPanel("repositoryPrimaryUrl", getLocalizer(), this, model.name, primaryUrl, accessPermission));
+
+ Component gitDaemonUrlPanel = createGitDaemonUrlPanel("repositoryGitDaemonUrl", user, model);
+ if (!StringUtils.isEmpty(primaryUrl) && gitDaemonUrlPanel instanceof DetailedRepositoryUrlPanel) {
+ WicketUtils.setCssStyle(gitDaemonUrlPanel, "padding-top: 10px");
+ }
+ add(gitDaemonUrlPanel);
+
+ ListDataProvider<String> urls = new ListDataProvider<String>(repositoryUrls);
+ DataView<String> otherUrlsView = new DataView<String>("otherUrls", urls) {
+ private static final long serialVersionUID = 1L;
- add(new Label("otherUrls", StringUtils.flattenStrings(repositoryUrls, "<br/>"))
- .setEscapeModelStrings(false));
+ public void populateItem(final Item<String> item) {
+ final String url = item.getModelObject();
+ item.add(new DetailedRepositoryUrlPanel("otherUrl", getLocalizer(), this, model.name, url));
+ }
+ };
+ add(otherUrlsView);
add(new LogPanel("commitsPanel", repositoryName, getRepositoryModel().HEAD, r, numberCommits, 0, getRepositoryModel().showRemoteBranches));
add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs).hideIfEmpty());
|