mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 14:35:52 +01:00
(refs #529)Organization filter
This commit is contained in:
@@ -9,7 +9,8 @@ class DashboardController extends DashboardControllerBase
|
|||||||
with UsersAuthenticator
|
with UsersAuthenticator
|
||||||
|
|
||||||
trait DashboardControllerBase extends ControllerBase {
|
trait DashboardControllerBase extends ControllerBase {
|
||||||
self: IssuesService with PullRequestService with RepositoryService with UsersAuthenticator =>
|
self: IssuesService with PullRequestService with RepositoryService with AccountService
|
||||||
|
with UsersAuthenticator =>
|
||||||
|
|
||||||
get("/dashboard/issues/repos")(usersOnly {
|
get("/dashboard/issues/repos")(usersOnly {
|
||||||
searchIssues("created_by")
|
searchIssues("created_by")
|
||||||
@@ -59,7 +60,8 @@ trait DashboardControllerBase extends ControllerBase {
|
|||||||
countIssue(condition.copy(state = "open" ), filterUser, false, userRepos: _*),
|
countIssue(condition.copy(state = "open" ), filterUser, false, userRepos: _*),
|
||||||
countIssue(condition.copy(state = "closed"), filterUser, false, userRepos: _*),
|
countIssue(condition.copy(state = "closed"), filterUser, false, userRepos: _*),
|
||||||
condition,
|
condition,
|
||||||
filter)
|
filter,
|
||||||
|
getGroupNames(userName))
|
||||||
}
|
}
|
||||||
|
|
||||||
private def searchPullRequests(filter: String, repository: Option[String]) = {
|
private def searchPullRequests(filter: String, repository: Option[String]) = {
|
||||||
@@ -83,7 +85,8 @@ trait DashboardControllerBase extends ControllerBase {
|
|||||||
countIssue(condition.copy(state = "open" ), filterUser, true, allRepos: _*),
|
countIssue(condition.copy(state = "open" ), filterUser, true, allRepos: _*),
|
||||||
countIssue(condition.copy(state = "closed"), filterUser, true, allRepos: _*),
|
countIssue(condition.copy(state = "closed"), filterUser, true, allRepos: _*),
|
||||||
condition,
|
condition,
|
||||||
filter)
|
filter,
|
||||||
|
getGroupNames(userName))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -168,6 +168,11 @@ trait AccountService {
|
|||||||
Repositories.filter(_.userName === userName.bind).delete
|
Repositories.filter(_.userName === userName.bind).delete
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getGroupNames(userName: String)(implicit s: Session): List[String] = {
|
||||||
|
List(userName) ++
|
||||||
|
Collaborators.filter(_.collaboratorName === userName.bind).sortBy(_.userName).map(_.userName).list
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object AccountService extends AccountService
|
object AccountService extends AccountService
|
||||||
|
|||||||
@@ -186,7 +186,8 @@ trait IssuesService {
|
|||||||
(Repositories filter { t3 =>
|
(Repositories filter { t3 =>
|
||||||
(t3.byRepository(t1.userName, t1.repositoryName)) &&
|
(t3.byRepository(t1.userName, t1.repositoryName)) &&
|
||||||
(t3.isPrivate === (condition.visibility == Some("private")).bind)
|
(t3.isPrivate === (condition.visibility == Some("private")).bind)
|
||||||
} exists, condition.visibility.nonEmpty)
|
} exists, condition.visibility.nonEmpty) &&
|
||||||
|
(t1.userName inSetBind condition.groups, condition.groups.nonEmpty)
|
||||||
}
|
}
|
||||||
|
|
||||||
def createIssue(owner: String, repository: String, loginUser: String, title: String, content: Option[String],
|
def createIssue(owner: String, repository: String, loginUser: String, title: String, content: Option[String],
|
||||||
@@ -349,7 +350,8 @@ object IssuesService {
|
|||||||
state: String = "open",
|
state: String = "open",
|
||||||
sort: String = "created",
|
sort: String = "created",
|
||||||
direction: String = "desc",
|
direction: String = "desc",
|
||||||
visibility: Option[String] = None){
|
visibility: Option[String] = None,
|
||||||
|
groups: Set[String] = Set.empty){
|
||||||
|
|
||||||
def isEmpty: Boolean = {
|
def isEmpty: Boolean = {
|
||||||
labels.isEmpty && milestoneId.isEmpty && author.isEmpty && assigned.isEmpty &&
|
labels.isEmpty && milestoneId.isEmpty && author.isEmpty && assigned.isEmpty &&
|
||||||
@@ -371,7 +373,8 @@ object IssuesService {
|
|||||||
Some("state=" + urlEncode(state)),
|
Some("state=" + urlEncode(state)),
|
||||||
Some("sort=" + urlEncode(sort)),
|
Some("sort=" + urlEncode(sort)),
|
||||||
Some("direction=" + urlEncode(direction)),
|
Some("direction=" + urlEncode(direction)),
|
||||||
visibility.map(x => "visibility=" + urlEncode(x))
|
visibility.map(x => "visibility=" + urlEncode(x)),
|
||||||
|
if(groups.isEmpty) None else Some("groups=" + urlEncode(groups.mkString(",")))
|
||||||
).flatten.mkString("&")
|
).flatten.mkString("&")
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -396,7 +399,8 @@ object IssuesService {
|
|||||||
param(request, "state", Seq("open", "closed")).getOrElse("open"),
|
param(request, "state", Seq("open", "closed")).getOrElse("open"),
|
||||||
param(request, "sort", Seq("created", "comments", "updated")).getOrElse("created"),
|
param(request, "sort", Seq("created", "comments", "updated")).getOrElse("created"),
|
||||||
param(request, "direction", Seq("asc", "desc")).getOrElse("desc"),
|
param(request, "direction", Seq("asc", "desc")).getOrElse("desc"),
|
||||||
param(request, "visibility")
|
param(request, "visibility"),
|
||||||
|
param(request, "groups").map(_.split(",").toSet).getOrElse(Set.empty)
|
||||||
)
|
)
|
||||||
|
|
||||||
def page(request: HttpServletRequest) = try {
|
def page(request: HttpServletRequest) = try {
|
||||||
|
|||||||
74
src/main/twirl/dashboard/header.scala.html
Normal file
74
src/main/twirl/dashboard/header.scala.html
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
@(openCount: Int,
|
||||||
|
closedCount: Int,
|
||||||
|
condition: service.IssuesService.IssueSearchCondition,
|
||||||
|
groups: List[String])(implicit context: app.Context)
|
||||||
|
@import context._
|
||||||
|
@import view.helpers._
|
||||||
|
<span class="small">
|
||||||
|
<a class="button-link@if(condition.state == "open"){ selected}" href="@condition.copy(state = "open").toURL">
|
||||||
|
<img src="@assets/common/images/status-open@(if(condition.state == "open"){"-active"}).png"/>
|
||||||
|
@openCount Open
|
||||||
|
</a>
|
||||||
|
<a class="button-link@if(condition.state == "closed"){ selected}" href="@condition.copy(state = "closed").toURL">
|
||||||
|
<img src="@assets/common/images/status-closed@(if(condition.state == "closed"){"-active"}).png"/>
|
||||||
|
@closedCount Closed
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<div class="pull-right" id="table-issues-control">
|
||||||
|
@helper.html.dropdown("Visibility", flat = true){
|
||||||
|
<li>
|
||||||
|
<a href="@(condition.copy(visibility = (if(condition.visibility == Some("private")) None else Some("private"))).toURL)">
|
||||||
|
@helper.html.checkicon(condition.visibility == Some("private"))
|
||||||
|
Private repository only
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="@(condition.copy(visibility = (if(condition.visibility == Some("public")) None else Some("public"))).toURL)">
|
||||||
|
@helper.html.checkicon(condition.visibility == Some("public"))
|
||||||
|
Public repository only
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
@helper.html.dropdown("Organization", flat = true){
|
||||||
|
@groups.map { group =>
|
||||||
|
<li>
|
||||||
|
<a href="@((if(condition.groups.contains(group)) condition.copy(groups = condition.groups - group) else condition.copy(groups = condition.groups + group)).toURL)">
|
||||||
|
@helper.html.checkicon(condition.groups.contains(group))
|
||||||
|
@avatar(group, 20) @group
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@helper.html.dropdown("Sort", flat = true){
|
||||||
|
<li>
|
||||||
|
<a href="@condition.copy(sort="created", direction="desc").toURL">
|
||||||
|
@helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="@condition.copy(sort="created", direction="asc" ).toURL">
|
||||||
|
@helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="@condition.copy(sort="comments", direction="desc").toURL">
|
||||||
|
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="@condition.copy(sort="comments", direction="asc" ).toURL">
|
||||||
|
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="@condition.copy(sort="updated", direction="desc").toURL">
|
||||||
|
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="@condition.copy(sort="updated", direction="asc" ).toURL">
|
||||||
|
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -3,12 +3,13 @@
|
|||||||
openCount: Int,
|
openCount: Int,
|
||||||
closedCount: Int,
|
closedCount: Int,
|
||||||
condition: service.IssuesService.IssueSearchCondition,
|
condition: service.IssuesService.IssueSearchCondition,
|
||||||
filter: String)(implicit context: app.Context)
|
filter: String,
|
||||||
|
groups: List[String])(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@html.main("Issues"){
|
@html.main("Issues"){
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@dashboard.html.tab("issues")
|
@dashboard.html.tab("issues")
|
||||||
@issueslist(issues, page, openCount, closedCount, condition, filter)
|
@issueslist(issues, page, openCount, closedCount, condition, filter, groups)
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
openCount: Int,
|
openCount: Int,
|
||||||
closedCount: Int,
|
closedCount: Int,
|
||||||
condition: service.IssuesService.IssueSearchCondition,
|
condition: service.IssuesService.IssueSearchCondition,
|
||||||
filter: String)(implicit context: app.Context)
|
filter: String,
|
||||||
|
groups: List[String])(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@import service.IssuesService.IssueInfo
|
@import service.IssuesService.IssueInfo
|
||||||
@@ -17,67 +18,7 @@
|
|||||||
<table class="table table-bordered table-hover table-issues">
|
<table class="table table-bordered table-hover table-issues">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="background-color: #eee;">
|
<th style="background-color: #eee;">
|
||||||
<span class="small">
|
@dashboard.html.header(openCount, closedCount, condition, groups)
|
||||||
<a class="button-link@if(condition.state == "open"){ selected}" href="@condition.copy(state = "open").toURL">
|
|
||||||
<img src="@assets/common/images/status-open@(if(condition.state == "open"){"-active"}).png"/>
|
|
||||||
@openCount Open
|
|
||||||
</a>
|
|
||||||
<a class="button-link@if(condition.state == "closed"){ selected}" href="@condition.copy(state = "closed").toURL">
|
|
||||||
<img src="@assets/common/images/status-closed@(if(condition.state == "closed"){"-active"}).png"/>
|
|
||||||
@closedCount Closed
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
<div class="pull-right" id="table-issues-control">
|
|
||||||
@helper.html.dropdown("Visibility", flat = true){
|
|
||||||
<li>
|
|
||||||
<a href="@(condition.copy(visibility = (if(condition.visibility == Some("private")) None else Some("private"))).toURL)">
|
|
||||||
@helper.html.checkicon(condition.visibility == Some("private"))
|
|
||||||
Private repository only
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@(condition.copy(visibility = (if(condition.visibility == Some("public")) None else Some("public"))).toURL)">
|
|
||||||
@helper.html.checkicon(condition.visibility == Some("public"))
|
|
||||||
Public repository only
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
@helper.html.dropdown("Organization", flat = true){
|
|
||||||
<li>TODO</li>
|
|
||||||
}
|
|
||||||
@helper.html.dropdown("Sort", flat = true){
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="created", direction="desc").toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="created", direction="asc" ).toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="comments", direction="desc").toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="comments", direction="asc" ).toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="updated", direction="desc").toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="updated", direction="asc" ).toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@issues.map { case IssueInfo(issue, labels, milestone, commentCount) =>
|
@issues.map { case IssueInfo(issue, labels, milestone, commentCount) =>
|
||||||
|
|||||||
@@ -3,12 +3,13 @@
|
|||||||
openCount: Int,
|
openCount: Int,
|
||||||
closedCount: Int,
|
closedCount: Int,
|
||||||
condition: service.IssuesService.IssueSearchCondition,
|
condition: service.IssuesService.IssueSearchCondition,
|
||||||
filter: String)(implicit context: app.Context)
|
filter: String,
|
||||||
|
groups: List[String])(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@html.main("Pull Requests"){
|
@html.main("Pull Requests"){
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@dashboard.html.tab("pulls")
|
@dashboard.html.tab("pulls")
|
||||||
@issueslist(issues, page, openCount, closedCount, condition, filter)
|
@issueslist(issues, page, openCount, closedCount, condition, filter, groups)
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
openCount: Int,
|
openCount: Int,
|
||||||
closedCount: Int,
|
closedCount: Int,
|
||||||
condition: service.IssuesService.IssueSearchCondition,
|
condition: service.IssuesService.IssueSearchCondition,
|
||||||
filter: String)(implicit context: app.Context)
|
filter: String,
|
||||||
|
groups: List[String])(implicit context: app.Context)
|
||||||
@import context._
|
@import context._
|
||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
@import service.IssuesService.IssueInfo
|
@import service.IssuesService.IssueInfo
|
||||||
@@ -67,67 +68,7 @@
|
|||||||
<table class="table table-bordered table-hover table-issues">
|
<table class="table table-bordered table-hover table-issues">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="background-color: #eee;">
|
<th style="background-color: #eee;">
|
||||||
<span class="small">
|
@dashboard.html.header(openCount, closedCount, condition, groups)
|
||||||
<a class="button-link@if(condition.state == "open"){ selected}" href="@condition.copy(state = "open").toURL">
|
|
||||||
<img src="@assets/common/images/status-open@(if(condition.state == "open"){"-active"}).png"/>
|
|
||||||
@openCount Open
|
|
||||||
</a>
|
|
||||||
<a class="button-link@if(condition.state == "closed"){ selected}" href="@condition.copy(state = "closed").toURL">
|
|
||||||
<img src="@assets/common/images/status-closed@(if(condition.state == "closed"){"-active"}).png"/>
|
|
||||||
@closedCount Closed
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
<div class="pull-right" id="table-issues-control">
|
|
||||||
@helper.html.dropdown("Visibility", flat = true){
|
|
||||||
<li>
|
|
||||||
<a href="@(condition.copy(visibility = (if(condition.visibility == Some("private")) None else Some("private"))).toURL)">
|
|
||||||
@helper.html.checkicon(condition.visibility == Some("private"))
|
|
||||||
Private repository only
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@(condition.copy(visibility = (if(condition.visibility == Some("public")) None else Some("public"))).toURL)">
|
|
||||||
@helper.html.checkicon(condition.visibility == Some("public"))
|
|
||||||
Public repository only
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
@helper.html.dropdown("Organization", flat = true){
|
|
||||||
<li>TODO</li>
|
|
||||||
}
|
|
||||||
@helper.html.dropdown("Sort", flat = true){
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="created", direction="desc").toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "created" && condition.direction == "desc") Newest
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="created", direction="asc" ).toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "created" && condition.direction == "asc") Oldest
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="comments", direction="desc").toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "desc") Most commented
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="comments", direction="asc" ).toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "comments" && condition.direction == "asc") Least commented
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="updated", direction="desc").toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "desc") Recently updated
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="@condition.copy(sort="updated", direction="asc" ).toURL">
|
|
||||||
@helper.html.checkicon(condition.sort == "updated" && condition.direction == "asc") Least recently updated
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@issues.map { case IssueInfo(issue, labels, milestone, commentCount) =>
|
@issues.map { case IssueInfo(issue, labels, milestone, commentCount) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user