-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43618 from phillip-kruger/dev-ui-db
Add a Dev UI Screen for Agroal (DB)
- Loading branch information
Showing
11 changed files
with
1,276 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...oal/deployment/src/main/java/io/quarkus/agroal/deployment/devui/AgroalDevUIProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.quarkus.agroal.deployment.devui; | ||
|
||
import io.quarkus.agroal.runtime.DataSourcesJdbcBuildTimeConfig; | ||
import io.quarkus.agroal.runtime.dev.ui.DatabaseInspector; | ||
import io.quarkus.deployment.IsDevelopment; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.annotations.BuildSteps; | ||
import io.quarkus.deployment.builditem.LaunchModeBuildItem; | ||
import io.quarkus.dev.spi.DevModeType; | ||
import io.quarkus.devui.spi.JsonRPCProvidersBuildItem; | ||
import io.quarkus.devui.spi.page.CardPageBuildItem; | ||
import io.quarkus.devui.spi.page.Page; | ||
|
||
@BuildSteps(onlyIf = IsDevelopment.class) | ||
class AgroalDevUIProcessor { | ||
|
||
@BuildStep | ||
void devUI(DataSourcesJdbcBuildTimeConfig config, | ||
BuildProducer<CardPageBuildItem> cardPageProducer, | ||
BuildProducer<JsonRPCProvidersBuildItem> jsonRPCProviderProducer, | ||
LaunchModeBuildItem launchMode) { | ||
|
||
if (launchMode.getDevModeType().isPresent() && launchMode.getDevModeType().get().equals(DevModeType.LOCAL)) { | ||
if (config.devui().enabled()) { | ||
CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(); | ||
|
||
cardPageBuildItem.addPage(Page.webComponentPageBuilder() | ||
.icon("font-awesome-solid:database") | ||
.title("Database view") | ||
.componentLink("qwc-agroal-datasource.js") | ||
.metadata("allowSql", String.valueOf(config.devui().allowSql())) | ||
.metadata("appendSql", config.devui().appendToDefaultSelect().orElse("")) | ||
.metadata("allowedHost", config.devui().allowedDBHost().orElse(null))); | ||
|
||
cardPageProducer.produce(cardPageBuildItem); | ||
jsonRPCProviderProducer.produce(new JsonRPCProvidersBuildItem(DatabaseInspector.class)); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.