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)
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
</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>
|
||||
<div class="bg-card mt-3 mb-3">
|
||||
<div th:if="${databaseVersion!='Unknown'}" class="bg-card mt-3 mb-3">
|
||||
<table class="table table-striped table-hover mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -45,7 +45,7 @@
|
||||
<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>
|
||||
<form th:action="@{'/api/v1/database/import-database'}" method="post" enctype="multipart/form-data" class="bg-card mt-3 mb-3">
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user