Skip to content

The Unified and Autonomous Development Platform

midwork

robin shine5ac4e84cbc9e
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java
index c0e32d6232..8404513f2c 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/Repository.java
@@ -953,6 +953,13 @@ public class Repository extends AbstractEntity implements UserBelonging {
listener.onRefUpdate(this, refName, null);
}
+ public void deleteTag(String tag) {
+ String refName = GitUtils.branch2ref(tag);
+ git().deleteRef(refName);
+ for (RefListener listener: GitPlex.getExtensions(RefListener.class))
+ listener.onRefUpdate(this, refName, null);
+ }
+
private static class DiffKey implements Serializable {
String oldRev;
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/security/SecurityUtils.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/security/SecurityUtils.java
index dda895817b..26e919f880 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/security/SecurityUtils.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/security/SecurityUtils.java
@@ -6,6 +6,7 @@ import java.util.Set;
import org.eclipse.jgit.lib.Constants;
+import com.pmease.commons.git.GitUtils;
import com.pmease.commons.hibernate.dao.Dao;
import com.pmease.commons.hibernate.dao.EntityCriteria;
import com.pmease.gitplex.core.GitPlex;
@@ -77,16 +78,16 @@ public class SecurityUtils extends org.apache.shiro.SecurityUtils {
}
public static boolean canModify(RepoAndBranch repoAndBranch) {
- return canModify(repoAndBranch.getRepository(), repoAndBranch.getBranch());
+ return canModify(repoAndBranch.getRepository(), GitUtils.branch2ref(repoAndBranch.getBranch()));
}
- public static boolean canModify(Repository repository, String branch) {
+ public static boolean canModify(Repository repository, String refName) {
User currentUser = GitPlex.getInstance(UserManager.class).getCurrent();
return currentUser != null
&& currentUser.asSubject().isPermitted(ObjectPermission.ofRepoPush(repository))
- && repository.getGateKeeper().checkRef(currentUser, repository, Constants.R_HEADS + branch).isPassed();
+ && repository.getGateKeeper().checkRef(currentUser, repository, refName).isPassed();
}
-
+
public static boolean canManage(User account) {
User currentUser = GitPlex.getInstance(UserManager.class).getCurrent();
if (currentUser != null) {
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/RepoBranchesPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/RepoBranchesPage.html
index 001ef0e4e1..3f6bf19d28 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/RepoBranchesPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/RepoBranchesPage.html
@@ -1,61 +1,61 @@
-<html xmlns:wicket>
-<wicket:extend>
- <section id="repo-branch">
- <div class="body">
- <div class="options clearfix">
- <div class="pull-left base">
- <div class="input-group">
- <span class="input-group-addon">Base</span> <input wicket:id="baseBranch" type="hidden" class="form-control select2-container"></input>
- </div>
- </div>
- <div class="pull-left search">
- <div class="input-group">
- <span class="input-group-addon"><i class="fa fa-search"></i></span>
- <input wicket:id="searchBranches" class="form-control" placeholder="Search branches"></input>
- </div>
- </div>
- <ul wicket:id="branchesPageNav" class="pull-right"></ul>
- </div>
- <table wicket:id="branchesContainer" class="table table-hover table-condensed">
- <tr wicket:id="branches">
- <td class="summary">
- <a wicket:id="branchLink"><span wicket:id="name"></span></a> <span class="label label-default" wicket:id="default">default</span>
- <div>Last updated <span wicket:id="lastUpdateTime"></span> by <span wicket:id="lastAuthor"></span></div>
- </td>
- <td class="behind behind-ahead">
- <div align="right">
- <div class="text">
- <a wicket:id="behindLink"><span wicket:id="count"></span> behind</a>
- </div>
- <div class="bar" wicket:id="behindBar"></div>
- </div>
- </td>
- <td class="ahead behind-ahead">
- <div>
- <div class="text">
- <a wicket:id="aheadLink"><span wicket:id="count"></span> ahead</a>
- </div>
- <div class="bar" wicket:id="aheadBar"></div>
- </div>
- </td>
- <td wicket:id="actions" class="actions">
- <button wicket:id="unwatchRequests" class="btn btn-default" title="You are watching pull requests of this branch, click to unwatch"><i class="fa fa-eye-slash"></i> Unwatch</button>
- <button wicket:id="watchRequests" class="btn btn-default" title="You are not watching pull requests of this branch, click to watch"><i class="fa fa-eye"></i> Watch</button>
- <a wicket:id="delete" class="fa fa-times fa-lg" title="Delete this branch"></a>
- </td>
- </tr>
- </table>
- <div class="help-block">
- <i class="fa fa-info-circle"></i> Yellow bars
- <span class="bar request">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
- represent ahead/behind commits with a pull request opening.
- </div>
- <div id="searching-branches" class="ajax-indicator">
- <wicket:link>
- <img src="ajax-indicator.gif"></img>
- </wicket:link>
- </div>
- </div>
- </section>
-</wicket:extend>
+<html xmlns:wicket>
+<wicket:extend>
+ <section id="repo-branches">
+ <div class="body">
+ <div class="options clearfix">
+ <div class="pull-left base">
+ <div class="input-group">
+ <span class="input-group-addon">Base</span> <input wicket:id="baseBranch" type="hidden" class="form-control select2-container"></input>
+ </div>
+ </div>
+ <div class="pull-left search">
+ <div class="input-group">
+ <span class="input-group-addon"><i class="fa fa-search"></i></span>
+ <input wicket:id="searchBranches" class="form-control" placeholder="Search branches"></input>
+ </div>
+ </div>
+ <ul wicket:id="branchesPageNav" class="pull-right"></ul>
+ </div>
+ <table wicket:id="branchesContainer" class="table table-hover table-condensed">
+ <tr wicket:id="branches">
+ <td class="summary">
+ <a wicket:id="branchLink"><span wicket:id="name"></span></a> <span class="label label-default" wicket:id="default">default</span>
+ <div>Last updated <span wicket:id="lastUpdateTime"></span> by <span wicket:id="lastAuthor"></span></div>
+ </td>
+ <td class="behind behind-ahead">
+ <div align="right">
+ <div class="text">
+ <a wicket:id="behindLink"><span wicket:id="count"></span> behind</a>
+ </div>
+ <div class="bar" wicket:id="behindBar"></div>
+ </div>
+ </td>
+ <td class="ahead behind-ahead">
+ <div>
+ <div class="text">
+ <a wicket:id="aheadLink"><span wicket:id="count"></span> ahead</a>
+ </div>
+ <div class="bar" wicket:id="aheadBar"></div>
+ </div>
+ </td>
+ <td wicket:id="actions" class="actions">
+ <button wicket:id="unwatchRequests" class="btn btn-default" title="You are watching pull requests of this branch, click to unwatch"><i class="fa fa-eye-slash"></i> Unwatch</button>
+ <button wicket:id="watchRequests" class="btn btn-default" title="You are not watching pull requests of this branch, click to watch"><i class="fa fa-eye"></i> Watch</button>
+ <a wicket:id="delete" class="fa fa-times fa-lg" title="Delete this branch"></a>
+ </td>
+ </tr>
+ </table>
+ <div class="help-block">
+ <i class="fa fa-info-circle"></i> Yellow bars
+ <span class="bar request">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
+ represent ahead/behind commits with a pull request opening.
+ </div>
+ <div id="searching-branches" class="ajax-indicator">
+ <wicket:link>
+ <img src="ajax-indicator.gif"></img>
+ </wicket:link>
+ </div>
+ </div>
+ </section>
+</wicket:extend>
</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/RepoBranchesPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/RepoBranchesPage.java
index 97272dbf4a..ec6cc1a79d 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/RepoBranchesPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/RepoBranchesPage.java
@@ -489,7 +489,7 @@ public class RepoBranchesPage extends RepositoryPage {
protected void onConfigure() {
super.onConfigure();
- if (!getRepository().getDefaultBranch().equals(branch) && SecurityUtils.canModify(getRepository(), branch)) {
+ if (!getRepository().getDefaultBranch().equals(branch) && SecurityUtils.canModify(new RepoAndBranch(getRepository(), branch))) {
User currentUser = getCurrentUser();
if (currentUser != null) {
GateKeeper gateKeeper = getRepository().getGateKeeper();
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/repo-branches.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/repo-branches.css
index 6c286a37b2..f54feb9638 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/repo-branches.css
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/branches/repo-branches.css
@@ -1,77 +1,77 @@
-#repo-branch {
- padding: 20px;
-}
-#repo-branch>.body>.options {
- margin-bottom: 16px;
-}
-#repo-branch>.body>.options>div {
- margin-right: 24px;
-}
-
-#repo-branch>.body>.options>div.base .input-group {
- width: 240px;
-}
-#repo-branch>.body>.options>div.search .input-group {
- width: 240px;
-}
-#repo-branch>.body>.options .pagination {
- margin: 0;
-}
-#repo-branch>.body>table td {
- white-space: nowrap;
-}
-#repo-branch>.body>table td.summary, #repo-branch>.body>table td.actions {
- width: 1%;
-}
-#repo-branch>.body>table td.actions .fa.fa-times {
- color: red; margin-left: 8px;
-}
-#repo-branch>.body>table td.actions span.fa.fa-times {
- color: #888;
-}
-#repo-branch>.body>table td.behind {
- padding-right: 0;
-}
-#repo-branch>.body>table td.ahead {
- padding-left: 0;
-}
-#repo-branch>.body>table td.behind>div {
- border-right: 1px solid #333;
-}
-#repo-branch>.body>table td.behind-ahead div.text {
- margin: 0 4px;
-}
-#repo-branch>.body>table .bar {
- height: 12px;
-}
-#repo-branch>.body>table .ahead .bar {
- background: #666;
-}
-#repo-branch>.body>table .ahead .bar.request {
- background: #F1D763;
-}
-#repo-branch>.body>table .behind .bar {
- background: #ccc;
-}
-#repo-branch>.body>table .behind .bar.request {
- background: #F1D763;
-}
-#repo-branch>.body>.help-block .bar.request {
- background: #F1D763;
- font-size: 10px;
-}
-#repo-branch>.body>table td.summary>div,
-#repo-branch>.body>table td.summary>div .name a {
- font-size: 13px;
- color: #666;
-}
-#repo-branch>.body>table td.summary>div {
- margin-top: 4px;
-}
-#searching-branches {
- position: absolute;
- left: 50%;
- top: 250px;
- z-index: 100;
- display: none;
-}
+#repo-branches {
+ padding: 20px;
+}
+#repo-branches>.body>.options {
+ margin-bottom: 16px;
+}
+#repo-branches>.body>.options>div {
+ margin-right: 24px;
+}
+
+#repo-branches>.body>.options>div.base .input-group {
+ width: 240px;
+}
+#repo-branches>.body>.options>div.search .input-group {
+ width: 240px;
+}
+#repo-branches>.body>.options .pagination {
+ margin: 0;
+}
+#repo-branches>.body>table td {
+ white-space: nowrap;
+}
+#repo-branches>.body>table td.actions {
+ width: 1%;
+}
+#repo-branches>.body>table td.actions .fa.fa-times {
+ color: red; margin-left: 8px;
+}
+#repo-branches>.body>table td.actions span.fa.fa-times {
+ color: #888;
+}
+#repo-branches>.body>table td.behind {
+ padding-right: 0;
+}
+#repo-branches>.body>table td.ahead {
+ padding-left: 0;
+}
+#repo-branches>.body>table td.behind>div {
+ border-right: 1px solid #333;
+}
+#repo-branches>.body>table td.behind-ahead div.text {
+ margin: 0 4px;
+}
+#repo-branches>.body>table .bar {
+ height: 12px;
+}
+#repo-branches>.body>table .ahead .bar {
+ background: #666;
+}
+#repo-branches>.body>table .ahead .bar.request {
+ background: #F1D763;
+}
+#repo-branches>.body>table .behind .bar {
+ background: #ccc;
+}
+#repo-branches>.body>table .behind .bar.request {
+ background: #F1D763;
+}
+#repo-branches>.body>.help-block .bar.request {
+ background: #F1D763;
+ font-size: 10px;
+}
+#repo-branches>.body>table td.summary>div,
+#repo-branches>.body>table td.summary>div .name a {
+ font-size: 13px;
+ color: #666;
+}
+#repo-branches>.body>table td.summary>div {
+ margin-top: 4px;
+}
+#searching-branches {
+ position: absolute;
+ left: 50%;
+ top: 250px;
+ z-index: 100;
+ display: none;
+}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/tags/RepoTagsPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/tags/RepoTagsPage.html
index b47194918b..33369f6204 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/tags/RepoTagsPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/tags/RepoTagsPage.html
@@ -1,2 +1,40 @@
-<wicket:extend>
-</wicket:extend>
\ No newline at end of file
+<html xmlns:wicket>
+<wicket:extend>
+ <section id="repo-tags">
+ <div class="body">
+ <div class="options clearfix">
+ <div class="pull-left search">
+ <div class="input-group">
+ <span class="input-group-addon"><i class="fa fa-search"></i></span>
+ <input wicket:id="searchTags" class="form-control" placeholder="Search tags"></input>
+ </div>
+ </div>
+ <ul wicket:id="tagsPageNav" class="pull-right"></ul>
+ </div>
+ <table wicket:id="tagsContainer" class="table table-hover table-condensed">
+ <tr wicket:id="tags">
+ <td class="detail">
+ <a wicket:id="tagLink"><span wicket:id="name"></span></a>
+ <span wicket:id="annotated" class="annotated"></span>
+ <div class="commit">
+ <i class="fa fa-ext fa-commit"></i>
+ <span wicket:id="hashAndCode"></span>
+ <a wicket:id="commitLink"><span wicket:id="shortMessage"></span></a>
+ </div>
+ </td>
+ <td class="actions">
+ <a wicket:id="compare" title="Compare with previous tag in same branch"><i class="fa fa-ext fa-file-diff"></i></a>
+ <a wicket:id="delete" class="fa fa-times fa-lg" title="Delete this tag"></a>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </section>
+ <wicket:fragment wicket:id="annotatedFrag">
+ <a wicket:id="author"></a>
+ <span wicket:id="age"></span>
+ <a wicket:id="messageToggle" class="ellipsis-expander"><i class="fa fa-ellipsis-h"></i></a>
+ <pre wicket:id="message" class="message"></pre>
+ </wicket:fragment>
+</wicket:extend>
+</html>
\ No newline at end of file
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/tags/RepoTagsPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/tags/RepoTagsPage.java
index 72ffcf4417..d24a4022ef 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/tags/RepoTagsPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/tags/RepoTagsPage.java
@@ -1,21 +1,252 @@
-package com.pmease.gitplex.web.page.repository.tags;
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-import com.pmease.gitplex.core.model.Repository;
-import com.pmease.gitplex.web.page.repository.RepositoryPage;
-
-@SuppressWarnings("serial")
-public class RepoTagsPage extends RepositoryPage {
-
- public RepoTagsPage(PageParameters params) {
- super(params);
- }
-
- @Override
- protected void onSelect(AjaxRequestTarget target, Repository repository) {
- setResponsePage(RepoTagsPage.class, paramsOf(repository));
- }
-
-}
+package com.pmease.gitplex.web.page.repository.tags;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.wicket.RestartResponseException;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.behavior.AttributeAppender;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.link.AbstractLink;
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.PageableListView;
+import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
+import org.apache.wicket.markup.html.panel.Fragment;
+import org.apache.wicket.model.AbstractReadOnlyModel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.request.resource.CssResourceReference;
+import org.eclipse.jgit.internal.storage.file.FileRepository;
+import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.revwalk.RevObject;
+import org.eclipse.jgit.revwalk.RevTag;
+import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.jgit.revwalk.filter.RevFilter;
+
+import com.pmease.commons.git.GitUtils;
+import com.pmease.commons.util.StringUtils;
+import com.pmease.commons.wicket.ConfirmOnClick;
+import com.pmease.commons.wicket.behavior.OnTypingDoneBehavior;
+import com.pmease.commons.wicket.component.clearable.ClearableTextField;
+import com.pmease.gitplex.core.gatekeeper.GateKeeper;
+import com.pmease.gitplex.core.gatekeeper.checkresult.CheckResult;
+import com.pmease.gitplex.core.gatekeeper.checkresult.Passed;
+import com.pmease.gitplex.core.model.RepoAndRevision;
+import com.pmease.gitplex.core.model.Repository;
+import com.pmease.gitplex.core.model.User;
+import com.pmease.gitplex.core.security.SecurityUtils;
+import com.pmease.gitplex.web.component.UserLink;
+import com.pmease.gitplex.web.component.hashandcode.HashAndCodePanel;
+import com.pmease.gitplex.web.page.repository.NoCommitsPage;
+import com.pmease.gitplex.web.page.repository.RepositoryPage;
+import com.pmease.gitplex.web.page.repository.commit.CommitDetailPage;
+import com.pmease.gitplex.web.page.repository.compare.RevisionComparePage;
+import com.pmease.gitplex.web.page.repository.file.RepoFilePage;
+import com.pmease.gitplex.web.page.repository.file.RepoFileState;
+import com.pmease.gitplex.web.utils.DateUtils;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.navigation.BootstrapPagingNavigator;
+
+@SuppressWarnings("serial")
+public class RepoTagsPage extends RepositoryPage {
+
+ private TextField<String> searchInput;
+
+ private String searchFor;
+
+ public RepoTagsPage(PageParameters params) {
+ super(params);
+
+ if (!getRepository().git().hasCommits())
+ throw new RestartResponseException(NoCommitsPage.class, paramsOf(getRepository()));
+ }
+
+ @Override
+ protected String getPageTitle() {
+ return getRepository() + " - Tags";
+ }
+
+ @Override
+ protected void onInitialize() {
+ super.onInitialize();
+
+ add(searchInput = new ClearableTextField<String>("searchTags", Model.of("")));
+
+ final WebMarkupContainer tagsContainer = new WebMarkupContainer("tagsContainer");
+ tagsContainer.setOutputMarkupId(true);
+ add(tagsContainer);
+
+ final PageableListView<Ref> tagsView;
+ final IModel<List<Ref>> tagsModel = new AbstractReadOnlyModel<List<Ref>>() {
+
+ @Override
+ public List<Ref> getObject() {
+ List<Ref> refs = getRepository().getTagRefs();
+ searchFor = searchInput.getInput();
+ if (StringUtils.isNotBlank(searchFor)) {
+ searchFor = searchFor.trim().toLowerCase();
+ for (Iterator<Ref> it = refs.iterator(); it.hasNext();) {
+ String tag = GitUtils.ref2tag(it.next().getName());
+ if (!tag.toLowerCase().contains(searchFor))
+ it.remove();
+ }
+ } else {
+ searchFor = null;
+ }
+ return refs;
+ }
+
+ };
+ tagsContainer.add(tagsView = new PageableListView<Ref>("tags", tagsModel,
+ com.pmease.gitplex.web.Constants.DEFAULT_PAGE_SIZE) {
+
+ @Override
+ protected void populateItem(final ListItem<Ref> item) {
+ Ref ref = item.getModelObject();
+ final String tag = GitUtils.ref2tag(ref.getName());
+
+ RepoFileState state = new RepoFileState();
+ state.blobIdent.revision = tag;
+ AbstractLink link = new BookmarkablePageLink<Void>("tagLink",
+ RepoFilePage.class, RepoFilePage.paramsOf(getRepository(), state));
+ link.add(new Label("name", tag));
+ item.add(link);
+
+ RevObject revObject = getRepository().getRevObject(ref.getObjectId());
+ if (revObject instanceof RevTag) {
+ RevTag revTag = (RevTag) revObject;
+ Fragment fragment = new Fragment("annotated", "annotatedFrag", this);
+ fragment.add(new UserLink("author", revTag.getTaggerIdent()));
+ fragment.add(new Label("age", DateUtils.formatAge(revTag.getTaggerIdent().getWhen())));
+ Label message = new Label("message", revTag.getFullMessage());
+ message.setOutputMarkupId(true);
+ fragment.add(message);
+ String toggleScript = String.format("$('#%s').toggle();", message.getMarkupId());
+ fragment.add(new WebMarkupContainer("messageToggle").add(AttributeAppender.append("onclick", toggleScript)));
+ item.add(fragment);
+ } else {
+ item.add(new WebMarkupContainer("annotated").setVisible(false));
+ }
+
+ RevCommit commit = getRepository().getRevCommit(ref.getObjectId());
+ item.add(new HashAndCodePanel("hashAndCode", repoModel, commit.name()));
+ PageParameters params = CommitDetailPage.paramsOf(getRepository(), commit.name());
+ link = new BookmarkablePageLink<Void>("commitLink", CommitDetailPage.class, params);
+ link.add(new Label("shortMessage", commit.getShortMessage()));
+ item.add(link);
+
+ link = new Link<Void>("compare") {
+
+ @Override
+ public void onClick() {
+ try ( FileRepository jgitRepo = getRepository().openAsJGitRepo();
+ RevWalk revWalk = new RevWalk(jgitRepo);) {
+ RevCommit currentCommit = revWalk.lookupCommit(
+ getRepository().getRevCommit(item.getModelObject().getObjectId()).getId());
+ Ref prevAncestorRef = null;
+ for (int i=item.getIndex()+1; i<tagsModel.getObject().size(); i++) {
+ Ref prevRef = tagsModel.getObject().get(i);
+ revWalk.setRevFilter(RevFilter.MERGE_BASE);
+ revWalk.markStart(currentCommit);
+
+ RevCommit prevCommit = revWalk.lookupCommit(
+ getRepository().getRevCommit(prevRef.getObjectId()).getId());
+ revWalk.markStart(prevCommit);
+ if (prevCommit.equals(revWalk.next())) {
+ prevAncestorRef = prevRef;
+ break;
+ }
+ revWalk.reset();
+ }
+ RepoAndRevision target;
+ if (prevAncestorRef != null) {
+ target = new RepoAndRevision(getRepository(), prevAncestorRef.getName());
+ } else {
+ target = new RepoAndRevision(getRepository(), item.getModelObject().getName());
+ }
+ RepoAndRevision source = new RepoAndRevision(getRepository(), item.getModelObject().getName());
+ PageParameters params = RevisionComparePage.paramsOf(getRepository(), target, source, null);
+ setResponsePage(RevisionComparePage.class, params);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ };
+ link.setVisible(item.getIndex()<size()-1);
+
+ item.add(link);
+
+ item.add(new Link<Void>("delete") {
+
+ @Override
+ public void onClick() {
+ getRepository().deleteTag(tag);
+ }
+
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+
+ if (SecurityUtils.canModify(getRepository(), GitUtils.tag2ref(tag))) {
+ User currentUser = getCurrentUser();
+ if (currentUser != null) {
+ GateKeeper gateKeeper = getRepository().getGateKeeper();
+ CheckResult checkResult = gateKeeper.checkFile(currentUser, getRepository(), tag, null);
+ setVisible(checkResult instanceof Passed);
+ } else {
+ setVisible(false);
+ }
+ } else {
+ setVisible(false);
+ }
+ }
+
+ }.add(new ConfirmOnClick("Do you really want to delete this tag?")));
+ }
+
+ });
+
+ final PagingNavigator pagingNavigator;
+ add(pagingNavigator = new BootstrapPagingNavigator("tagsPageNav", tagsView) {
+
+ @Override
+ protected void onConfigure() {
+ super.onConfigure();
+ setVisible(tagsView.getPageCount() > 1);
+ }
+
+ });
+ pagingNavigator.setOutputMarkupPlaceholderTag(true);
+
+ searchInput.add(new OnTypingDoneBehavior(200) {
+
+ @Override
+ protected void onTypingDone(AjaxRequestTarget target) {
+ target.add(tagsContainer);
+ target.add(pagingNavigator);
+ }
+
+ });
+ }
+
+ @Override
+ public void renderHead(IHeaderResponse response) {
+ super.renderHead(response);
+ response.render(CssHeaderItem.forReference(new CssResourceReference(RepoTagsPage.class, "repo-tags.css")));
+ }
+
+ @Override
+ protected void onSelect(AjaxRequestTarget target, Repository repository) {
+ setResponsePage(RepoTagsPage.class, paramsOf(repository));
+ }
+}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/tags/repo-tags.css b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/tags/repo-tags.css
new file mode 100644
index 0000000000..f9befb76c1
--- /dev/null
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/repository/tags/repo-tags.css
@@ -0,0 +1,36 @@
+#repo-tags {
+ padding: 20px;
+}
+#repo-tags>.body>.options {
+ margin-bottom: 16px;
+}
+#repo-tags>.body>.options>div {
+ margin-right: 24px;
+}
+
+#repo-tags>.body>.options>div.search .input-group {
+ width: 240px;
+}
+#repo-tags>.body>.options .pagination {
+ margin: 0;
+}
+#repo-tags>.body>table td {
+ white-space: nowrap;
+}
+#repo-tags>.body>table td.summary, #repo-tags>.body>table td.actions {
+ width: 1%;
+}
+#repo-tags>.body>table td.actions .fa.fa-times {
+ color: red; margin-left: 8px;
+}
+#repo-tags>.body>table td.actions span.fa.fa-times {
+ color: #888;
+}
+#repo-tags>.body>table td.summary>div,
+#repo-tags>.body>table td.summary>div .name a {
+ font-size: 13px;
+ color: #666;
+}
+#repo-tags>.body>table td.summary>div {
+ margin-top: 4px;
+}