fixes default values for version and component form

Sat, 31 Oct 2020 09:15:57 +0100

author
Mike Becker <universe@uap-core.de>
date
Sat, 31 Oct 2020 09:15:57 +0100
changeset 152
7761c37c5e61
parent 151
b3f14cd4f3ab
child 153
e914fbf4decc

fixes default values for version and component form

src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/entities/Component.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/entities/Version.kt file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/component-form.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/project-form.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/version-form.jsp file | annotate | diff | comparison | revisions
--- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Sat Oct 24 12:09:08 2020 +0200
+++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Sat Oct 31 09:15:57 2020 +0100
@@ -298,7 +298,7 @@
             return ResponseType.NONE;
         }
 
-        viewModel.setVersion(viewModel.getVersionFilter());
+        viewModel.setVersion(new Version(-1));
 
         return forwardView(req, viewModel, "version-form");
     }
--- a/src/main/kotlin/de/uapcore/lightpit/entities/Component.kt	Sat Oct 24 12:09:08 2020 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/entities/Component.kt	Sat Oct 31 09:15:57 2020 +0100
@@ -28,8 +28,8 @@
 import de.uapcore.lightpit.types.WebColor
 
 data class Component(val id: Int) {
-    var name: String? = null
-    var node: String? = null
+    var name: String = ""
+    var node: String = name
     var color = WebColor("000000")
     var ordinal = 0
     var description: String? = null
--- a/src/main/kotlin/de/uapcore/lightpit/entities/Version.kt	Sat Oct 24 12:09:08 2020 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/entities/Version.kt	Sat Oct 31 09:15:57 2020 +0100
@@ -31,13 +31,13 @@
 }
 
 data class Version(val id: Int) : Comparable<Version> {
-    var name: String = "unspecified"
+    var name: String = ""
     var node = name
     var ordinal = 0
     var status = VersionStatus.Future
 
     override fun compareTo(other: Version): Int {
-        val ord = Integer.compare(ordinal, other.ordinal)
+        val ord = ordinal.compareTo(other.ordinal)
         return if (ord == 0) {
             name.compareTo(other.name, ignoreCase = true)
         } else {
--- a/src/main/webapp/WEB-INF/jsp/component-form.jsp	Sat Oct 24 12:09:08 2020 +0200
+++ b/src/main/webapp/WEB-INF/jsp/component-form.jsp	Sat Oct 31 09:15:57 2020 +0100
@@ -52,7 +52,7 @@
         </tr>
         <tr title="<fmt:message key="node.tooltip"/>">
             <th><fmt:message key="node"/></th>
-            <td><input name="node" type="text" maxlength="20" required value="<c:out value="${component.node}"/>" /></td>
+            <td><input name="node" type="text" maxlength="20" value="<c:out value="${component.node}"/>" /></td>
         </tr>
         <tr>
             <th><fmt:message key="component.color"/></th>
--- a/src/main/webapp/WEB-INF/jsp/project-form.jsp	Sat Oct 24 12:09:08 2020 +0200
+++ b/src/main/webapp/WEB-INF/jsp/project-form.jsp	Sat Oct 31 09:15:57 2020 +0100
@@ -44,7 +44,7 @@
         </tr>
         <tr title="<fmt:message key="node.tooltip"/>">
             <th><fmt:message key="node"/></th>
-            <td><input name="node" type="text" maxlength="20" required value="<c:out value="${project.node}"/>" /></td>
+            <td><input name="node" type="text" maxlength="20" value="<c:out value="${project.node}"/>" /></td>
         </tr>
         <tr>
             <th><fmt:message key="description"/></th>
--- a/src/main/webapp/WEB-INF/jsp/version-form.jsp	Sat Oct 24 12:09:08 2020 +0200
+++ b/src/main/webapp/WEB-INF/jsp/version-form.jsp	Sat Oct 31 09:15:57 2020 +0100
@@ -52,7 +52,7 @@
         </tr>
         <tr title="<fmt:message key="node.tooltip"/>">
             <th><fmt:message key="node"/></th>
-            <td><input name="node" type="text" maxlength="20" required value="<c:out value="${version.node}"/>" /></td>
+            <td><input name="node" type="text" maxlength="20" value="<c:out value="${version.node}"/>" /></td>
         </tr>
         <tr>
             <th><fmt:message key="version.status"/></th>

mercurial