Skip to content

Commit

Permalink
Merge pull request #141 from quarkiverse/feat/dev-console
Browse files Browse the repository at this point in the history
feat: add dev ui link to dashboard
  • Loading branch information
andrejpetras authored Apr 26, 2024
2 parents 110f3bf + 521e369 commit ec3125d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
4 changes: 4 additions & 0 deletions deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devservices-common</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-dev-ui-spi</artifactId>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mockserver</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.quarkiverse.mockserver.devservices;

import java.util.List;

import io.quarkiverse.mockserver.runtime.MockServerConfig;
import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.Consume;
import io.quarkus.deployment.builditem.DevServicesResultBuildItem;
import io.quarkus.deployment.builditem.RuntimeConfigSetupCompleteBuildItem;
import io.quarkus.devui.spi.page.CardPageBuildItem;
import io.quarkus.devui.spi.page.Page;

public class DevUIMockServerProcessor {

@BuildStep(onlyIf = IsDevelopment.class)
@Consume(RuntimeConfigSetupCompleteBuildItem.class)
public CardPageBuildItem pages(List<DevServicesResultBuildItem> devServicesResultBuildItemList,
MockServerBuildTimeConfig config) {

CardPageBuildItem cardPageBuildItem = new CardPageBuildItem();

if (devServicesResultBuildItemList != null) {
var mockServerService = devServicesResultBuildItemList.stream()
.filter(x -> config.defaultDevService.devservices.serviceName.equals(x.getName()))
.findFirst().orElse(null);
if (mockServerService != null) {
var keys = mockServerService.getConfig();
var url = String.format("http://%s:%s/mockserver/dashboard",
keys.get(MockServerConfig.CLIENT_HOST),
keys.get(MockServerConfig.CLIENT_PORT));

cardPageBuildItem.addPage(Page.externalPageBuilder("Dashboard")
.url(url).isHtmlContent()
.icon("font-awesome-solid:sliders"));

cardPageBuildItem.addPage(Page.externalPageBuilder("External dashboard")
.url(url, url).doNotEmbed()
.icon("font-awesome-solid:share-from-square"));
}
}

return cardPageBuildItem;
}
}
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/includes/attributes.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:project-version: 1.7.0
:quarkus-version: 3.9.3
:quarkus-version: 3.9.4

:quarkus-mockserver-url: https://github.com/quarkiverse/quarkus-mockserver

Expand Down

0 comments on commit ec3125d

Please sign in to comment.