Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
4.3 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" xmlns:th="https://www.thymeleaf.org">
<head>
<th:block th:insert="~{fragments/common :: head(title=#{database.title}, header=#{database.header})}"></th:block>
</head>
<body>
<div id="page-container">
<div id="content-wrap">
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block>
<br><br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-9 bg-card">
<div class="tool-header">
<span class="material-symbols-rounded tool-header-icon organize">database</span>
<span class="tool-header-text" th:text="#{database.title}">Database Im-/Export</span>
</div>
<p th:if="${error}" th:text="#{'database.' + ${error}}" class="alert alert-danger text-center"></p>
<p th:if="${infoMessage}" th:text="#{'database.' + ${infoMessage}}" class="alert alert-success text-center"></p>
Add Conditional Handling for H2SQL Databases and Improve Database Compatibility (#2632) # Description 1. **Conditional Support for DatabaseController**: - The `DatabaseController` is now annotated with `@Conditional(H2SQLCondition.class)` to ensure it is only available for H2SQL database setups. - This prevents unnecessary exposure of endpoints when the application is configured for H2SQL. 2. **Database Web Template Adjustments**: - The UI elements related to database management are conditionally hidden when the database type is not supported (e.g., `databaseVersion == 'Unknown'`). - Improves user experience by avoiding unsupported operations for non-H2SQL or unknown databases. 3. **Model Attribute Updates**: - Added a check in `DatabaseWebController` to set an informational message (`notSupported`) when the database version is unknown. 4. **H2 Database Compatibility**: - Additional adjustments to ensure the application gracefully handles H2-specific functionality without affecting other database configurations. 5. **Build File Updates**: - Updated the `build.gradle` file to exclude `H2SQLCondition` and related controllers when specific configurations (e.g., security or database type) are disabled. ### Benefits: - Enhances application flexibility by adapting to the configured database type. - Improves user feedback with clear messaging and UI adjustments for unsupported operations. - Prevents accidental exposure of database endpoints in H2SQL setups. ## Checklist - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have performed a self-review of my own code - [ ] I have attached images of the change if it is UI based - [x] I have commented my code, particularly in hard-to-understand areas - [ ] If my code has heavily changed functionality I have updated relevant docs on [Stirling-PDFs doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) - [x] My changes generate no new warnings - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only)
2025-01-08 11:22:45 +01:00
<div th:if="${databaseVersion!='Unknown'}" class="bg-card mt-3 mb-3">
<table class="table table-striped table-hover mb-0">
<thead>
<tr>
<th scope="col" th:text="#{database.fileName}">File Name</th>
<th scope="col" th:text="#{database.creationDate}">Creation Date</th>
<th scope="col" th:text="#{database.fileSize}">File Size</th>
<th scope="col"></th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<tr th:each="backup : ${backupFiles}">
<td th:text="${backup.fileName}"></td>
<td th:text="${backup.formattedCreationDate}"></td>
<td th:text="${backup.formattedFileSize}"></td>
<td th:title="#{database.deleteBackupFile}"><a th:href="@{'/api/v1/database/delete/' + ${backup.fileName}}" style="color: red;"><span class="material-symbols-rounded">delete</span></a></td>
<td th:title="#{database.importBackupFile}"><a th:href="@{'/api/v1/database/import-database-file/' + ${backup.fileName}}" style="color: var(--md-nav-section-color-organize);"><span class="material-symbols-rounded">backup</span></a></td>
<td th:title="#{database.downloadBackupFile}"><a th:href="@{'/api/v1/database/download/' + ${backup.fileName}}"><span class="material-symbols-rounded">download</span></a></td>
</tr>
</tbody>
</table>
<h6 class="text-end"><span class="badge bg-dark" th:text="${databaseVersion}">DB-Version</span></h6>
2024-12-17 23:23:16 +01:00
<a th:title="#{database.createBackupFile}" th:text="#{database.createBackupFile}" th:href="@{'/api/v1/database/createDatabaseBackup'}" class="btn btn-outline-primary">Create Backup File</a>
</div>
<hr>
Add Conditional Handling for H2SQL Databases and Improve Database Compatibility (#2632) # Description 1. **Conditional Support for DatabaseController**: - The `DatabaseController` is now annotated with `@Conditional(H2SQLCondition.class)` to ensure it is only available for H2SQL database setups. - This prevents unnecessary exposure of endpoints when the application is configured for H2SQL. 2. **Database Web Template Adjustments**: - The UI elements related to database management are conditionally hidden when the database type is not supported (e.g., `databaseVersion == 'Unknown'`). - Improves user experience by avoiding unsupported operations for non-H2SQL or unknown databases. 3. **Model Attribute Updates**: - Added a check in `DatabaseWebController` to set an informational message (`notSupported`) when the database version is unknown. 4. **H2 Database Compatibility**: - Additional adjustments to ensure the application gracefully handles H2-specific functionality without affecting other database configurations. 5. **Build File Updates**: - Updated the `build.gradle` file to exclude `H2SQLCondition` and related controllers when specific configurations (e.g., security or database type) are disabled. ### Benefits: - Enhances application flexibility by adapting to the configured database type. - Improves user feedback with clear messaging and UI adjustments for unsupported operations. - Prevents accidental exposure of database endpoints in H2SQL setups. ## Checklist - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have performed a self-review of my own code - [ ] I have attached images of the change if it is UI based - [x] I have commented my code, particularly in hard-to-understand areas - [ ] If my code has heavily changed functionality I have updated relevant docs on [Stirling-PDFs doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) - [x] My changes generate no new warnings - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only)
2025-01-08 11:22:45 +01:00
<form th:if="${databaseVersion!='Unknown'}" th:action="@{'/api/v1/database/import-database'}" method="post" enctype="multipart/form-data" class="bg-card mt-3 mb-3">
<div style="background: var(--md-sys-color-error-container);border-radius: 2rem;" class="mb-3 p-3">
<p th:text="#{database.info_1}"></p>
<p th:text="#{database.info_2}"></p>
</div>
<div class="custom-file-chooser">
<div class="mb-3">
<input type="file" class="form-control" th:name="fileInput" id="fileInput-input" accept=".sql" required>
</div>
</div>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{database.submit}">Import Backup</button>
</form>
</div>
</div>
</div>
</div>
<script th:inline="javascript">
const pdfPasswordPrompt = /*[[#{error.pdfPassword}]]*/ '';
const multiple = /*[[${multiple}]]*/ false;
const remoteCall = /*[[${remoteCall}]]*/ true;
</script>
<script th:src="@{'/js/fileInput.js'}"></script>
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
</div>
</body>
</html>