Sat, 29 Aug 2020 17:13:09 +0200
simplifies issues per version view and re-adds edit version button
1.1 --- a/src/main/java/de/uapcore/lightpit/dao/IssueDao.java Sat Aug 29 16:48:15 2020 +0200 1.2 +++ b/src/main/java/de/uapcore/lightpit/dao/IssueDao.java Sat Aug 29 17:13:09 2020 +0200 1.3 @@ -50,8 +50,9 @@ 1.4 1.5 /** 1.6 * Lists all issues that are somehow related to the specified version. 1.7 + * If version is null, search for issues that are not related to any version. 1.8 * 1.9 - * @param version the version 1.10 + * @param version the version or null 1.11 * @return a list of issues 1.12 * @throws SQLException on any kind of SQL error 1.13 */
2.1 --- a/src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java Sat Aug 29 16:48:15 2020 +0200 2.2 +++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java Sat Aug 29 17:13:09 2020 +0200 2.3 @@ -54,7 +54,7 @@ 2.4 "userid, username, givenname, lastname, mail, " + 2.5 "created, updated, eta " + 2.6 "from lpit_issue i " + 2.7 - "left join lpit_project p on project = projectid " + 2.8 + "join lpit_project p on project = projectid " + 2.9 "left join lpit_user on userid = assignee " + 2.10 "where project = ? "+ 2.11 "order by eta asc, updated desc"); 2.12 @@ -67,10 +67,10 @@ 2.13 "userid, username, givenname, lastname, mail, " + 2.14 "created, updated, eta " + 2.15 "from lpit_issue i " + 2.16 - "join issue_version using (issueid) "+ 2.17 - "left join lpit_project p on project = projectid " + 2.18 + "join lpit_project p on project = projectid " + 2.19 + "left join issue_version using (issueid) "+ 2.20 "left join lpit_user on userid = assignee " + 2.21 - "where versionid = ? "+ 2.22 + "where coalesce(versionid,-1) = ? "+ 2.23 "order by eta asc, updated desc" 2.24 ); 2.25 2.26 @@ -222,7 +222,7 @@ 2.27 2.28 @Override 2.29 public List<Issue> list(Version version) throws SQLException { 2.30 - return list(listForVersion, version.getId()); 2.31 + return list(listForVersion, version == null ? -1 : version.getId()); 2.32 } 2.33 2.34 @Override
3.1 --- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java Sat Aug 29 16:48:15 2020 +0200 3.2 +++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java Sat Aug 29 17:13:09 2020 +0200 3.3 @@ -43,7 +43,6 @@ 3.4 import java.sql.Date; 3.5 import java.sql.SQLException; 3.6 import java.util.ArrayList; 3.7 -import java.util.List; 3.8 import java.util.NoSuchElementException; 3.9 import java.util.Optional; 3.10 import java.util.stream.Collectors; 3.11 @@ -112,7 +111,7 @@ 3.12 final var level2 = new ArrayList<MenuEntry>(); 3.13 { 3.14 final var entry = new MenuEntry( 3.15 - new ResourceKey(getResourceBundleName(), "filter.all"), 3.16 + new ResourceKey(getResourceBundleName(), "filter.none"), 3.17 "projects/view?" + queryParams(proj, null) 3.18 ); 3.19 if (viewModel.getVersionFilter() == null) entry.setActive(true); 3.20 @@ -257,17 +256,12 @@ 3.21 3.22 final var issueDao = dao.getIssueDao(); 3.23 3.24 - final var project = viewModel.getProjectInfo().getProject(); 3.25 + final var version = viewModel.getVersionFilter(); 3.26 3.27 final var detailView = viewModel.getProjectDetails(); 3.28 - final var issues = issueDao.list(project); 3.29 + final var issues = issueDao.list(version); 3.30 for (var issue : issues) issueDao.joinVersionInformation(issue); 3.31 - detailView.setIssues(issues); 3.32 - if (viewModel.getVersionFilter() != null) { 3.33 - detailView.updateVersionInfo(List.of(viewModel.getVersionFilter())); 3.34 - } else { 3.35 - detailView.updateVersionInfo(viewModel.getProjectInfo().getVersions()); 3.36 - } 3.37 + detailView.updateDetails(issues, version); 3.38 3.39 return forwardView(req, viewModel, "project-details"); 3.40 }
4.1 --- a/src/main/java/de/uapcore/lightpit/viewmodel/ProjectDetails.java Sat Aug 29 16:48:15 2020 +0200 4.2 +++ b/src/main/java/de/uapcore/lightpit/viewmodel/ProjectDetails.java Sat Aug 29 17:13:09 2020 +0200 4.3 @@ -4,54 +4,34 @@ 4.4 import de.uapcore.lightpit.entities.IssueSummary; 4.5 import de.uapcore.lightpit.entities.Version; 4.6 4.7 -import java.util.ArrayList; 4.8 -import java.util.Collection; 4.9 -import java.util.Collections; 4.10 import java.util.List; 4.11 4.12 public class ProjectDetails { 4.13 4.14 - private List<VersionInfo> versionInfos = Collections.emptyList(); 4.15 + private VersionInfo versionInfo = null; 4.16 4.17 - private List<Issue> issues = Collections.emptyList(); 4.18 - private List<Issue> issuesWithoutVersion; 4.19 - private IssueSummary issuesWithoutVersionTotal; 4.20 + private List<Issue> issues; 4.21 + private IssueSummary issueSummary; 4.22 + 4.23 + public void updateDetails(List<Issue> issues, Version version) { 4.24 + this.issues = issues; 4.25 + issueSummary = new IssueSummary(); 4.26 + issues.forEach(issueSummary::add); 4.27 + if (version != null) { 4.28 + versionInfo = new VersionInfo(version); 4.29 + versionInfo.collectIssues(issues); 4.30 + } 4.31 + } 4.32 4.33 public List<Issue> getIssues() { 4.34 return issues; 4.35 } 4.36 4.37 - public void setIssues(List<Issue> issues) { 4.38 - this.issues = issues; 4.39 - issuesWithoutVersion = new ArrayList<>(); 4.40 - issuesWithoutVersionTotal = new IssueSummary(); 4.41 - for (Issue issue : issues) { 4.42 - // we want to list all issues that do not have a target version 4.43 - if (issue.getResolvedVersions().isEmpty()) { 4.44 - issuesWithoutVersion.add(issue); 4.45 - issuesWithoutVersionTotal.add(issue); 4.46 - } 4.47 - } 4.48 + public IssueSummary getIssueSummary() { 4.49 + return issueSummary; 4.50 } 4.51 4.52 - public void updateVersionInfo(Collection<Version> versions) { 4.53 - versionInfos = new ArrayList<>(); 4.54 - for (Version version : versions) { 4.55 - final var info = new VersionInfo(version); 4.56 - info.collectIssues(issues); 4.57 - versionInfos.add(info); 4.58 - } 4.59 - } 4.60 - 4.61 - public List<Issue> getIssuesWithoutVersion() { 4.62 - return issuesWithoutVersion; 4.63 - } 4.64 - 4.65 - public IssueSummary getIssuesWithoutVersionTotal() { 4.66 - return issuesWithoutVersionTotal; 4.67 - } 4.68 - 4.69 - public List<VersionInfo> getVersionInfos() { 4.70 - return versionInfos; 4.71 + public VersionInfo getVersionInfo() { 4.72 + return versionInfo; 4.73 } 4.74 }
5.1 --- a/src/main/resources/localization/projects.properties Sat Aug 29 16:48:15 2020 +0200 5.2 +++ b/src/main/resources/localization/projects.properties Sat Aug 29 17:13:09 2020 +0200 5.3 @@ -32,6 +32,7 @@ 5.4 no-projects=Welcome to LightPIT. Start off by creating a new project! 5.5 5.6 filter.all=all 5.7 +filter.none=none 5.8 5.9 menu.versions=Versions 5.10 menu.issues=Issues
6.1 --- a/src/main/resources/localization/projects_de.properties Sat Aug 29 16:48:15 2020 +0200 6.2 +++ b/src/main/resources/localization/projects_de.properties Sat Aug 29 17:13:09 2020 +0200 6.3 @@ -32,6 +32,7 @@ 6.4 no-projects=Wilkommen bei LightPIT. Beginnen Sie mit der Erstellung eines Projektes! 6.5 6.6 filter.all=alle 6.7 +filter.none=keine 6.8 6.9 menu.versions=Versionen 6.10 menu.issues=Vorg\u00e4nge
7.1 --- a/src/main/webapp/WEB-INF/jsp/project-details.jsp Sat Aug 29 16:48:15 2020 +0200 7.2 +++ b/src/main/webapp/WEB-INF/jsp/project-details.jsp Sat Aug 29 17:13:09 2020 +0200 7.3 @@ -34,6 +34,9 @@ 7.4 <%@include file="../jspf/project-header.jsp"%> 7.5 7.6 <div id="tool-area"> 7.7 + <c:if test="${not empty viewmodel.versionFilter}"> 7.8 + <a href="./projects/versions/edit?vid=${viewmodel.versionFilter.id}" class="button"><fmt:message key="button.version.edit"/></a> 7.9 + </c:if> 7.10 <a href="./projects/versions/edit" class="button"><fmt:message key="button.version.create"/></a> 7.11 <a href="./projects/issues/edit?pid=${project.id}" class="button"><fmt:message key="button.issue.create"/></a> 7.12 </div> 7.13 @@ -43,14 +46,8 @@ 7.14 <c:set var="summary" value="${viewmodel.projectInfo.issueSummary}" /> 7.15 <%@include file="../jspf/issue-summary.jsp"%> 7.16 7.17 -<h2><fmt:message key="issue.without-version" /></h2> 7.18 - 7.19 -<c:set var="issues" value="${viewmodel.projectDetails.issuesWithoutVersion}"/> 7.20 -<c:set var="summary" value="${viewmodel.projectDetails.issuesWithoutVersionTotal}" /> 7.21 -<%@include file="../jspf/issue-summary.jsp"%> 7.22 -<%@include file="../jspf/issue-list.jsp"%> 7.23 - 7.24 -<c:forEach var="versionInfo" items="${viewmodel.projectDetails.versionInfos}"> 7.25 +<c:if test="${not empty viewmodel.versionFilter}"> 7.26 + <c:set var="versionInfo" value="${viewmodel.projectDetails.versionInfo}"/> 7.27 <h2> 7.28 <fmt:message key="version.label" /> <c:out value="${versionInfo.version.name}" /> - <fmt:message key="version.status.${versionInfo.version.status}"/> 7.29 </h2> 7.30 @@ -70,4 +67,15 @@ 7.31 <%@include file="../jspf/issue-summary.jsp"%> 7.32 <%@include file="../jspf/issue-list.jsp"%> 7.33 </c:if> 7.34 -</c:forEach> 7.35 \ No newline at end of file 7.36 +</c:if> 7.37 +<c:if test="${empty viewmodel.versionFilter}"> 7.38 + <h2> 7.39 + <fmt:message key="issue.without-version" /> 7.40 + </h2> 7.41 + <c:set var="summary" value="${viewmodel.projectDetails.issueSummary}"/> 7.42 + <c:set var="issues" value="${viewmodel.projectDetails.issues}"/> 7.43 + <%@include file="../jspf/issue-summary.jsp"%> 7.44 + <c:if test="${not empty issues}"> 7.45 + <%@include file="../jspf/issue-list.jsp"%> 7.46 + </c:if> 7.47 +</c:if>
8.1 --- a/src/main/webapp/WEB-INF/jsp/version.jsp Sat Aug 29 16:48:15 2020 +0200 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,62 +0,0 @@ 8.4 -<%-- 8.5 -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 8.6 - 8.7 -Copyright 2018 Mike Becker. All rights reserved. 8.8 - 8.9 -Redistribution and use in source and binary forms, with or without 8.10 -modification, are permitted provided that the following conditions are met: 8.11 - 8.12 -1. Redistributions of source code must retain the above copyright 8.13 -notice, this list of conditions and the following disclaimer. 8.14 - 8.15 -2. Redistributions in binary form must reproduce the above copyright 8.16 -notice, this list of conditions and the following disclaimer in the 8.17 -documentation and/or other materials provided with the distribution. 8.18 - 8.19 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 8.20 -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 8.21 -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 8.22 -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 8.23 -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 8.24 -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 8.25 -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 8.26 -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 8.27 -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 8.28 -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 8.29 ---%> 8.30 -<%@page pageEncoding="UTF-8" %> 8.31 -<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 8.32 -<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 8.33 - 8.34 -<jsp:useBean id="viewmodel" type="de.uapcore.lightpit.viewmodel.VersionView" scope="request"/> 8.35 -<c:set var="version" scope="page" value="${viewmodel.versionInfo.version}"/> 8.36 - 8.37 -<c:set var="project" scope="page" value="${version.project}"/> 8.38 -<%@include file="../jspf/project-header.jsp"%> 8.39 - 8.40 - 8.41 -<div id="tool-area"> 8.42 - <a href="./projects/issues/edit?pid=${project.id}" class="button"><fmt:message key="button.issue.create"/></a> 8.43 - <a href="./projects/versions/edit?vid=${version.id}" class="button"><fmt:message key="button.version.edit"/></a> 8.44 -</div> 8.45 - 8.46 -<h2> 8.47 -<fmt:message key="version.label" /> <c:out value="${version.name}" /> - <fmt:message key="version.status.${version.status}"/> 8.48 -</h2> 8.49 - 8.50 -<c:if test="${not empty viewmodel.versionInfo.resolved}"> 8.51 - <h3><fmt:message key="issues.resolved"/> </h3> 8.52 - <c:set var="summary" value="${viewmodel.versionInfo.resolvedTotal}"/> 8.53 - <c:set var="issues" value="${viewmodel.versionInfo.resolved}"/> 8.54 - <%@include file="../jspf/issue-summary.jsp"%> 8.55 - <%@include file="../jspf/issue-list.jsp"%> 8.56 -</c:if> 8.57 - 8.58 -<c:if test="${not empty viewmodel.versionInfo.reported}"> 8.59 - <h3><fmt:message key="issues.reported"/> </h3> 8.60 - <c:set var="summary" value="${viewmodel.versionInfo.reportedTotal}"/> 8.61 - <c:set var="issues" value="${viewmodel.versionInfo.reported}"/> 8.62 - <%@include file="../jspf/issue-summary.jsp"%> 8.63 - <%@include file="../jspf/issue-list.jsp"%> 8.64 -</c:if> 8.65 -