# HG changeset patch # User Mike Becker # Date 1598713989 -7200 # Node ID 250c5cbb8276e9ae3548d51859903e69ae72b568 # Parent 8be80ea4f52bf2c01f7fc7df2d974b68ea1b14e7 simplifies issues per version view and re-adds edit version button diff -r 8be80ea4f52b -r 250c5cbb8276 src/main/java/de/uapcore/lightpit/dao/IssueDao.java --- a/src/main/java/de/uapcore/lightpit/dao/IssueDao.java Sat Aug 29 16:48:15 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/dao/IssueDao.java Sat Aug 29 17:13:09 2020 +0200 @@ -50,8 +50,9 @@ /** * Lists all issues that are somehow related to the specified version. + * If version is null, search for issues that are not related to any version. * - * @param version the version + * @param version the version or null * @return a list of issues * @throws SQLException on any kind of SQL error */ diff -r 8be80ea4f52b -r 250c5cbb8276 src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java --- a/src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java Sat Aug 29 16:48:15 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java Sat Aug 29 17:13:09 2020 +0200 @@ -54,7 +54,7 @@ "userid, username, givenname, lastname, mail, " + "created, updated, eta " + "from lpit_issue i " + - "left join lpit_project p on project = projectid " + + "join lpit_project p on project = projectid " + "left join lpit_user on userid = assignee " + "where project = ? "+ "order by eta asc, updated desc"); @@ -67,10 +67,10 @@ "userid, username, givenname, lastname, mail, " + "created, updated, eta " + "from lpit_issue i " + - "join issue_version using (issueid) "+ - "left join lpit_project p on project = projectid " + + "join lpit_project p on project = projectid " + + "left join issue_version using (issueid) "+ "left join lpit_user on userid = assignee " + - "where versionid = ? "+ + "where coalesce(versionid,-1) = ? "+ "order by eta asc, updated desc" ); @@ -222,7 +222,7 @@ @Override public List list(Version version) throws SQLException { - return list(listForVersion, version.getId()); + return list(listForVersion, version == null ? -1 : version.getId()); } @Override diff -r 8be80ea4f52b -r 250c5cbb8276 src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java --- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java Sat Aug 29 16:48:15 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java Sat Aug 29 17:13:09 2020 +0200 @@ -43,7 +43,6 @@ import java.sql.Date; import java.sql.SQLException; import java.util.ArrayList; -import java.util.List; import java.util.NoSuchElementException; import java.util.Optional; import java.util.stream.Collectors; @@ -112,7 +111,7 @@ final var level2 = new ArrayList(); { final var entry = new MenuEntry( - new ResourceKey(getResourceBundleName(), "filter.all"), + new ResourceKey(getResourceBundleName(), "filter.none"), "projects/view?" + queryParams(proj, null) ); if (viewModel.getVersionFilter() == null) entry.setActive(true); @@ -257,17 +256,12 @@ final var issueDao = dao.getIssueDao(); - final var project = viewModel.getProjectInfo().getProject(); + final var version = viewModel.getVersionFilter(); final var detailView = viewModel.getProjectDetails(); - final var issues = issueDao.list(project); + final var issues = issueDao.list(version); for (var issue : issues) issueDao.joinVersionInformation(issue); - detailView.setIssues(issues); - if (viewModel.getVersionFilter() != null) { - detailView.updateVersionInfo(List.of(viewModel.getVersionFilter())); - } else { - detailView.updateVersionInfo(viewModel.getProjectInfo().getVersions()); - } + detailView.updateDetails(issues, version); return forwardView(req, viewModel, "project-details"); } diff -r 8be80ea4f52b -r 250c5cbb8276 src/main/java/de/uapcore/lightpit/viewmodel/ProjectDetails.java --- a/src/main/java/de/uapcore/lightpit/viewmodel/ProjectDetails.java Sat Aug 29 16:48:15 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/viewmodel/ProjectDetails.java Sat Aug 29 17:13:09 2020 +0200 @@ -4,54 +4,34 @@ import de.uapcore.lightpit.entities.IssueSummary; import de.uapcore.lightpit.entities.Version; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; import java.util.List; public class ProjectDetails { - private List versionInfos = Collections.emptyList(); + private VersionInfo versionInfo = null; + + private List issues; + private IssueSummary issueSummary; - private List issues = Collections.emptyList(); - private List issuesWithoutVersion; - private IssueSummary issuesWithoutVersionTotal; + public void updateDetails(List issues, Version version) { + this.issues = issues; + issueSummary = new IssueSummary(); + issues.forEach(issueSummary::add); + if (version != null) { + versionInfo = new VersionInfo(version); + versionInfo.collectIssues(issues); + } + } public List getIssues() { return issues; } - public void setIssues(List issues) { - this.issues = issues; - issuesWithoutVersion = new ArrayList<>(); - issuesWithoutVersionTotal = new IssueSummary(); - for (Issue issue : issues) { - // we want to list all issues that do not have a target version - if (issue.getResolvedVersions().isEmpty()) { - issuesWithoutVersion.add(issue); - issuesWithoutVersionTotal.add(issue); - } - } + public IssueSummary getIssueSummary() { + return issueSummary; } - public void updateVersionInfo(Collection versions) { - versionInfos = new ArrayList<>(); - for (Version version : versions) { - final var info = new VersionInfo(version); - info.collectIssues(issues); - versionInfos.add(info); - } - } - - public List getIssuesWithoutVersion() { - return issuesWithoutVersion; - } - - public IssueSummary getIssuesWithoutVersionTotal() { - return issuesWithoutVersionTotal; - } - - public List getVersionInfos() { - return versionInfos; + public VersionInfo getVersionInfo() { + return versionInfo; } } diff -r 8be80ea4f52b -r 250c5cbb8276 src/main/resources/localization/projects.properties --- a/src/main/resources/localization/projects.properties Sat Aug 29 16:48:15 2020 +0200 +++ b/src/main/resources/localization/projects.properties Sat Aug 29 17:13:09 2020 +0200 @@ -32,6 +32,7 @@ no-projects=Welcome to LightPIT. Start off by creating a new project! filter.all=all +filter.none=none menu.versions=Versions menu.issues=Issues diff -r 8be80ea4f52b -r 250c5cbb8276 src/main/resources/localization/projects_de.properties --- a/src/main/resources/localization/projects_de.properties Sat Aug 29 16:48:15 2020 +0200 +++ b/src/main/resources/localization/projects_de.properties Sat Aug 29 17:13:09 2020 +0200 @@ -32,6 +32,7 @@ no-projects=Wilkommen bei LightPIT. Beginnen Sie mit der Erstellung eines Projektes! filter.all=alle +filter.none=keine menu.versions=Versionen menu.issues=Vorg\u00e4nge diff -r 8be80ea4f52b -r 250c5cbb8276 src/main/webapp/WEB-INF/jsp/project-details.jsp --- a/src/main/webapp/WEB-INF/jsp/project-details.jsp Sat Aug 29 16:48:15 2020 +0200 +++ b/src/main/webapp/WEB-INF/jsp/project-details.jsp Sat Aug 29 17:13:09 2020 +0200 @@ -34,6 +34,9 @@ <%@include file="../jspf/project-header.jsp"%>
+ + +
@@ -43,14 +46,8 @@ <%@include file="../jspf/issue-summary.jsp"%> -

- - - -<%@include file="../jspf/issue-summary.jsp"%> -<%@include file="../jspf/issue-list.jsp"%> - - + +

-

@@ -70,4 +67,15 @@ <%@include file="../jspf/issue-summary.jsp"%> <%@include file="../jspf/issue-list.jsp"%>
-
\ No newline at end of file + + +

+ +

+ + + <%@include file="../jspf/issue-summary.jsp"%> + + <%@include file="../jspf/issue-list.jsp"%> + +
diff -r 8be80ea4f52b -r 250c5cbb8276 src/main/webapp/WEB-INF/jsp/version.jsp --- a/src/main/webapp/WEB-INF/jsp/version.jsp Sat Aug 29 16:48:15 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -<%-- -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - -Copyright 2018 Mike Becker. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---%> -<%@page pageEncoding="UTF-8" %> -<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> - - - - - -<%@include file="../jspf/project-header.jsp"%> - - -
- - -
- -

- - -

- - -

- - - <%@include file="../jspf/issue-summary.jsp"%> - <%@include file="../jspf/issue-list.jsp"%> -
- - -

- - - <%@include file="../jspf/issue-summary.jsp"%> - <%@include file="../jspf/issue-list.jsp"%> -
-