- Small refactor to the rendering part for input fileds: each field now has its own Thymeleaf

fragment in order to allow easier customization and easier support for different field types (required for #7)
- WIP Handle unsupported types gracefully (#9)
This commit is contained in:
Francesco
2023-10-05 09:38:17 +02:00
parent bebc562961
commit 4177bdcd43
9 changed files with 124 additions and 32 deletions

View File

@@ -59,6 +59,14 @@ tr.table-data-row td:last-child, tr.table-data-row th:last-child {
width: 96px;
}
.warning-col {
width: 32px;
}
.warning-col a .bi {
color: red !important;
}
h1 .bi {
font-size: 2rem;
}

View File

@@ -39,6 +39,7 @@
th:required="${!field.isNullable() && !field.isPrimaryKey()}"
></input>
<!--
<th:block th:fragment="offset_datetime(field, create, name, value)">
<div class="form-group">
<input placeholder="NULL"
@@ -63,6 +64,7 @@
</select>
</div>
</th:block>
-->
<input placeholder="NULL" th:fragment="date(field, create, name, value)"
type="date"
th:value="${value}"

View File

@@ -25,12 +25,19 @@
<h4 class="fw-bold" th:text="${package}"></h4>
<table class="table table-striped mt-4" th:if="${!schemas.isEmpty()}">
<tr>
<th></th>
<th>Table</th>
<th>Rows</th>
<th>Java class</th>
<th></th>
</tr>
<tr th:each="schema : ${schemas.get(package)}">
<td class="warning-col">
<a th:if="${!schema.getErrors().isEmpty()}"
title="Some errors or warnings were raised during processing of this schema."
th:href="|/${baseUrl}/model/${schema.getClassName()}/schema|">
<i class="bi bi-exclamation-triangle"></i></a>
</td>
<td>
<a th:text="${schema.getTableName()}"
th:href="|/${baseUrl}/model/${schema.getClassName()}|"></a>

View File

@@ -67,6 +67,12 @@
<td th:text="${field.isNullable()}"></td>
</tr>
</table>
<div class="separator mb-2 mt-2"></div>
<h3 th:if="${!schema.getErrors().isEmpty()}" class="fw-bold"><i class="bi bi-exclamation-triangle"></i> Errors</h3>
<ul>
<li th:each="error : ${schema.getErrors()}" th:text="${error.getMessage()}">
</li>
</ul>
</div>
</div>
</div>