# HG changeset patch # User Mike Becker # Date 1722358419 -7200 # Node ID 23fe9f174d2d358f67e827056645e4637b3cf792 # Parent 1ab9f65e683e5a57f0d01570d81ca695b7aaba02 add filter for assignee - fixes #403 diff -r 1ab9f65e683e -r 23fe9f174d2d src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt --- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Sun Jul 28 14:13:36 2024 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Tue Jul 30 18:53:39 2024 +0200 @@ -115,12 +115,13 @@ (!filter.onlyMine || (it.assignee?.username ?: "") == (http.remoteUser ?: "")) && (!filter.onlyBlocker || (relationsMap[it.id]?.any { (_,type) -> type.blocking }?:false)) && (filter.status.isEmpty() || filter.status.contains(it.status)) && - (filter.category.isEmpty() || filter.category.contains(it.category)) + (filter.category.isEmpty() || filter.category.contains(it.category)) && + (filter.onlyMine || filter.assignee.isEmpty() || filter.assignee.contains(it.assignee?.id ?: -1)) } with(http) { pageTitle = project.name - view = ProjectDetails(path, issues, filter) + view = ProjectDetails(path, issues, filter, dao.listUsers().sortedBy(User::shortDisplayname)) feedPath = feedPath(project) navigationMenu = projectNavMenu(dao.listProjects(), path) styleSheets = listOf("projects") diff -r 1ab9f65e683e -r 23fe9f174d2d src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt --- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt Sun Jul 28 14:13:36 2024 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Issues.kt Tue Jul 30 18:53:39 2024 +0200 @@ -208,11 +208,14 @@ val onlyBlocker: Boolean = evalFlag(http, flagBlocker) val status: List = evalEnum(http, "s") val category: List = evalEnum(http, "c") + val assignee: List = evalInts(http, "u") val sortPrimary: IssueSorter.Criteria = evalSort(http, "primary", IssueSorter.Criteria(IssueSorter.Field.DONE)) val sortSecondary: IssueSorter.Criteria = evalSort(http, "secondary", IssueSorter.Criteria(IssueSorter.Field.ETA)) val sortTertiary: IssueSorter.Criteria = evalSort(http, "tertiary", IssueSorter.Criteria(IssueSorter.Field.UPDATED, false)) + fun containsAssignee(user: User?): Boolean = assignee.contains(user?.id?:-1) + private fun evalSort(http: HttpRequest, prio: String, defaultValue: IssueSorter.Criteria): IssueSorter.Criteria { val param = http.param("sort_$prio") if (param != null) { @@ -268,4 +271,25 @@ ?.map { enumValueOf(it) } ?: emptyList() } + + private fun evalInts(http: HttpRequest, prefix: String): List { + val sattr = "f.${prefix}" + val param = http.paramArray("filter") + if (param.isNotEmpty()) { + val list = param.filter { it.startsWith("${prefix}.") } + .map { it.substring(prefix.length + 1) } + .mapNotNull(String::toIntOrNull) + if (list.isEmpty()) { + http.session.removeAttribute(sattr) + } else { + http.session.setAttribute(sattr, list.joinToString(",")) + } + } + + return http.session.getAttribute(sattr) + ?.toString() + ?.split(",") + ?.map(String::toInt) + ?: emptyList() + } } diff -r 1ab9f65e683e -r 23fe9f174d2d src/main/kotlin/de/uapcore/lightpit/viewmodel/Projects.kt --- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/Projects.kt Sun Jul 28 14:13:36 2024 +0200 +++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/Projects.kt Tue Jul 30 18:53:39 2024 +0200 @@ -49,6 +49,7 @@ val pathInfos: PathInfos, val issues: List, val filter: IssueFilter, + val users: List ) : View() { val projectInfo = pathInfos.projectInfo val issueSummary = IssueSummary() diff -r 1ab9f65e683e -r 23fe9f174d2d src/main/resources/localization/strings_de.properties --- a/src/main/resources/localization/strings_de.properties Sun Jul 28 14:13:36 2024 +0200 +++ b/src/main/resources/localization/strings_de.properties Tue Jul 30 18:53:39 2024 +0200 @@ -72,7 +72,7 @@ feed.issues.type.UpdateComment=Kommentar Update feed=Feed issue.affected-versions=Betroffen -issue.assignee=Zugewiesen +issue.assignee=Bearbeiter issue.category.Bug=Fehler issue.category.Feature=Feature issue.category.Improvement=Verbesserung diff -r 1ab9f65e683e -r 23fe9f174d2d src/main/webapp/WEB-INF/changelogs/changelog-de.jspf --- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf Sun Jul 28 14:13:36 2024 +0200 +++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf Tue Jul 30 18:53:39 2024 +0200 @@ -27,6 +27,7 @@

Version 1.3.0 - Vorschau

    +
  • Filter für Bearbeiter hinzugefügt.
  • Automatische Zuweisung von Vorgängen bezieht neben der Leitung für eine Komponente nun auch die Leitung des Projektes ein.
  • Der "OK" Button im Vorgangseditor führt nun zurück zur Vorgangsübersicht.
  • Ein neuer "Speichern" Button im Vorgangseditor führt, wie zuvor, zurück zur Vorgangsansicht.
  • diff -r 1ab9f65e683e -r 23fe9f174d2d src/main/webapp/WEB-INF/changelogs/changelog.jspf --- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf Sun Jul 28 14:13:36 2024 +0200 +++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf Tue Jul 30 18:53:39 2024 +0200 @@ -27,6 +27,7 @@

    Version 1.3.0 - preview

      +
    • Add filter for assignee.
    • Automatic assignment of issue now uses the project lead as fallback when no component lead is available.
    • The "OK" button in the issue editor now leads to the issue overview.
    • A new "Save" button in the issue editor retains the old behavior and returns to the issue viewer.
    • diff -r 1ab9f65e683e -r 23fe9f174d2d src/main/webapp/WEB-INF/jsp/site.jsp --- a/src/main/webapp/WEB-INF/jsp/site.jsp Sun Jul 28 14:13:36 2024 +0200 +++ b/src/main/webapp/WEB-INF/jsp/site.jsp Tue Jul 30 18:53:39 2024 +0200 @@ -31,7 +31,7 @@ <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%-- Version suffix for forcing browsers to update the CSS / JS files --%> - + <%-- Make the base href easily available at request scope --%> diff -r 1ab9f65e683e -r 23fe9f174d2d src/main/webapp/WEB-INF/jspf/issue-filter.jspf --- a/src/main/webapp/WEB-INF/jspf/issue-filter.jspf Sun Jul 28 14:13:36 2024 +0200 +++ b/src/main/webapp/WEB-INF/jspf/issue-filter.jspf Tue Jul 30 18:53:39 2024 +0200 @@ -9,10 +9,12 @@ @@ -50,6 +52,19 @@ +
      + + +
      <%@include file="sort-box.jspf"%> diff -r 1ab9f65e683e -r 23fe9f174d2d src/main/webapp/project-details.js --- a/src/main/webapp/project-details.js Sun Jul 28 14:13:36 2024 +0200 +++ b/src/main/webapp/project-details.js Tue Jul 30 18:53:39 2024 +0200 @@ -63,6 +63,16 @@ } } +function toggleAssigneeOnlyMine() { + const filters = document.getElementById('filter-assignee') + const toggle = document.getElementById('filter-only-mine') + if (toggle.checked) { + filters.disabled = true; + } else { + filters.disabled = false; + } +} + function toggleDetails() { toggleProjectDetails() toggleFilterDetails()