mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-06-09 05:48:20 +00:00
WIP SQL console: delete tabs
This commit is contained in:
parent
d0fa9a0dc6
commit
c9a9dc6e4c
@ -570,9 +570,16 @@ public class DefaultDbAdminController {
|
|||||||
} else {
|
} else {
|
||||||
return "redirect:/" + properties.getBaseUrl() + "/console/run/" + tabs.get(0).getId();
|
return "redirect:/" + properties.getBaseUrl() + "/console/run/" + tabs.get(0).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/console/delete/{queryId}")
|
||||||
|
public String consoleDelete(@PathVariable String queryId, Model model) {
|
||||||
|
consoleQueryRepository.deleteById(queryId);
|
||||||
|
return "redirect:/" + properties.getBaseUrl() + "/console";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/console/run/{queryId}")
|
@GetMapping("/console/run/{queryId}")
|
||||||
public String consoleRun(Model model, @RequestParam(required = false) String query,
|
public String consoleRun(Model model, @RequestParam(required = false) String query,
|
||||||
@RequestParam(required = false) String queryTitle,
|
@RequestParam(required = false) String queryTitle,
|
||||||
|
8
src/main/resources/static/js/console.js
Normal file
8
src/main/resources/static/js/console.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
document.querySelector("#console-delete-btn").addEventListener("click", () => {
|
||||||
|
if (confirm("Are you sure you want to delete this query?")) {
|
||||||
|
document.querySelector("#console-delete-form").submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@ -30,12 +30,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="box with-navigation">
|
<div class="box with-navigation">
|
||||||
<form th:action="|/${dbadmin_baseUrl}/console/run/${activeQuery.getId()}|" method="GET">
|
<form th:action="|/${dbadmin_baseUrl}/console/run/${activeQuery.getId()}|" method="GET">
|
||||||
|
<span class="text-muted fw-bold mb-1 d-inline-block">Query title</span>
|
||||||
<input type="text" class="form-control mb-3"
|
<input type="text" class="form-control mb-3"
|
||||||
name="queryTitle" th:value="${activeQuery.getTitle()}">
|
name="queryTitle" th:value="${activeQuery.getTitle()}">
|
||||||
|
<span class="text-muted fw-bold mb-1 d-inline-block">SQL</span>
|
||||||
<textarea class="form-control" rows="6" name="query"
|
<textarea class="form-control" rows="6" name="query"
|
||||||
th:text="${activeQuery.getSql()}"></textarea>
|
th:text="${activeQuery.getSql()}"></textarea>
|
||||||
<input class="ui-btn btn btn-primary mt-3" type="submit" value="Run">
|
<input class="ui-btn btn btn-primary mt-3" type="submit" value="Run">
|
||||||
|
<a href="#" class="ms-4 ui-btn btn btn-danger mt-3" id="console-delete-btn">Delete</a>
|
||||||
</form>
|
</form>
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<form th:action="|/${dbadmin_baseUrl}/console/delete/${activeQuery.getId()}|" method="POST"
|
||||||
|
id="console-delete-form">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div th:if="${error == null && activeQuery.getSql() != null}">
|
<div th:if="${error == null && activeQuery.getSql() != null}">
|
||||||
<div class="separator mt-3 mb-3"></div>
|
<div class="separator mt-3 mb-3"></div>
|
||||||
@ -51,5 +60,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript" th:src="|/${dbadmin_baseUrl}/js/console.js|"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user