diff --git a/src/main/java/tech/ailef/dbadmin/external/controller/DefaultDbAdminController.java b/src/main/java/tech/ailef/dbadmin/external/controller/DefaultDbAdminController.java index ece77cf..f6f1a9a 100644 --- a/src/main/java/tech/ailef/dbadmin/external/controller/DefaultDbAdminController.java +++ b/src/main/java/tech/ailef/dbadmin/external/controller/DefaultDbAdminController.java @@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.http.HttpStatus; import org.springframework.jdbc.UncategorizedSQLException; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Controller; import org.springframework.transaction.TransactionSystemException; import org.springframework.ui.Model; @@ -87,6 +88,8 @@ public class DefaultDbAdminController { @Autowired private UserActionService userActionService; + @Autowired + private JdbcTemplate jdbTemplate; @Autowired private UserSettingsRepository userSettingsRepo; @@ -535,6 +538,17 @@ public class DefaultDbAdminController { return "help"; } + @GetMapping("/console") + public String console(Model model, @RequestParam(required=false) String query) { + model.addAttribute("activePage", "console"); + + if (query != null) { + jdbTemplate.execute(query); + } + + return "console"; + } + @GetMapping("/settings/appearance") public String settingsAppearance(Model model) { model.addAttribute("activePage", "settings"); diff --git a/src/main/resources/templates/console.html b/src/main/resources/templates/console.html new file mode 100644 index 0000000..0a3bc30 --- /dev/null +++ b/src/main/resources/templates/console.html @@ -0,0 +1,26 @@ + + +
+ + +