mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
Add search condition 'Issue with no milestone'.
This commit is contained in:
@@ -71,7 +71,8 @@ trait IssuesService {
|
||||
(t1.userName is owner.bind) &&
|
||||
(t1.repositoryName is repository.bind) &&
|
||||
(t1.closed is (condition.state == "closed").bind) &&
|
||||
(t1.milestoneId is condition.milestoneId.get.bind, condition.milestoneId.isDefined) &&
|
||||
(t1.milestoneId is condition.milestoneId.get.get.bind, condition.milestoneId.flatten.isDefined) &&
|
||||
(t1.milestoneId isNull, condition.milestoneId == Some(None)) &&
|
||||
(t1.assignedUserName is userName.get.bind, filter == "assigned") &&
|
||||
(t1.openedUserName is userName.get.bind, filter == "created_by")
|
||||
}
|
||||
@@ -151,7 +152,8 @@ trait IssuesService {
|
||||
(t1.userName is owner.bind) &&
|
||||
(t1.repositoryName is repository.bind) &&
|
||||
(t1.closed is (condition.state == "closed").bind) &&
|
||||
(t1.milestoneId is condition.milestoneId.get.bind, condition.milestoneId.isDefined) &&
|
||||
(t1.milestoneId is condition.milestoneId.get.get.bind, condition.milestoneId.flatten.isDefined) &&
|
||||
(t1.milestoneId isNull, condition.milestoneId == Some(None)) &&
|
||||
(t1.assignedUserName is userName.get.bind, filter == "assigned") &&
|
||||
(t1.openedUserName is userName.get.bind, filter == "created_by") &&
|
||||
(IssueLabels filter { t2 =>
|
||||
@@ -211,18 +213,21 @@ object IssuesService {
|
||||
val IssueLimit = 30
|
||||
|
||||
case class IssueSearchCondition(
|
||||
labels: Set[String] = Set.empty,
|
||||
milestoneId: Option[Int] = None,
|
||||
state: String = "open",
|
||||
sort: String = "created",
|
||||
direction: String = "desc"){
|
||||
labels: Set[String] = Set.empty,
|
||||
milestoneId: Option[Option[Int]] = None,
|
||||
state: String = "open",
|
||||
sort: String = "created",
|
||||
direction: String = "desc"){
|
||||
|
||||
import IssueSearchCondition._
|
||||
|
||||
def toURL: String =
|
||||
"?" + List(
|
||||
if(labels.isEmpty) None else Some("labels=" + urlEncode(labels.mkString(" "))),
|
||||
milestoneId.map("milestone=" + _),
|
||||
milestoneId.map { id => "milestone=" + (id match {
|
||||
case Some(x) => x.toString
|
||||
case None => "none"
|
||||
})},
|
||||
Some("state=" + urlEncode(state)),
|
||||
Some("sort=" + urlEncode(sort)),
|
||||
Some("direction=" + urlEncode(direction))).flatten.mkString("&")
|
||||
@@ -241,7 +246,10 @@ object IssuesService {
|
||||
def apply(request: HttpServletRequest): IssueSearchCondition =
|
||||
IssueSearchCondition(
|
||||
param(request, "labels").map(_.split(" ").toSet).getOrElse(Set.empty),
|
||||
param(request, "milestone").map(_.toInt),
|
||||
param(request, "milestone").map(_ match {
|
||||
case "none" => None
|
||||
case x => Some(x.toInt)
|
||||
}),
|
||||
param(request, "state", Seq("open", "closed")).getOrElse("open"),
|
||||
param(request, "sort", Seq("created", "comments", "updated")).getOrElse("created"),
|
||||
param(request, "direction", Seq("asc", "desc")).getOrElse("desc"))
|
||||
|
||||
@@ -33,9 +33,13 @@
|
||||
</ul>
|
||||
<hr/>
|
||||
@if(condition.milestoneId.isEmpty){
|
||||
No milestone selected
|
||||
<span class="muted small">No milestone selected</span>
|
||||
} else {
|
||||
<span class="muted">Milestone:</span> @milestones.find(_.milestoneId == condition.milestoneId.get).map(_.title)
|
||||
@if(condition.milestoneId.get.isEmpty){
|
||||
<span class="muted small">Issues with no milestone</span>
|
||||
} else {
|
||||
<span class="muted small">Milestone:</span> @milestones.find(_.milestoneId == condition.milestoneId.get.get).map(_.title)
|
||||
}
|
||||
}
|
||||
<div class="btn-group">
|
||||
<button class="btn dropdown-toggle" data-toggle="dropdown">
|
||||
@@ -43,12 +47,16 @@
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
@if(condition.milestoneId.isDefined){
|
||||
<li><a href="@condition.copy(milestoneId = None).toURL">Clear milestone filter</a></li>
|
||||
}
|
||||
<li><a href="@condition.copy(milestoneId = Some(None)).toURL">Issues with no milestone</a></li>
|
||||
@milestones.map { milestone =>
|
||||
<li><a href="@condition.copy(milestoneId = Some(milestone.milestoneId)).toURL">@milestone.title</a></li>
|
||||
<li><a href="@condition.copy(milestoneId = Some(Some(milestone.milestoneId))).toURL">@milestone.title</a></li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
@if(condition.milestoneId.isDefined){
|
||||
@if(condition.milestoneId.isDefined && condition.milestoneId.get.isDefined){
|
||||
<div class="milestone-progress" style="margin-top: 8px;">
|
||||
@if(closedCount > 0){
|
||||
<span class="milestone-progress" style="width: @((closedCount.toDouble / (openCount + closedCount).toDouble * 100).toInt)%;"></span>
|
||||
|
||||
Reference in New Issue
Block a user