mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-06-08 21:38:21 +00:00
WIP
This commit is contained in:
parent
86fecf45b7
commit
3bd17e6e84
@ -61,7 +61,8 @@ import tech.ailef.dbadmin.misc.Utils;
|
||||
* - SQL console (PRO)
|
||||
* - JPA Validation (PRO)
|
||||
* - Logging
|
||||
* - ERROR 500: http://localhost:8080/dbadmin/model/tech.ailef.dbadmin.test.models.Order?query=2021
|
||||
* - TODO FIX: list model page crash
|
||||
* EDIT error on table product
|
||||
* - Logs in web ui
|
||||
* - Tests: AutocompleteController, REST API, create/edit
|
||||
*/
|
||||
|
@ -199,8 +199,13 @@ public class DbObject {
|
||||
String capitalize = Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
|
||||
Method[] methods = instance.getClass().getDeclaredMethods();
|
||||
|
||||
String prefix = "get";
|
||||
if (schema.getFieldByJavaName(fieldName).getType() == DbFieldType.BOOLEAN) {
|
||||
prefix = "is";
|
||||
}
|
||||
|
||||
for (Method m : methods) {
|
||||
if (m.getName().equals("get" + capitalize))
|
||||
if (m.getName().equals(prefix + capitalize))
|
||||
return m;
|
||||
}
|
||||
|
||||
|
@ -220,16 +220,16 @@ public class DbObjectSchema {
|
||||
value = files.get(name);
|
||||
}
|
||||
|
||||
String type = params.get("__dbadmin_" + name + "_type");
|
||||
// String type = params.get("__dbadmin_" + name + "_type");
|
||||
|
||||
if (type == null)
|
||||
throw new RuntimeException("Missing type hidden field for: " + name);
|
||||
// if (type == null)
|
||||
// throw new RuntimeException("Missing type hidden field for: " + name);
|
||||
|
||||
try {
|
||||
if (value == null)
|
||||
row[currentIndex++] = null;
|
||||
else
|
||||
row[currentIndex++] = DbFieldType.valueOf(type).parseValue(value);
|
||||
row[currentIndex++] = value; //DbFieldType.valueOf(type).parseValue(value);
|
||||
} catch (IllegalArgumentException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -257,16 +257,16 @@ public class DbObjectSchema {
|
||||
value = files.get(name);
|
||||
}
|
||||
|
||||
String type = params.get("__dbadmin_" + name + "_type");
|
||||
// String type = params.get("__dbadmin_" + name + "_type");
|
||||
|
||||
if (type == null)
|
||||
throw new RuntimeException("Missing type hidden field for: " + name);
|
||||
// if (type == null)
|
||||
// throw new RuntimeException("Missing type hidden field for: " + name);
|
||||
|
||||
try {
|
||||
if (value == null)
|
||||
row[currentIndex++] = null;
|
||||
else
|
||||
row[currentIndex++] = DbFieldType.valueOf(type).parseValue(value);
|
||||
row[currentIndex++] = value; //DbFieldType.valueOf(type).parseValue(value);
|
||||
} catch (IllegalArgumentException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
<i class="bi bi-caret-right filter-icon align-middle"></i>
|
||||
<span class="fw-bold align-middle" th:text="${field.getName()}"></span>
|
||||
</div>
|
||||
<div class="card-body d-none">
|
||||
<div class="card-body">
|
||||
|
||||
<form action="" method="GET">
|
||||
<!-- Reset page when applying filter to start back at page 1 -->
|
||||
@ -57,7 +57,7 @@
|
||||
<th:block th:if="${field.isForeignKey()}">
|
||||
<div th:replace="~{fragments/forms :: input_autocomplete(field=${field}, value='')}">
|
||||
</div>
|
||||
<input type="hidden" th:value="${field.getType()}" th:name="|__dbadmin_${field.getName()}_type|">
|
||||
<!-- <input type="hidden" th:value="${field.getType()}" th:name="|__dbadmin_${field.getName()}_type|"> -->
|
||||
</th:block>
|
||||
<th:block th:unless="${field.isForeignKey()}">
|
||||
<div class="container w-25">
|
||||
@ -74,7 +74,7 @@
|
||||
step="any"
|
||||
oninvalid="this.setCustomValidity('This field is not nullable.')"
|
||||
oninput="this.setCustomValidity('')">
|
||||
<input type="hidden" th:value="${field.getType()}" th:name="|__dbadmin_${field.getName()}_type|">
|
||||
<!-- <input type="hidden" th:value="${field.getType()}" th:name="|__dbadmin_${field.getName()}_type|"> -->
|
||||
</th:block>
|
||||
|
||||
<th:block th:each="p : ${queryParams.keySet()}">
|
||||
|
@ -39,7 +39,7 @@
|
||||
: (object != null ? object.traverse(field).getPrimaryKeyValue() : '' )
|
||||
})}">
|
||||
</div>
|
||||
<input type="hidden" th:value="${field.getType()}" th:name="|__dbadmin_${field.getName()}_type|">
|
||||
<!-- <input type="hidden" th:value="${field.getType()}" th:name="|__dbadmin_${field.getName()}_type|"> -->
|
||||
</th:block>
|
||||
<th:block th:unless="${field.isForeignKey()}">
|
||||
<input placeholder="NULL" th:type="${field.getType().getHTMLName()}"
|
||||
@ -55,7 +55,7 @@
|
||||
step="any"
|
||||
oninvalid="this.setCustomValidity('This field is not nullable.')"
|
||||
oninput="this.setCustomValidity('')">
|
||||
<input type="hidden" th:value="${field.getType()}" th:name="|__dbadmin_${field.getName()}_type|">
|
||||
<!-- <input type="hidden" th:value="${field.getType()}" th:name="|__dbadmin_${field.getName()}_type|"> -->
|
||||
</th:block>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user