Skip to content

Commit

Permalink
Merge pull request #32307 from melloware/devui-info
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi authored Mar 31, 2023
2 parents 0e685cb + 0428a5b commit 499eaf1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.quarkus.info.deployment;

import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import io.quarkus.devui.spi.page.CardPageBuildItem;
import io.quarkus.devui.spi.page.Page;
import io.quarkus.info.runtime.InfoRecorder;
import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem;
import io.quarkus.vertx.http.runtime.management.ManagementInterfaceBuildTimeConfig;

/**
* This processor is responsible for the dev ui widget.
*/
public class InfoDevUiProcessor {

@BuildStep(onlyIf = IsDevelopment.class)
@Record(ExecutionTime.STATIC_INIT)
CardPageBuildItem create(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem,
InfoBuildTimeConfig config,
ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig,
LaunchModeBuildItem launchModeBuildItem,
InfoRecorder unused) {
CardPageBuildItem pageBuildItem = new CardPageBuildItem();

var path = nonApplicationRootPathBuildItem.resolveManagementPath(config.path(),
managementInterfaceBuildTimeConfig, launchModeBuildItem);
pageBuildItem.addPage(Page.externalPageBuilder("App Information")
.icon("font-awesome-solid:circle-info")
.url(path)
.isJsonContent());

return pageBuildItem;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.vertx.core.Handler;
import io.vertx.core.http.HttpHeaders;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.core.json.Json;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;

Expand Down Expand Up @@ -44,7 +45,7 @@ public void handle(RoutingContext ctx) {
HttpServerResponse resp = ctx.response();
resp.headers().set(HttpHeaders.CONTENT_TYPE, "application/json; charset=UTF-8");
JsonObject jsonObject = new JsonObject(finalBuildInfo);
ctx.json(jsonObject);
ctx.end(Json.encodePrettily(jsonObject));
}
}
}

0 comments on commit 499eaf1

Please sign in to comment.