adds indicators for version status

Thu, 08 Oct 2020 20:38:43 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 08 Oct 2020 20:38:43 +0200
changeset 110
9d0be0b1580f
parent 109
2e0669e814ff
child 111
db706d37c540

adds indicators for version status

replaces table column "Status" with version tag
fixes New Version form button not overriding the session version ID

src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/project-details.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/project-navmenu.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/versions.jsp file | annotate | diff | comparison | revisions
src/main/webapp/projects.css file | annotate | diff | comparison | revisions
--- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Thu Oct 08 20:16:47 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Thu Oct 08 20:38:43 2020 +0200
@@ -223,12 +223,19 @@
     }
 
     @RequestMapping(requestPath = "versions/edit", method = HttpMethod.GET)
-    public ResponseType editVersion(HttpServletRequest req, DataAccessObjects dao) throws SQLException {
+    public ResponseType editVersion(HttpServletRequest req, HttpServletResponse resp, DataAccessObjects dao) throws IOException, SQLException {
         final var viewModel = new VersionEditView();
         populate(viewModel, req, dao);
 
+        if (viewModel.getProjectInfo() == null) {
+            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "No project selected.");
+            return ResponseType.NONE;
+        }
+
         if (viewModel.getVersionFilter() == null) {
-            viewModel.setVersion(new Version(-1));
+            final var version = new Version(-1);
+            version.setProject(viewModel.getProjectInfo().getProject());
+            viewModel.setVersion(version);
         } else {
             viewModel.setVersion(viewModel.getVersionFilter());
         }
--- a/src/main/webapp/WEB-INF/jsp/project-details.jsp	Thu Oct 08 20:16:47 2020 +0200
+++ b/src/main/webapp/WEB-INF/jsp/project-details.jsp	Thu Oct 08 20:38:43 2020 +0200
@@ -37,7 +37,7 @@
     <c:if test="${not empty viewmodel.versionFilter}">
         <a href="./projects/versions/edit?vid=${viewmodel.versionFilter.id}" class="button"><fmt:message key="button.version.edit"/></a>
     </c:if>
-    <a href="./projects/versions/edit" class="button"><fmt:message key="button.version.create"/></a>
+    <a href="./projects/versions/edit?vid=-1" class="button"><fmt:message key="button.version.create"/></a>
     <a href="./projects/issues/edit?pid=${project.id}" class="button"><fmt:message key="button.issue.create"/></a>
 </div>
 
--- a/src/main/webapp/WEB-INF/jsp/project-navmenu.jsp	Thu Oct 08 20:16:47 2020 +0200
+++ b/src/main/webapp/WEB-INF/jsp/project-navmenu.jsp	Thu Oct 08 20:38:43 2020 +0200
@@ -44,6 +44,7 @@
             </a>
         </div>
         <div class="menuEntry level-2">
+            <div class="version-icon" style="background: black"></div>
             <a href="projects/view?pid=${projectInfo.project.id}&vid=-1">
                 <fmt:message key="menu.versions.unassigned" />
             </a>
@@ -51,6 +52,7 @@
         <c:forEach var="version" items="${viewmodel.projectInfo.versions}">
             <c:set var="isVersionActive" value="${viewmodel.versionFilter eq version}" />
             <div class="menuEntry level-2" <c:if test="${isVersionActive}">data-active</c:if> >
+                <div class="version-icon version-${version.status}"></div>
                 <a href="projects/view?pid=${projectInfo.project.id}&vid=${version.id}">
                     <c:out value="${version.name}"/>
                 </a>
--- a/src/main/webapp/WEB-INF/jsp/versions.jsp	Thu Oct 08 20:16:47 2020 +0200
+++ b/src/main/webapp/WEB-INF/jsp/versions.jsp	Thu Oct 08 20:38:43 2020 +0200
@@ -34,7 +34,7 @@
 <%@include file="../jspf/project-header.jsp"%>
 
 <div id="tool-area">
-    <a href="./projects/versions/edit" class="button"><fmt:message key="button.version.create"/></a>
+    <a href="./projects/versions/edit?vid=-1" class="button"><fmt:message key="button.version.create"/></a>
     <a href="./projects/issues/edit?pid=${project.id}" class="button"><fmt:message key="button.issue.create"/></a>
 </div>
 
@@ -46,14 +46,13 @@
 <table id="version-list" class="datatable medskip fullwidth">
     <colgroup>
         <col>
-        <col width="20%">
-        <col width="20%">
-        <col width="10%">
-        <col width="10%">
-        <col width="10%">
-        <col width="10%">
-        <col width="10%">
-        <col width="10%">
+        <col width="28%">
+        <col width="12%">
+        <col width="12%">
+        <col width="12%">
+        <col width="12%">
+        <col width="12%">
+        <col width="12%">
     </colgroup>
     <thead>
     <tr>
@@ -68,7 +67,6 @@
     <tr>
         <th></th>
         <th><fmt:message key="version.name"/></th>
-        <th><fmt:message key="version.status" /></th>
         <th class="hcenter"><fmt:message key="issues.open" /></th>
         <th class="hcenter"><fmt:message key="issues.active" /></th>
         <th class="hcenter"><fmt:message key="issues.done" /></th>
@@ -85,9 +83,9 @@
                 <a href="projects/view?pid=${viewmodel.projectInfo.project.id}&vid=${versionInfo.version.id}">
                     <c:out value="${versionInfo.version.name}"/>
                 </a>
-            </td>
-            <td>
-                <fmt:message key="version.status.${versionInfo.version.status}"/>
+                <div class="version-tag version-${versionInfo.version.status}">
+                    <c:out value="${versionInfo.version.status}"/>
+                </div>
             </td>
             <td class="hright">${versionInfo.resolvedTotal.open}</td>
             <td class="hright">${versionInfo.resolvedTotal.active}</td>
--- a/src/main/webapp/projects.css	Thu Oct 08 20:16:47 2020 +0200
+++ b/src/main/webapp/projects.css	Thu Oct 08 20:38:43 2020 +0200
@@ -65,7 +65,7 @@
     background: green;
 }
 
-.issue-tag {
+.issue-tag, .version-tag {
     padding: .1em 2ex .1em 2ex;
     display: inline-block;
     box-sizing: border-box;
@@ -102,10 +102,36 @@
 
 .issue-tag.phase-1 {
     background: gold;
-    color: black;
 }
 
 .issue-tag.phase-2 {
     background: green;
 }
 
+div.version-icon {
+    display: inline-block;
+    width: .5em;
+    height: .5em;
+    margin-right: .25em;
+}
+
+.version-Future {
+    background: lightskyblue;
+}
+
+.version-Unreleased {
+    background: steelblue;
+}
+
+.version-Released {
+    background: limegreen;
+}
+
+.version-LTS {
+    background: gold;
+}
+
+.version-Deprecated {
+    color: lightgray;
+    background: darkgray;
+}

mercurial