mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-06-08 21:38:21 +00:00
WIP SQL console: edit tab names
This commit is contained in:
parent
0ec0f63359
commit
d0fa9a0dc6
@ -574,7 +574,9 @@ public class DefaultDbAdminController {
|
||||
}
|
||||
|
||||
@GetMapping("/console/run/{queryId}")
|
||||
public String consoleRun(Model model, @RequestParam(required = false) String query, @PathVariable String queryId) {
|
||||
public String consoleRun(Model model, @RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) String queryTitle,
|
||||
@PathVariable String queryId) {
|
||||
ConsoleQuery activeQuery = consoleQueryRepository.findById(queryId).orElseThrow(() -> {
|
||||
return new DbAdminNotFoundException("Query with ID " + queryId + " not found.");
|
||||
});
|
||||
@ -582,6 +584,9 @@ public class DefaultDbAdminController {
|
||||
if (query != null && !query.isBlank()) {
|
||||
activeQuery.setSql(query);
|
||||
}
|
||||
if (queryTitle != null && !queryTitle.isBlank()) {
|
||||
activeQuery.setTitle(queryTitle);
|
||||
}
|
||||
|
||||
activeQuery.setUpdatedAt(LocalDateTime.now());
|
||||
consoleQueryRepository.save(activeQuery);
|
||||
|
@ -16,8 +16,8 @@
|
||||
class="d-inline-block"
|
||||
th:classAppend="${query.getId() == activeQuery.getId() ? 'active' : ''}">
|
||||
<div class="ui-tab ps-5 pe-5 p-3">
|
||||
<i class="bi bi-filetype-sql pe-2"></i> Untitled Query
|
||||
|
||||
<i class="bi bi-filetype-sql pe-2"></i>
|
||||
<span th:text="${query.getTitle()}"></span>
|
||||
</div>
|
||||
</a>
|
||||
<div class="inner-navigation-border flex-grow-1 align-items-center d-flex">
|
||||
@ -30,16 +30,21 @@
|
||||
</div>
|
||||
<div class="box with-navigation">
|
||||
<form th:action="|/${dbadmin_baseUrl}/console/run/${activeQuery.getId()}|" method="GET">
|
||||
<input type="text" class="form-control mb-3"
|
||||
name="queryTitle" th:value="${activeQuery.getTitle()}">
|
||||
<textarea class="form-control" rows="6" name="query"
|
||||
th:text="${activeQuery.getSql()}"></textarea>
|
||||
<input class="ui-btn btn btn-primary mt-3" type="submit" value="Run">
|
||||
</form>
|
||||
|
||||
<div th:if="${error == null}">
|
||||
<div th:if="${error == null && activeQuery.getSql() != null}">
|
||||
<div class="separator mt-3 mb-3"></div>
|
||||
<div th:replace="~{fragments/generic_table :: table(results=${results})}"></div>
|
||||
</div>
|
||||
<th:block th:replace="~{fragments/resources :: alerts}"></th:block>
|
||||
<div th:if="${error != null}">
|
||||
<div class="separator mt-3 mb-3"></div>
|
||||
<th:block th:replace="~{fragments/resources :: alerts}"></th:block>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user