From 00c521adddf0b1e04ace5b1fd3050332b95de9a3 Mon Sep 17 00:00:00 2001 From: Phillip Kruger Date: Tue, 25 Jul 2023 15:46:52 +1000 Subject: [PATCH] Remove Old Dev UI: Liquibase Signed-off-by: Phillip Kruger --- .../LiquibaseDevConsoleProcessor.java | 28 -------- .../resources/dev-templates/datasources.html | 36 ---------- .../resources/dev-templates/embedded.html | 3 - .../LiquibaseDevConsoleRecorder.java | 70 ------------------- 4 files changed, 137 deletions(-) delete mode 100644 extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/devconsole/LiquibaseDevConsoleProcessor.java delete mode 100644 extensions/liquibase/deployment/src/main/resources/dev-templates/datasources.html delete mode 100644 extensions/liquibase/deployment/src/main/resources/dev-templates/embedded.html delete mode 100644 extensions/liquibase/runtime/src/main/java/io/quarkus/liquibase/runtime/devconsole/LiquibaseDevConsoleRecorder.java diff --git a/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/devconsole/LiquibaseDevConsoleProcessor.java b/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/devconsole/LiquibaseDevConsoleProcessor.java deleted file mode 100644 index fcf6e15cc0b43..0000000000000 --- a/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/devconsole/LiquibaseDevConsoleProcessor.java +++ /dev/null @@ -1,28 +0,0 @@ -package io.quarkus.liquibase.deployment.devconsole; - -import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT; - -import io.quarkus.deployment.IsDevelopment; -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.Record; -import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem; -import io.quarkus.devconsole.spi.DevConsoleRouteBuildItem; -import io.quarkus.devconsole.spi.DevConsoleRuntimeTemplateInfoBuildItem; -import io.quarkus.liquibase.runtime.devconsole.LiquibaseDevConsoleRecorder; -import io.quarkus.liquibase.runtime.devui.LiquibaseFactoriesSupplier; - -public class LiquibaseDevConsoleProcessor { - - @BuildStep(onlyIf = IsDevelopment.class) - public DevConsoleRuntimeTemplateInfoBuildItem collectBeanInfo(CurateOutcomeBuildItem curateOutcomeBuildItem) { - return new DevConsoleRuntimeTemplateInfoBuildItem("liquibaseFactories", new LiquibaseFactoriesSupplier(), - this.getClass(), - curateOutcomeBuildItem); - } - - @BuildStep - @Record(value = RUNTIME_INIT, optional = true) - DevConsoleRouteBuildItem invokeEndpoint(LiquibaseDevConsoleRecorder recorder) { - return new DevConsoleRouteBuildItem("datasources", "POST", recorder.handler()); - } -} diff --git a/extensions/liquibase/deployment/src/main/resources/dev-templates/datasources.html b/extensions/liquibase/deployment/src/main/resources/dev-templates/datasources.html deleted file mode 100644 index f31ec795c7e1d..0000000000000 --- a/extensions/liquibase/deployment/src/main/resources/dev-templates/datasources.html +++ /dev/null @@ -1,36 +0,0 @@ -{#include main} -{#title}Managed datasources{/title} -{#body} - - - - - - - - - {#for liquibaseFactory in info:liquibaseFactories} - - - - {/for} - -
NameActions
- {liquibaseFactory.dataSourceName} - -
-
- - - -
-   -
- - - -
-
-
-{/body} -{/include} diff --git a/extensions/liquibase/deployment/src/main/resources/dev-templates/embedded.html b/extensions/liquibase/deployment/src/main/resources/dev-templates/embedded.html deleted file mode 100644 index 921d41ecd6e5f..0000000000000 --- a/extensions/liquibase/deployment/src/main/resources/dev-templates/embedded.html +++ /dev/null @@ -1,3 +0,0 @@ - - - Datasources {info:liquibaseFactories.size()} diff --git a/extensions/liquibase/runtime/src/main/java/io/quarkus/liquibase/runtime/devconsole/LiquibaseDevConsoleRecorder.java b/extensions/liquibase/runtime/src/main/java/io/quarkus/liquibase/runtime/devconsole/LiquibaseDevConsoleRecorder.java deleted file mode 100644 index aa6eca0c8b97d..0000000000000 --- a/extensions/liquibase/runtime/src/main/java/io/quarkus/liquibase/runtime/devconsole/LiquibaseDevConsoleRecorder.java +++ /dev/null @@ -1,70 +0,0 @@ -package io.quarkus.liquibase.runtime.devconsole; - -import java.lang.annotation.Annotation; - -import jakarta.enterprise.inject.Default; - -import io.quarkus.arc.Arc; -import io.quarkus.arc.InjectableInstance; -import io.quarkus.arc.InstanceHandle; -import io.quarkus.datasource.common.runtime.DataSourceUtil; -import io.quarkus.devconsole.runtime.spi.DevConsolePostHandler; -import io.quarkus.devconsole.runtime.spi.FlashScopeUtil.FlashMessageStatus; -import io.quarkus.liquibase.LiquibaseDataSource.LiquibaseDataSourceLiteral; -import io.quarkus.liquibase.LiquibaseFactory; -import io.quarkus.runtime.annotations.Recorder; -import io.vertx.core.Handler; -import io.vertx.core.MultiMap; -import io.vertx.ext.web.RoutingContext; -import liquibase.Liquibase; - -@Recorder -public class LiquibaseDevConsoleRecorder { - - public Handler handler() { - return new DevConsolePostHandler() { - @Override - protected void handlePost(RoutingContext event, MultiMap form) throws Exception { - String datasource = form.get("datasource"); - String operation = form.get("operation"); - - InjectableInstance liquibaseFactoryInstance = Arc.container().select(LiquibaseFactory.class); - if (liquibaseFactoryInstance.isUnsatisfied()) { - return; - } - - Annotation qualifier; - if (DataSourceUtil.isDefault(datasource)) { - qualifier = Default.Literal.INSTANCE; - } else { - qualifier = LiquibaseDataSourceLiteral.of(datasource); - } - - InstanceHandle liquibaseFactoryHandle = Arc.container().instance(LiquibaseFactory.class, - qualifier); - if (!liquibaseFactoryHandle.isAvailable()) { - flashMessage(event, "Unknown datasource: " + datasource, FlashMessageStatus.ERROR); - } - - LiquibaseFactory liquibaseFactory = liquibaseFactoryHandle.get(); - if ("clean".equals(operation)) { - try (Liquibase liquibase = liquibaseFactory.createLiquibase()) { - liquibase.dropAll(); - } - flashMessage(event, "Datasource " + datasource + " cleaned"); - return; - } else if ("migrate".equals(operation)) { - try (Liquibase liquibase = liquibaseFactory.createLiquibase()) { - liquibase.update(liquibaseFactory.createContexts(), - liquibaseFactory.createLabels()); - } - flashMessage(event, "Datasource " + datasource + " migrated"); - return; - } else { - flashMessage(event, "Invalid operation: " + operation, FlashMessageStatus.ERROR); - return; - } - } - }; - } -}