Skip to content

Commit

Permalink
Merge pull request #17 from phillip-kruger/contribute-to-errorpage
Browse files Browse the repository at this point in the history
Add BuildItem to contribute to the error page
  • Loading branch information
phillip-kruger authored Jul 30, 2024
2 parents 7f88e6e + 507d3f9 commit a4f6e99
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
import io.quarkus.devui.spi.buildtime.BuildTimeActionBuildItem;
import io.quarkus.devui.spi.page.CardPageBuildItem;
import io.quarkus.devui.spi.page.Page;
import io.quarkus.vertx.http.deployment.ErrorPageActionsBuildItem;
import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem;
import io.smallrye.mutiny.operators.multi.processors.BroadcastProcessor;

class ChappieDevUIProcessor {
private static final String EXCEPTION_TITLE = "Help with the latest exception";

static volatile AtomicReference<LastException> lastExceptionReference;

Expand Down Expand Up @@ -51,13 +54,20 @@ public void accept(Throwable throwable, StackTraceElement stackTraceElement) {
}));
}

@BuildStep(onlyIf = IsDevelopment.class)
public ErrorPageActionsBuildItem addActionToErrorPage(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem) {
String url = nonApplicationRootPathBuildItem.resolvePath(
"dev-ui/io.quarkiverse.chappie.quarkus-chappie/" + EXCEPTION_TITLE.replace(" ", "-").toLowerCase());
return new ErrorPageActionsBuildItem("Get help with this", url);
}

@BuildStep(onlyIf = IsDevelopment.class)
public CardPageBuildItem pages() {
CardPageBuildItem chappiePage = new CardPageBuildItem();

chappiePage.addPage(Page.webComponentPageBuilder()
.icon("font-awesome-solid:circle-question")
.title("Help with the latest exception")
.title(EXCEPTION_TITLE)
.componentLink("qwc-chappie-exception.js"));

return chappiePage;
Expand Down

0 comments on commit a4f6e99

Please sign in to comment.