implement variant status in issue list

Tue, 04 Feb 2025 18:28:55 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 04 Feb 2025 18:28:55 +0100
changeset 352
6b2caaf2c73d
parent 351
3720c7375146
child 353
d23fb91ba462

implement variant status in issue list

relates to #491

src/main/kotlin/de/uapcore/lightpit/entities/Issue.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt 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/issues.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/project-details.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jspf/issue-list.jspf file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/entities/Issue.kt	Sun Feb 02 17:08:18 2025 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/entities/Issue.kt	Tue Feb 04 18:28:55 2025 +0100
@@ -61,6 +61,29 @@
     fun getStatusForVariant(variant: Variant): IssueStatus? {
         return variantStatus[variant]
     }
+
+    fun updateStatusFromVariants() {
+        if (!isTrackingVariantStatus) return
+
+        // when all variant status are equal, this is also the issue status
+        val statusList = variantStatus.values.toList()
+        status = if (statusList.all { it == statusList[0] }) {
+            statusList[0]
+        }
+        // check if all status are in phase 0
+        else if (statusList.all { it.phase == IssueStatusPhase.Open}) {
+            IssueStatus.ToDo
+        }
+        // check if all status are in phase 2
+        else if (statusList.all { it.phase == IssueStatusPhase.Done}) {
+            IssueStatus.Done
+        }
+        // otherwise, the issue status is "InProgress"
+        else {
+            IssueStatus.InProgress
+        }
+    }
+
     val variantStatus = mutableMapOf<Variant, IssueStatus>()
 
     /**
--- a/src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt	Sun Feb 02 17:08:18 2025 +0100
+++ b/src/main/kotlin/de/uapcore/lightpit/logic/IssueLogic.kt	Tue Feb 04 18:28:55 2025 +0100
@@ -77,7 +77,7 @@
                 }
             }
         }
-        // TODO: compute overall status
+        updateStatusFromVariants()
     }
 }
 
--- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Sun Feb 02 17:08:18 2025 +0100
+++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf	Tue Feb 04 18:28:55 2025 +0100
@@ -27,6 +27,7 @@
 <h3>Version 1.5.0 (Vorschau)</h3>
 
 <ul>
+    <li>Unterstützung für Software-Varianten hinzugefügt.</li>
     <li>Autor im RSS-Feed hinzugefügt.</li>
     <li>Projekt und Komponente sind nun in der Vorgangsansicht direkt verlinkt.</li>
     <li>
--- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Sun Feb 02 17:08:18 2025 +0100
+++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf	Tue Feb 04 18:28:55 2025 +0100
@@ -27,6 +27,7 @@
 <h3>Version 1.5.0 (preview)</h3>
 
 <ul>
+    <li>Add support for software variants.</li>
     <li>Add author to RSS feed.</li>
     <li>Add links to project and component in the tabular issue view.</li>
     <li>
--- a/src/main/webapp/WEB-INF/jsp/issues.jsp	Sun Feb 02 17:08:18 2025 +0100
+++ b/src/main/webapp/WEB-INF/jsp/issues.jsp	Tue Feb 04 18:28:55 2025 +0100
@@ -42,6 +42,7 @@
 <c:set var="showVersionInfo" value="true"/>
 <c:set var="showProjectInfo" value="true"/>
 <c:set var="showComponentInfo" value="true"/>
+<c:set var="showVariantInfo" value="true"/>
 <%@include file="../jspf/issue-summary.jspf"%>
 <c:if test="${not empty issues}">
     <%@include file="../jspf/issue-list.jspf"%>
--- a/src/main/webapp/WEB-INF/jsp/project-details.jsp	Sun Feb 02 17:08:18 2025 +0100
+++ b/src/main/webapp/WEB-INF/jsp/project-details.jsp	Tue Feb 04 18:28:55 2025 +0100
@@ -52,6 +52,7 @@
 <c:set var="showVersionInfo" value="false"/>
 <c:set var="showProjectInfo" value="false"/>
 <c:set var="showComponentInfo" value="${empty component}"/>
+<c:set var="showVariantInfo" value="${empty variant}"/>
 <c:choose>
     <c:when test="${empty viewmodel.versionInfo}">
         <h2>
--- a/src/main/webapp/WEB-INF/jspf/issue-list.jspf	Sun Feb 02 17:08:18 2025 +0100
+++ b/src/main/webapp/WEB-INF/jspf/issue-list.jspf	Tue Feb 04 18:28:55 2025 +0100
@@ -1,7 +1,9 @@
 <%--
 issues: List<Issue>
 issuesHref: String
+showComponentInfo: boolean
 showVersionInfo: boolean
+showVariantInfo: boolean
 showProjectInfo: boolean
 --%>
 <table class="fullwidth datatable medskip">
@@ -54,6 +56,16 @@
                         <c:out value="${issue.component.name}"/>
                     </div>
                 </c:if>
+                <c:if test="${showVariantInfo and issue.trackingVariantStatus}">
+                    <c:forEach items="${issue.variantStatus}" var="vs">
+                    <div class="issue-tag-auto-color ${vs.key.color.textColorClass}"
+                         style="background-color: ${vs.key.color}"
+                         title="<fmt:message key="issue.status.${vs.value}" />"
+                    >
+                        <c:out value="${vs.key.name}"/>
+                    </div>
+                    </c:forEach>
+                </c:if>
                 <c:if test="${showVersionInfo and issue.resolved != null}">
                     <div class="issue-tag">
                         <c:out value="${issue.resolved.name}"/>

mercurial