From db5eab6f0f941cc45fd79d87712e474e90764f6c Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Tue, 17 Aug 2021 16:13:16 +0200 Subject: [PATCH] Small UI refinements for the reset datasource support --- .../deployment/devservices/DevUIDatasourceProcessor.java | 2 +- .../deployment/src/main/resources/dev-templates/embedded.html | 4 ++-- .../main/resources/dev-templates/{clean.html => reset.html} | 4 ++-- .../java/io/quarkus/datasource/runtime/DatabaseRecorder.java | 4 ++-- .../src/main/resources/META-INF/quarkus-extension.yaml | 2 +- .../orm/HibernateSchemaRecreateDevConsoleTestCase.java | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) rename extensions/datasource/deployment/src/main/resources/dev-templates/{clean.html => reset.html} (80%) diff --git a/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevUIDatasourceProcessor.java b/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevUIDatasourceProcessor.java index d608338bfe094..f2a7c83105b49 100644 --- a/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevUIDatasourceProcessor.java +++ b/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevUIDatasourceProcessor.java @@ -29,6 +29,6 @@ public DevConsoleTemplateInfoBuildItem devConsoleInfo( @BuildStep(onlyIf = IsDevelopment.class) @Record(value = STATIC_INIT, optional = true) DevConsoleRouteBuildItem devConsoleCleanDatabaseHandler(DatabaseRecorder recorder) { - return new DevConsoleRouteBuildItem("clean", "POST", recorder.devConsoleCleanDatabaseHandler()); + return new DevConsoleRouteBuildItem("reset", "POST", recorder.devConsoleResetDatabaseHandler()); } } diff --git a/extensions/datasource/deployment/src/main/resources/dev-templates/embedded.html b/extensions/datasource/deployment/src/main/resources/dev-templates/embedded.html index 5782d51593a6b..3db6eb6a0f451 100644 --- a/extensions/datasource/deployment/src/main/resources/dev-templates/embedded.html +++ b/extensions/datasource/deployment/src/main/resources/dev-templates/embedded.html @@ -1,3 +1,3 @@ - - + + Reset Databases diff --git a/extensions/datasource/deployment/src/main/resources/dev-templates/clean.html b/extensions/datasource/deployment/src/main/resources/dev-templates/reset.html similarity index 80% rename from extensions/datasource/deployment/src/main/resources/dev-templates/clean.html rename to extensions/datasource/deployment/src/main/resources/dev-templates/reset.html index d667072017f00..53bfe478404e6 100644 --- a/extensions/datasource/deployment/src/main/resources/dev-templates/clean.html +++ b/extensions/datasource/deployment/src/main/resources/dev-templates/reset.html @@ -1,5 +1,5 @@ {#include main} - {#title}Clean Databases{/title} + {#title}Reset Databases{/title} {#body} @@ -17,7 +17,7 @@ {/for} diff --git a/extensions/datasource/runtime/src/main/java/io/quarkus/datasource/runtime/DatabaseRecorder.java b/extensions/datasource/runtime/src/main/java/io/quarkus/datasource/runtime/DatabaseRecorder.java index a770aa7c2cb0e..1243ecc91c91c 100644 --- a/extensions/datasource/runtime/src/main/java/io/quarkus/datasource/runtime/DatabaseRecorder.java +++ b/extensions/datasource/runtime/src/main/java/io/quarkus/datasource/runtime/DatabaseRecorder.java @@ -11,7 +11,7 @@ @Recorder public class DatabaseRecorder { - public Handler devConsoleCleanDatabaseHandler() { + public Handler devConsoleResetDatabaseHandler() { // the usual issue of Vert.x hanging on to the first TCCL and setting it on all its threads final ClassLoader currentCl = Thread.currentThread().getContextClassLoader(); return new DevConsolePostHandler() { @@ -24,7 +24,7 @@ protected void handlePostAsync(RoutingContext event, MultiMap form) throws Excep for (DatabaseSchemaProvider i : dbs) { i.resetDatabase(name); } - flashMessage(event, "Action invoked"); + flashMessage(event, "Database successfully reset"); } }; } diff --git a/extensions/datasource/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/datasource/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 851e7cc5c31a7..682a96a9d3156 100644 --- a/extensions/datasource/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/datasource/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -1,6 +1,6 @@ --- artifact: ${project.groupId}:${project.artifactId}:${project.version} -name: "Datasource configuration" +name: "Datasources" metadata: keywords: - "datasource" diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateSchemaRecreateDevConsoleTestCase.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateSchemaRecreateDevConsoleTestCase.java index 0ffe0aeaa7d40..aed18b9d75170 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateSchemaRecreateDevConsoleTestCase.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/HibernateSchemaRecreateDevConsoleTestCase.java @@ -24,7 +24,7 @@ public void testCleanDatabase() { RestAssured.when().get("/my-entity/add").then().body(is("MyEntity:added")); RestAssured.when().get("/my-entity/count").then().body(is("3")); RestAssured.with() - .redirects().follow(false).formParam("name", "").post("q/dev/io.quarkus.quarkus-datasource/clean") + .redirects().follow(false).formParam("name", "").post("q/dev/io.quarkus.quarkus-datasource/reset") .then() .statusCode(303); RestAssured.when().get("/my-entity/count").then().body(is("2"));
- +