diff options
5 files changed, 23 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/tickets/QueryResult.java b/src/main/java/com/gitblit/tickets/QueryResult.java index f8d6d123..14698c3d 100644 --- a/src/main/java/com/gitblit/tickets/QueryResult.java +++ b/src/main/java/com/gitblit/tickets/QueryResult.java @@ -60,6 +60,7 @@ public class QueryResult implements Serializable { public List<String> participants; public List<String> watchedby; public List<String> mentions; + public List<String> dependencies; public Patchset patchset; public int commentsCount; public int votesCount; diff --git a/src/main/java/com/gitblit/tickets/TicketIndexer.java b/src/main/java/com/gitblit/tickets/TicketIndexer.java index e2d53af7..5db5590d 100644 --- a/src/main/java/com/gitblit/tickets/TicketIndexer.java +++ b/src/main/java/com/gitblit/tickets/TicketIndexer.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.text.MessageFormat; import java.text.ParseException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.LinkedHashSet; @@ -106,7 +107,8 @@ public class TicketIndexer { votes(Type.INT), //NOTE: Indexing on the underlying value to allow flexibility on naming priority(Type.INT), - severity(Type.INT); + severity(Type.INT), + dependencies(Type.STRING); final Type fieldType; @@ -521,6 +523,9 @@ public class TicketIndexer { toDocField(doc, Lucene.participants, StringUtils.flattenStrings(ticket.getParticipants(), ";").toLowerCase()); toDocField(doc, Lucene.watchedby, StringUtils.flattenStrings(ticket.getWatchers(), ";").toLowerCase()); toDocField(doc, Lucene.mentions, StringUtils.flattenStrings(ticket.getMentions(), ";").toLowerCase()); + for (String dep : ticket.getDependencies()) { + toDocField(doc, Lucene.dependencies, dep); + } toDocField(doc, Lucene.votes, ticket.getVoters().size()); toDocField(doc, Lucene.priority, ticket.priority.getValue()); toDocField(doc, Lucene.severity, ticket.severity.getValue()); @@ -607,6 +612,7 @@ public class TicketIndexer { result.mentions = unpackStrings(doc, Lucene.mentions); result.priority = TicketModel.Priority.fromObject(unpackInt(doc, Lucene.priority), TicketModel.Priority.defaultPriority); result.severity = TicketModel.Severity.fromObject(unpackInt(doc, Lucene.severity), TicketModel.Severity.defaultSeverity); + result.dependencies = convertList(doc, Lucene.dependencies); if (!StringUtils.isEmpty(doc.get(Lucene.patchset.name()))) { // unpack most recent patchset @@ -625,6 +631,10 @@ public class TicketIndexer { return result; } + private List<String> convertList(Document doc, Lucene lucene) { + return Arrays.asList(doc.getValues(lucene.name())); + } + private String unpackString(Document doc, Lucene lucene) { return doc.get(lucene.name()); } diff --git a/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties b/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties index 10bfe009..98b619a4 100644 --- a/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties +++ b/src/main/java/com/gitblit/wicket/GitBlitWebApp.properties @@ -516,6 +516,8 @@ gb.responsible = responsible gb.dependency = dependency gb.dependencies = dependencies gb.remove = remove +gb.dependant = dependant +gb.showDependant = show dependant gb.createdThisTicket = created this ticket gb.proposedThisChange = proposed this change gb.uploadedPatchsetN = uploaded patchset {0} diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.html b/src/main/java/com/gitblit/wicket/pages/TicketPage.html index e3d143db..26f3f03f 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketPage.html +++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.html @@ -73,6 +73,7 @@ <tr><th><wicket:message key="gb.responsible"></wicket:message></th><td><span wicket:id="responsible">[responsible]</span></td></tr>
<tr><th><wicket:message key="gb.milestone"></wicket:message></th><td><span wicket:id="milestone">[milestone]</span></td></tr>
<tr><th><wicket:message key="gb.dependencies"></wicket:message></th><td><span wicket:id="dependencies"><a wicket:id="dependencyLink">[link]</a></span></td></tr>
+ <tr><th><wicket:message key="gb.dependant"></wicket:message></th><td><a wicket:id="dependOnLink"><wicket:message key="gb.showDependant"></wicket:message></a></td></tr>
<tr><th><wicket:message key="gb.votes"></wicket:message></th><td><span wicket:id="votes" class="badge">1</span> <a style="padding-left:5px" wicket:id="voteLink" href="#">vote</a></td></tr>
<tr><th><wicket:message key="gb.watchers"></wicket:message></th><td><span wicket:id="watchers" class="badge">1</span> <a style="padding-left:5px" wicket:id="watchLink" href="#">watch</a></td></tr>
<tr><th><wicket:message key="gb.export"></wicket:message></th><td><a rel="nofollow" target="_blank" wicket:id="exportJson"></a></td></tr>
diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.java b/src/main/java/com/gitblit/wicket/pages/TicketPage.java index 74484b09..ae481962 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.java @@ -307,6 +307,8 @@ public class TicketPage extends RepositoryPage { }
});
+ add(new BookmarkablePageLink<Void>("dependOnLink", TicketsPage.class, queryDependsOn(ticket.number)));
+
/*
* PARTICIPANTS (DISCUSSION TAB)
*/
@@ -997,6 +999,12 @@ public class TicketPage extends RepositoryPage { add(revisionHistory);
}
+ private PageParameters queryDependsOn(long number) {
+ PageParameters params = WicketUtils.newRepositoryParameter(repositoryName);
+ params.add("q", Lucene.dependencies.name() + ':' + number);
+ return params;
+ }
+
protected void addUserAttributions(MarkupContainer container, Change entry, int avatarSize) {
UserModel commenter = app().users().getUserModel(entry.author);
if (commenter == null) {
|