WIP CSV export

This commit is contained in:
Francesco
2023-10-13 17:28:05 +02:00
parent a86a369120
commit 7250a2433c
6 changed files with 161 additions and 1 deletions

View File

@@ -3,6 +3,53 @@
<head th:replace="~{fragments/resources::head}">
</head>
<body>
<!-- Modal -->
<div class="modal fade" id="csvExportModal" tabindex="-1" aria-labelledby="csvExportModalLabel" aria-hidden="true">
<form th:action="|/${dbadmin_baseUrl}/export/${schema.getClassName()}|" method="GET">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="csvExportModalLabel">Export settings</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="container-fluid">
<h5 class="fw-bold">Include columns</h5>
<div th:each="field : ${schema.getSortedFields()}" th:if="${field.isExportable()}">
<div class="form-check">
<input class="form-check-input" type="checkbox"
th:value="${field.getName()}" th:id="|__check_${field.getName()}|"
th:name="fields[]"
checked>
<label class="form-check-label" th:for="|__check_${field.getName()}|">
[[ ${field.getName()} ]]
</label>
</div>
</div>
<h5 class="fw-bold mt-3" th:if="${!activeFilters.isEmpty()}">Active filters</h5>
<div th:each="filter : ${activeFilters}">
<span class="active-filter badge bg-primary me-1 mb-2 p-2 font-monospace noselect">
[[ ${filter}]]
</span>
</div>
<h5 class="fw-bold mt-3">Export format</h3>
<select name="format" class="form-select">
<option value="csv">CSV</option>
<option value="xlsx">XLSX</option>
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</form>
</div>
<!-- End modal -->
<div class="bg-light main-wrapper">
<nav th:replace="~{fragments/resources :: navbar}"></nav>
<div class="d-flex">
@@ -59,6 +106,9 @@
<span title="Database table name" class="ms-3 label label-primary label-gray font-monospace">
[[ ${schema.getTableName()} ]]
</span>
<button type="button" class="btn p-0 m-0 ms-3" data-bs-toggle="modal" data-bs-target="#csvExportModal">
<i class="bi bi-filetype-csv" style="font-size: 1.5rem;"></i>
</button>
</h3>
<h3 class="create-button">