Wed, 18 Aug 2021 15:30:49 +0200
#162 adds active flag to component
1.1 --- a/setup/postgres/psql_create_tables.sql Wed Aug 18 15:04:59 2021 +0200 1.2 +++ b/setup/postgres/psql_create_tables.sql Wed Aug 18 15:30:49 2021 +0200 1.3 @@ -52,7 +52,8 @@ 1.4 color char(6) not null default '000000', 1.5 ordinal integer not null default 0, 1.6 description text, 1.7 - lead integer references lpit_user (userid) 1.8 + lead integer references lpit_user (userid), 1.9 + active boolean not null default true 1.10 ); 1.11 1.12 create unique index lpit_component_node_unique on lpit_component (project, node);
2.1 --- a/src/main/kotlin/de/uapcore/lightpit/RequestMapping.kt Wed Aug 18 15:04:59 2021 +0200 2.2 +++ b/src/main/kotlin/de/uapcore/lightpit/RequestMapping.kt Wed Aug 18 15:30:49 2021 +0200 2.3 @@ -304,4 +304,12 @@ 2.4 } 2.5 } 2.6 2.7 +fun boolValidator(input: String?): ValidationResult<Boolean> { 2.8 + return if (input.isNullOrBlank()) { 2.9 + ValidatedValue(false) 2.10 + } else { 2.11 + ValidatedValue(!(input.equals("false", true) || input == "0")) 2.12 + } 2.13 +} 2.14 + 2.15 // </editor-fold>
3.1 --- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Wed Aug 18 15:04:59 2021 +0200 3.2 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Wed Aug 18 15:30:49 2021 +0200 3.3 @@ -249,7 +249,7 @@ 3.4 //language=SQL 3.5 private val componentQuery = 3.6 """ 3.7 - select id, project, name, node, color, ordinal, description, 3.8 + select id, project, name, node, color, ordinal, description, active, 3.9 userid, username, givenname, lastname, mail 3.10 from lpit_component 3.11 left join lpit_user on lead = userid 3.12 @@ -266,6 +266,7 @@ 3.13 } 3.14 ordinal = getInt("ordinal") 3.15 description = getString("description") 3.16 + active = getBoolean("active") 3.17 lead = extractOptionalUser() 3.18 } 3.19 3.20 @@ -277,6 +278,7 @@ 3.21 setStringSafe(i++, color.hex) 3.22 setInt(i++, ordinal) 3.23 setStringOrNull(i++, description) 3.24 + setBoolean(i++, active) 3.25 setIntOrNull(i++, lead?.id) 3.26 return i 3.27 } 3.28 @@ -302,13 +304,13 @@ 3.29 from lpit_component c 3.30 left join issues i on c.id = i.component 3.31 ) 3.32 - select c.id, project, name, node, color, ordinal, description, 3.33 + select c.id, project, name, node, color, ordinal, description, active, 3.34 userid, username, givenname, lastname, mail, 3.35 - open.total as open, active.total as active, done.total as done 3.36 + open.total as open, wip.total as wip, done.total as done 3.37 from lpit_component c 3.38 left join lpit_user on lead = userid 3.39 left join summary open on c.id = open.id and open.phase = 0 3.40 - left join summary active on c.id = active.id and active.phase = 1 3.41 + left join summary wip on c.id = wip.id and wip.phase = 1 3.42 left join summary done on c.id = done.id and done.phase = 2 3.43 where c.project = ? 3.44 order by ordinal, name 3.45 @@ -318,7 +320,7 @@ 3.46 queryAll { rs -> 3.47 ComponentSummary(rs.extractComponent()).apply { 3.48 issueSummary.open = rs.getInt("open") 3.49 - issueSummary.active = rs.getInt("active") 3.50 + issueSummary.active = rs.getInt("wip") 3.51 issueSummary.done = rs.getInt("done") 3.52 } 3.53 } 3.54 @@ -338,7 +340,7 @@ 3.55 } 3.56 3.57 override fun insertComponent(component: Component) { 3.58 - withStatement("insert into lpit_component (name, node, color, ordinal, description, lead, project) values (?, ?, ?, ?, ?, ?, ?)") { 3.59 + withStatement("insert into lpit_component (name, node, color, ordinal, description, active, lead, project) values (?, ?, ?, ?, ?, ?, ?, ?)") { 3.60 val col = setComponent(1, component) 3.61 setInt(col, component.projectid) 3.62 executeUpdate() 3.63 @@ -346,7 +348,7 @@ 3.64 } 3.65 3.66 override fun updateComponent(component: Component) { 3.67 - withStatement("update lpit_component set name = ?, node = ?, color = ?, ordinal = ?, description = ?, lead = ? where id = ?") { 3.68 + withStatement("update lpit_component set name = ?, node = ?, color = ?, ordinal = ?, description = ?, active = ?, lead = ? where id = ?") { 3.69 val col = setComponent(1, component) 3.70 setInt(col, component.id) 3.71 executeUpdate()
4.1 --- a/src/main/kotlin/de/uapcore/lightpit/entities/Component.kt Wed Aug 18 15:04:59 2021 +0200 4.2 +++ b/src/main/kotlin/de/uapcore/lightpit/entities/Component.kt Wed Aug 18 15:30:49 2021 +0200 4.3 @@ -34,4 +34,5 @@ 4.4 var color = WebColor("000000") 4.5 var description: String? = null 4.6 var lead: User? = null 4.7 + var active = true 4.8 } 4.9 \ No newline at end of file
5.1 --- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Wed Aug 18 15:04:59 2021 +0200 5.2 +++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt Wed Aug 18 15:30:49 2021 +0200 5.3 @@ -27,6 +27,7 @@ 5.4 5.5 import de.uapcore.lightpit.AbstractServlet 5.6 import de.uapcore.lightpit.HttpRequest 5.7 +import de.uapcore.lightpit.boolValidator 5.8 import de.uapcore.lightpit.dao.DataAccessObject 5.9 import de.uapcore.lightpit.dateOptValidator 5.10 import de.uapcore.lightpit.entities.* 5.11 @@ -419,6 +420,8 @@ 5.12 ordinal = http.param("ordinal")?.toIntOrNull() ?: 0 5.13 color = WebColor(http.param("color") ?: "#000000") 5.14 description = http.param("description") 5.15 + // TODO: process error message 5.16 + active = http.param("active", ::boolValidator, true, mutableListOf()) 5.17 lead = (http.param("lead")?.toIntOrNull() ?: -1).let { 5.18 if (it < 0) null else dao.findUser(it) 5.19 }
6.1 --- a/src/main/kotlin/de/uapcore/lightpit/viewmodel/NavMenus.kt Wed Aug 18 15:04:59 2021 +0200 6.2 +++ b/src/main/kotlin/de/uapcore/lightpit/viewmodel/NavMenus.kt Wed Aug 18 15:30:49 2021 +0200 6.3 @@ -113,6 +113,7 @@ 6.4 ) 6.5 ) 6.6 for (component in components) { 6.7 + if (!component.active && component != selectedComponent) continue 6.8 yield( 6.9 NavMenuEntry( 6.10 level = 2,
7.1 --- a/src/main/resources/localization/strings.properties Wed Aug 18 15:04:59 2021 +0200 7.2 +++ b/src/main/resources/localization/strings.properties Wed Aug 18 15:30:49 2021 +0200 7.3 @@ -43,6 +43,7 @@ 7.4 button.version.edit=Edit Version 7.5 commit.redirect-link=If redirection does not work, click the following link: 7.6 commit.success=Operation successful - you will be redirected in a second. 7.7 +component.active=Active 7.8 component.color=Color 7.9 component.lead=Lead 7.10 component=Component
8.1 --- a/src/main/resources/localization/strings_de.properties Wed Aug 18 15:04:59 2021 +0200 8.2 +++ b/src/main/resources/localization/strings_de.properties Wed Aug 18 15:30:49 2021 +0200 8.3 @@ -42,6 +42,7 @@ 8.4 button.version.edit=Version Bearbeiten 8.5 commit.redirect-link=Falls die Weiterleitung nicht klappt, klicken Sie bitte hier: 8.6 commit.success=Operation erfolgreich - Sie werden jeden Moment weitergeleitet. 8.7 +component.active=Aktiv 8.8 component.color=Farbe 8.9 component.lead=Leitung 8.10 component=Komponente
9.1 --- a/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf Wed Aug 18 15:04:59 2021 +0200 9.2 +++ b/src/main/webapp/WEB-INF/changelogs/changelog-de.jspf Wed Aug 18 15:30:49 2021 +0200 9.3 @@ -27,6 +27,7 @@ 9.4 <h3>Version 1.0 (Vorschau)</h3> 9.5 9.6 <ul> 9.7 + <li>Möglichkeit zum Deaktivieren einer Komponente hinzugefügt.</li> 9.8 <li>Datum der Veröffentlichung und des Supportendes zu Versionen hinzugefügt.</li> 9.9 <li>Gesamtanzahl der Kommentare wird nun angezeigt.</li> 9.10 <li>Spalte für zugewiesener Entwickler zu den Vorgangstabellen hinzugefügt.</li>
10.1 --- a/src/main/webapp/WEB-INF/changelogs/changelog.jspf Wed Aug 18 15:04:59 2021 +0200 10.2 +++ b/src/main/webapp/WEB-INF/changelogs/changelog.jspf Wed Aug 18 15:30:49 2021 +0200 10.3 @@ -27,6 +27,7 @@ 10.4 <h3>Version 1.0 (snapshot)</h3> 10.5 10.6 <ul> 10.7 + <li>Adds possibility to deactivate a component.</li> 10.8 <li>Adds release and end of life dates to versions.</li> 10.9 <li>Adds the total number of comments to the caption.</li> 10.10 <li>Adds assignee to the issue overview tables.</li>
11.1 --- a/src/main/webapp/WEB-INF/jsp/component-form.jsp Wed Aug 18 15:04:59 2021 +0200 11.2 +++ b/src/main/webapp/WEB-INF/jsp/component-form.jsp Wed Aug 18 15:30:49 2021 +0200 11.3 @@ -47,21 +47,21 @@ 11.4 </td> 11.5 </tr> 11.6 <tr> 11.7 - <th><fmt:message key="component"/></th> 11.8 - <td><input name="name" type="text" maxlength="20" required value="<c:out value="${component.name}"/>" /></td> 11.9 + <th><label for="component-name"><fmt:message key="component"/></label></th> 11.10 + <td><input id="component-name" name="name" type="text" maxlength="20" required value="<c:out value="${component.name}"/>" /></td> 11.11 </tr> 11.12 <tr title="<fmt:message key="node.tooltip"/>"> 11.13 - <th><fmt:message key="node"/></th> 11.14 - <td><input name="node" type="text" maxlength="20" value="<c:out value="${component.node}"/>" /></td> 11.15 + <th><label for="component-node"><fmt:message key="node"/></label></th> 11.16 + <td><input id="component-node" ame="node" type="text" maxlength="20" value="<c:out value="${component.node}"/>" /></td> 11.17 </tr> 11.18 <tr> 11.19 - <th><fmt:message key="component.color"/></th> 11.20 - <td><input name="color" type="color" required value="${component.color}" /></td> 11.21 + <th><label for="component-color"><fmt:message key="component.color"/></label></th> 11.22 + <td><input id="component-color" name="color" type="color" required value="${component.color}" /></td> 11.23 </tr> 11.24 <tr> 11.25 - <th><fmt:message key="component.lead"/></th> 11.26 + <th><label for="component-lead"><fmt:message key="component.lead"/></label></th> 11.27 <td> 11.28 - <select name="lead"> 11.29 + <select id="component-lead" name="lead"> 11.30 <option value="-1"><fmt:message key="placeholder.null-lead"/></option> 11.31 <c:forEach var="user" items="${viewmodel.users}"> 11.32 <option 11.33 @@ -72,15 +72,21 @@ 11.34 </td> 11.35 </tr> 11.36 <tr title="<fmt:message key="ordinal.tooltip" />"> 11.37 - <th><fmt:message key="ordinal"/></th> 11.38 + <th><label for="component-ordinal"><fmt:message key="ordinal"/></label></th> 11.39 <td> 11.40 - <input name="ordinal" type="number" value="${component.ordinal}"/> 11.41 + <input id="component-ordinal" name="ordinal" type="number" value="${component.ordinal}"/> 11.42 </td> 11.43 </tr> 11.44 <tr> 11.45 - <th class="vtop"><fmt:message key="description"/></th> 11.46 + <th class="vtop"><label for="component-description"><fmt:message key="description"/></label></th> 11.47 <td> 11.48 - <textarea name="description" rows="5"><c:out value="${component.description}"/></textarea> 11.49 + <textarea id="component-description" name="description" rows="5"><c:out value="${component.description}"/></textarea> 11.50 + </td> 11.51 + </tr> 11.52 + <tr> 11.53 + <th><label for="component-active"><fmt:message key="component.active"/></label></th> 11.54 + <td> 11.55 + <input type="checkbox" id="component-active" name="active" <c:if test="${component.active}">checked</c:if> > 11.56 </td> 11.57 </tr> 11.58 </tbody>
12.1 --- a/src/main/webapp/WEB-INF/jsp/components.jsp Wed Aug 18 15:04:59 2021 +0200 12.2 +++ b/src/main/webapp/WEB-INF/jsp/components.jsp Wed Aug 18 15:30:49 2021 +0200 12.3 @@ -75,7 +75,9 @@ 12.4 <td rowspan="2" style="width: 2em;"><a href="./projects/${project.node}/components/${componentInfo.component.node}/edit">✎</a></td> 12.5 <td rowspan="2"> 12.6 <div class="navmenu-icon" style="background-color: ${componentInfo.component.color}"></div> 12.7 - <a href="./projects/${project.node}/issues/-/${componentInfo.component.node}/"> 12.8 + <a href="./projects/${project.node}/issues/-/${componentInfo.component.node}/" 12.9 + <c:if test="${not componentInfo.component.active}">style="text-decoration: line-through;"</c:if> 12.10 + > 12.11 <c:out value="${componentInfo.component.name}"/> 12.12 </a> 12.13 </td>
13.1 --- a/src/main/webapp/WEB-INF/jsp/issue-form.jsp Wed Aug 18 15:04:59 2021 +0200 13.2 +++ b/src/main/webapp/WEB-INF/jsp/issue-form.jsp Wed Aug 18 15:30:49 2021 +0200 13.3 @@ -57,9 +57,12 @@ 13.4 <select id="issue-component" name="component"> 13.5 <option value="-1"><fmt:message key="placeholder.null-component"/></option> 13.6 <c:forEach var="comp" items="${viewmodel.components}"> 13.7 + <c:set var="isSelectedComponent" value="${not empty issue.component and comp eq issue.component}" scope="page"/> 13.8 + <c:if test="${isSelectedComponent or comp.active}"> 13.9 <option 13.10 - <c:if test="${not empty issue.component and comp eq issue.component}">selected</c:if> 13.11 + <c:if test="${isSelectedComponent}">selected</c:if> 13.12 value="${comp.id}"><c:out value="${comp.name}"/></option> 13.13 + </c:if> 13.14 </c:forEach> 13.15 </select> 13.16 </td>