diff -r 947d0f6a6a83 -r a09d5c59351a src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java --- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java Thu Oct 15 13:31:52 2020 +0200 +++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java Thu Oct 15 14:01:49 2020 +0200 @@ -60,8 +60,10 @@ private static final String SESSION_ATTR_SELECTED_PROJECT = fqn(ProjectsModule.class, "selected_project"); private static final String SESSION_ATTR_SELECTED_VERSION = fqn(ProjectsModule.class, "selected_version"); + private static final String SESSION_ATTR_SELECTED_COMPONENT = fqn(ProjectsModule.class, "selected_component"); private static final String PARAMETER_SELECTED_PROJECT = "pid"; private static final String PARAMETER_SELECTED_VERSION = "vid"; + private static final String PARAMETER_SELECTED_COMPONENT = "cid"; @Override protected String getResourceBundleName() { @@ -84,6 +86,7 @@ private void populate(ProjectView viewModel, HttpServletRequest req, DataAccessObjects dao) throws SQLException { final var projectDao = dao.getProjectDao(); final var versionDao = dao.getVersionDao(); + final var componentDao = dao.getComponentDao(); projectDao.list().stream().map(ProjectInfo::new).forEach(viewModel.getProjectList()::add); @@ -96,6 +99,7 @@ } else { final var info = new ProjectInfo(project); info.setVersions(versionDao.list(project)); + info.setComponents(componentDao.list(project)); info.setIssueSummary(projectDao.getIssueSummary(project)); viewModel.setProjectInfo(info); } @@ -103,8 +107,20 @@ // Select Version final int vid = syncParamWithSession(req, PARAMETER_SELECTED_VERSION, SESSION_ATTR_SELECTED_VERSION); - if (vid >= 0) { + if (vid > 0) { viewModel.setVersionFilter(versionDao.find(vid)); + } else { + // NULL for version means: show all unassigned + viewModel.setVersionFilter(null); + } + + // Select Component + final int cid = syncParamWithSession(req, PARAMETER_SELECTED_COMPONENT, SESSION_ATTR_SELECTED_COMPONENT); + if (cid > 0) { + viewModel.setComponentFilter(componentDao.find(cid)); + } else if (cid <= 0) { + // -1 means: filter for unassigned, null means: show all + viewModel.setComponentFilter(new Component(-1)); } }