add resolve-button to issue view - resolves #658

Sun, 18 May 2025 13:18:57 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 18 May 2025 13:18:57 +0200
changeset 371
3795a72e2f16
parent 370
ec919d255757
child 372
560cbae73661

add resolve-button to issue view - resolves #658

src/main/kotlin/de/uapcore/lightpit/Constants.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/servlet/IssuesServlet.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt file | annotate | diff | comparison | revisions
src/main/resources/localization/strings.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/strings_de.properties file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/changelogs/changelog-de.jspf file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/changelogs/changelog.jspf file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/issue-view.jsp file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/Constants.kt	Sun May 18 12:49:17 2025 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/Constants.kt	Sun May 18 13:18:57 2025 +0200
@@ -26,7 +26,7 @@
 package de.uapcore.lightpit
 
 object Constants {
-    const val VERSION_DATE = "2025-05-17"
+    const val VERSION_DATE = "2025-05-18"
 
     /**
      * The path where the JSP files reside.
--- a/src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt	Sun May 18 12:49:17 2025 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt	Sun May 18 13:18:57 2025 +0200
@@ -6,6 +6,7 @@
 import de.uapcore.lightpit.entities.*
 import de.uapcore.lightpit.types.IssueCategory
 import de.uapcore.lightpit.types.IssueStatus
+import de.uapcore.lightpit.types.IssueStatusPhase
 import de.uapcore.lightpit.types.RelationType
 import de.uapcore.lightpit.viewmodel.IssueDetailView
 import de.uapcore.lightpit.viewmodel.PathInfos
@@ -138,6 +139,19 @@
     return true
 }
 
+fun issueQuickResolve(dao: DataAccessObject, issue: Issue) {
+    if (issue.status.phase == IssueStatusPhase.Done) return
+    if (issue.isTrackingVariantStatus) {
+        issue.variantStatus.filter { it.value.phase != IssueStatusPhase.Done }.keys.forEach {
+            issue.variantStatus[it] = IssueStatus.Done
+        }
+    } else {
+        issue.status = IssueStatus.Done
+    }
+    issue.updateStatusFromVariants()
+    dao.updateIssue(issue)
+}
+
 fun renderIssueView(
     http: HttpRequest,
     dao: DataAccessObject,
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/IssuesServlet.kt	Sun May 18 12:49:17 2025 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/servlet/IssuesServlet.kt	Sun May 18 13:18:57 2025 +0200
@@ -19,6 +19,7 @@
         get("/search", this::issueSearch)
         get("/%issue", this::issue)
         get("/%issue/edit", this::issueForm)
+        get("/%issue/resolve", this::issueResolve)
         post("/%issue/comment", this::issueComment)
         post("/%issue/relation", this::issueRelation)
         get("/%issue/removeRelation", this::issueRemoveRelation)
@@ -56,6 +57,16 @@
         renderIssueView(http, dao, issue, pathInfos)
     }
 
+    private fun issueResolve(http: HttpRequest, dao: DataAccessObject) {
+        val issue = http.pathParams["issue"]?.toIntOrNull()?.let(dao::findIssue)
+        if (issue == null) {
+            http.response.sendError(404)
+            return
+        }
+        issueQuickResolve(dao, issue)
+        http.renderCommit("${pathInfos.issuesHref}${issue.id}")
+    }
+
     private fun issueSearch(http: HttpRequest, dao: DataAccessObject) {
         val query = http.param("q")
         if (query.isNullOrBlank()) {
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Sun May 18 12:49:17 2025 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Sun May 18 13:18:57 2025 +0200
@@ -63,6 +63,7 @@
 
         get("/%project/issues/%version/%component/%variant/%issue", this::issue)
         get("/%project/issues/%version/%component/%variant/%issue/edit", this::issueForm)
+        get("/%project/issues/%version/%component/%variant/%issue/resolve", this::issueResolve)
         post("/%project/issues/%version/%component/%variant/%issue/comment", this::issueComment)
         post("/%project/issues/%version/%component/%variant/%issue/relation", this::issueRelation)
         get("/%project/issues/%version/%component/%variant/%issue/removeRelation", this::issueRemoveRelation)
@@ -395,6 +396,18 @@
         }
     }
 
+    private fun issueResolve(http: HttpRequest, dao: DataAccessObject) {
+        val issue = http.pathParams["issue"]?.toIntOrNull()?.let(dao::findIssue)
+        if (issue == null) {
+            http.response.sendError(404)
+            return
+        }
+        issueQuickResolve(dao, issue)
+        withPathInfo(http, dao)?.let { path ->
+            http.renderCommit("${path.issuesHref}${issue.id}")
+        }
+    }
+
     private fun issueForm(http: HttpRequest, dao: DataAccessObject) {
         withPathInfo(http, dao)?.let { path ->
             val issue = http.pathParams["issue"]?.toIntOrNull()?.let(dao::findIssue) ?: Issue(
--- a/src/main/resources/localization/strings.properties	Sun May 18 12:49:17 2025 +0200
+++ b/src/main/resources/localization/strings.properties	Sun May 18 13:18:57 2025 +0200
@@ -37,6 +37,7 @@
 button.issue.create.another=Create another Issue
 button.issue.create=New Issue
 button.issue.edit=Edit
+button.issue.resolve=Resolve
 button.okay=OK
 button.project.create=New Project
 button.project.edit=Edit Project
--- a/src/main/resources/localization/strings_de.properties	Sun May 18 12:49:17 2025 +0200
+++ b/src/main/resources/localization/strings_de.properties	Sun May 18 13:18:57 2025 +0200
@@ -37,6 +37,7 @@
 button.issue.create.another=Weiteren Vorgang erstellen
 button.issue.create=Neuer Vorgang
 button.issue.edit=Bearbeiten
+button.issue.resolve=Erledigt
 button.okay=OK
 button.project.create=Neues Projekt
 button.project.edit=Projekt Bearbeiten
--- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Sun May 18 12:49:17 2025 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Sun May 18 13:18:57 2025 +0200
@@ -28,6 +28,7 @@
 
 <ul>
     <li>Pop-Up hinzugefügt, das über eine neue LightPIT-Version informiert.</li>
+    <li>"Erledigt"-Schaltfläche zur Vorgangsansicht hinzugefügt.</li>
     <li>Die Standardkategorie für neue Vorgänge in veröffentlichten Versionen ist nun "Fehler" anstelle von "Feature".</li>
     <li>Fehler in der Deutschen Übersetzung behoben.</li>
 </ul>
--- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Sun May 18 12:49:17 2025 +0200
+++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Sun May 18 13:18:57 2025 +0200
@@ -28,6 +28,7 @@
 
 <ul>
     <li>Add popup informing about a new LightPIT release.</li>
+    <li>Add convenience RESOLVE button to the issue view.</li>
     <li>Change that the default category for new issues in released versions is Bug instead of Feature.</li>
     <li>Fix errors in the German translation.</li>
 </ul>
--- a/src/main/webapp/WEB-INF/jsp/issue-view.jsp	Sun May 18 12:49:17 2025 +0200
+++ b/src/main/webapp/WEB-INF/jsp/issue-view.jsp	Sun May 18 13:18:57 2025 +0200
@@ -28,6 +28,7 @@
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
+<%@page import="de.uapcore.lightpit.types.IssueStatusPhase" %>
 
 <jsp:useBean id="viewmodel" type="de.uapcore.lightpit.viewmodel.IssueDetailView" scope="request"/>
 
@@ -176,6 +177,11 @@
     <a href="${issuesHref}" class="button">
         <fmt:message key="button.back"/>
     </a>
+    <c:if test="${issue.status.phase ne IssueStatusPhase.Companion.done}">
+    <a href="${issuesHref}${issue.id}/resolve" class="button submit">
+        <fmt:message key="button.issue.resolve"/>
+    </a>
+    </c:if>
     <a href="${issuesHref}${issue.id}/edit" class="button submit">
         <fmt:message key="button.issue.edit"/>
     </a>

mercurial