This commit is contained in:
Francesco
2023-09-21 10:55:29 +02:00
parent 8039801940
commit 5ba037057f
26 changed files with 404 additions and 136 deletions

View File

@@ -5,9 +5,18 @@
<tr th:fragment="data_row(row, selectable)" class="table-data-row">
<td th:if=${selectable} class="table-checkbox">
<input type="checkbox" class="form-check-input" name="ids"
th:value="${row.getPrimaryKeyValue()}" form="delete-form">
th:value="${row.getPrimaryKeyValue()}" form="multi-delete-form">
</td>
<td th:each="field : ${schema.getSortedFields()}">
<td class="text-center row-icons">
<a class="ps-1" th:href="|/dbadmin/model/${schema.getJavaClass().getName()}/edit/${row.getPrimaryKeyValue()}|">
<i class="bi bi-pencil-square"></i></a>
<form class="delete-form" method="POST"
th:action="|/dbadmin/model/${schema.getJavaClass().getName()}/delete/${row.getPrimaryKeyValue()}|">
<button><i class="bi bi-trash"></i></button>
</form>
</td>
<td th:each="field : ${schema.getSortedFields()}"
th:classAppend="${field.isBinary() ? 'text-center' : ''}">
<th:block th:if="${!row.has(field)}">
<span class="font-monospace null-label">NULL</span>
</th:block>
@@ -19,21 +28,12 @@
<td th:each="colName : ${schema.getComputedColumnNames()}">
<span th:text="${row.compute(colName)}"></span>
</td>
<td class="text-center row-icons" th:if="${selectable}">
<a class="ps-1" th:href="|/dbadmin/model/${schema.getJavaClass().getName()}/edit/${row.getPrimaryKeyValue()}|">
<i class="bi bi-pencil-square"></i></a>
<form class="delete-form" method="POST"
th:action="|/dbadmin/model/${schema.getJavaClass().getName()}/delete/${row.getPrimaryKeyValue()}|">
<button><i class="bi bi-trash"></i></button>
</form>
</td>
</tr>
<!-- data-row-field fragment -->
<th:block th:fragment="data_row_field(field, object)">
<th:block th:if="${field.getConnectedType() != null}">
<th:block th:if="${field.getConnectedType() != null && object.traverse(field) != null}">
<a th:href="|/dbadmin/model/${field.getConnectedType().getName()}/show/${object.traverse(field).getPrimaryKeyValue()}|">
<span th:text="${object.has(field) ? object.traverse(field).getPrimaryKeyValue() : 'NULL'}"></span>
</a>
@@ -61,12 +61,19 @@
</th:block>
<span th:unless="${!field.isBinary()}">
<th:block th:if="${object.get(field).getValue()}">
<div th:if="${field.isImage()}" class="mb-2">
<img class="thumb-image"
th:src="|/dbadmin/download/${schema.getClassName()}/${field.getJavaName()}/${object.getPrimaryKeyValue()}/image|">
</div>
<a class="text-decoration-none null-label"
th:href="|/dbadmin/download/${schema.getJavaClass().getName()}/${field.getName()}/${object.get(schema.getPrimaryKey()).getValue()}|">
th:href="|/dbadmin/download/${schema.getClassName()}/${field.getJavaName()}/${object.getPrimaryKeyValue()}|">
<i class="align-middle bi bi-box-arrow-down"></i><span class="align-middle"> Download
<!--/*--> <span class="text-muted">([[ ${object.get(field).getValue().length} ]] bytes)</span> <!--*/-->
</span>
</a>
</th:block>
<th:block th:unless="${object.get(field).getValue()}">
<span class="font-monospace null-label">NULL</span>

View File

@@ -10,6 +10,7 @@
<script type="text/javascript" src="/js/autocomplete.js"></script>
<script type="text/javascript" src="/js/autocomplete-multi.js"></script>
<script type="text/javascript" src="/js/filters.js"></script>
<script type="text/javascript" src="/js/create.js"></script>
<title th:text="${title != null ? title + ' | Spring Boot DB Admin Panel' : 'Spring Boot DB Admin Panel'}"></title>
</head>

View File

@@ -9,6 +9,7 @@
<div th:if="${results != null && results.size() > 0}">
<table class="table table-striped align-middle mt-3">
<tr class="table-data-row">
<th class="row-icons"></th>
<th th:each="field : ${schema.getSortedFields()}">
<div class="m-0 p-0 d-flex justify-content-between">
<div class="column-title">

View File

@@ -2,18 +2,19 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org">
<head></head>
<body>
<div class="table-selectable" th:fragment="table(results, schema)">
<div class="table-selectable table-responsive" th:fragment="table(results, schema)">
<div th:if="${results.isEmpty()}">
<p>This table contains no data.</p>
</div>
<div th:if="${results.size() > 0}">
<form id="delete-form" th:action="|/dbadmin/model/${schema.getClassName()}/delete|" method="POST">
<form id="multi-delete-form" th:action="|/dbadmin/model/${schema.getClassName()}/delete|" method="POST">
</form>
<nav th:replace="~{fragments/resources :: pagination(${page})}">
</nav>
<table class="table table-striped align-middle mt-3">
<tr class="table-data-row">
<th class="table-checkbox"><input type="checkbox" class="form-check-input check-all"></th>
<th></th>
<th class="table-data-row" th:each="field : ${schema.getSortedFields()}">
<div class="m-0 p-0 d-flex justify-content-between">
<div class="column-title">
@@ -56,7 +57,6 @@
</div>
<p class="m-0 p-0 dbfieldtype"><small>COMPUTED</small></p>
</th>
<th></th>
</tr>
<th:block th:each="r : ${results}">
<tr th:replace="~{fragments/data_row :: data_row(row=${r},selectable=${true})}"></tr>