Skip to content

Commit

Permalink
Merge pull request quarkusio#39429 from phillip-kruger/info-extension
Browse files Browse the repository at this point in the history
Dev UI: Info card now links to page
  • Loading branch information
cescoffier authored Mar 14, 2024
2 parents 61aaf1f + 0bce95f commit e387da3
Showing 1 changed file with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package io.quarkus.info.deployment;

import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import io.quarkus.devui.spi.page.CardPageBuildItem;
import io.quarkus.devui.spi.page.MenuPageBuildItem;
import io.quarkus.devui.spi.page.Page;
import io.quarkus.devui.spi.page.WebComponentPageBuilder;
import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem;
import io.quarkus.vertx.http.runtime.management.ManagementInterfaceBuildTimeConfig;

Expand All @@ -14,27 +17,36 @@
public class InfoDevUIProcessor {

@BuildStep(onlyIf = IsDevelopment.class)
MenuPageBuildItem create(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem,
void create(BuildProducer<MenuPageBuildItem> menuPageProducer,
BuildProducer<CardPageBuildItem> cardPageProducer,
NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem,
InfoBuildTimeConfig config,
ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig,
LaunchModeBuildItem launchModeBuildItem) {
MenuPageBuildItem pageBuildItem = new MenuPageBuildItem();

var path = nonApplicationRootPathBuildItem.resolveManagementPath(config.path(),
managementInterfaceBuildTimeConfig, launchModeBuildItem);

pageBuildItem.addBuildTimeData("infoUrl", path);
MenuPageBuildItem menuBuildItem = new MenuPageBuildItem();

pageBuildItem.addPage(Page.webComponentPageBuilder()
menuBuildItem.addBuildTimeData("infoUrl", path);

WebComponentPageBuilder infoPage = Page.webComponentPageBuilder()
.title("Information")
.icon("font-awesome-solid:circle-info")
.componentLink("qwc-info.js"));
pageBuildItem.addPage(Page.externalPageBuilder("Raw")
.componentLink("qwc-info.js");

menuBuildItem.addPage(infoPage);
menuBuildItem.addPage(Page.externalPageBuilder("Raw")
.url(path)
.icon("font-awesome-solid:circle-info")
.isJsonContent());

return pageBuildItem;
menuPageProducer.produce(menuBuildItem);

CardPageBuildItem cardBuildItem = new CardPageBuildItem();
cardBuildItem.addPage(infoPage);
cardPageProducer.produce(cardBuildItem);
}

}

0 comments on commit e387da3

Please sign in to comment.