|
16 | 16 |
|
17 | 17 | import io.quarkiverse.httpproblem.DetailSanitizer; |
18 | 18 | import io.quarkiverse.httpproblem.ProblemRuntimeFixedConfig; |
| 19 | +import io.quarkiverse.httpproblem.deployment.devui.ExceptionMapperInfo; |
| 20 | +import io.quarkiverse.httpproblem.devui.ProblemJsonRpcService; |
19 | 21 | import io.quarkiverse.httpproblem.postprocessing.MdcPropertiesInjector; |
20 | 22 | import io.quarkiverse.httpproblem.postprocessing.PostProcessorsRegistry; |
21 | 23 | import io.quarkiverse.httpproblem.postprocessing.ProblemDefaultsProvider; |
|
29 | 31 | import io.quarkus.arc.deployment.UnremovableBeanBuildItem; |
30 | 32 | import io.quarkus.deployment.Capabilities; |
31 | 33 | import io.quarkus.deployment.Capability; |
| 34 | +import io.quarkus.deployment.IsDevelopment; |
32 | 35 | import io.quarkus.deployment.annotations.BuildProducer; |
33 | 36 | import io.quarkus.deployment.annotations.BuildStep; |
34 | 37 | import io.quarkus.deployment.annotations.Record; |
35 | 38 | import io.quarkus.deployment.builditem.FeatureBuildItem; |
36 | 39 | import io.quarkus.deployment.builditem.IndexDependencyBuildItem; |
37 | 40 | import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; |
| 41 | +import io.quarkus.devui.spi.JsonRPCProvidersBuildItem; |
| 42 | +import io.quarkus.devui.spi.page.CardPageBuildItem; |
| 43 | +import io.quarkus.devui.spi.page.Page; |
38 | 44 | import io.quarkus.jsonb.spi.JsonbDeserializerBuildItem; |
39 | 45 | import io.quarkus.jsonb.spi.JsonbSerializerBuildItem; |
40 | 46 | import io.quarkus.resteasy.common.spi.ResteasyJaxrsProviderBuildItem; |
@@ -279,4 +285,48 @@ void setupLogging(ProblemRecorder recorder, ProblemBuildConfig config, |
279 | 285 | UnremovableBeanBuildItem markPostProcessorsUnremovable() { |
280 | 286 | return UnremovableBeanBuildItem.beanTypes(ProblemPostProcessor.class); |
281 | 287 | } |
| 288 | + |
| 289 | + @BuildStep(onlyIf = IsDevelopment.class) |
| 290 | + CardPageBuildItem createDevUIPages(ProblemBuildConfig config, Capabilities capabilities) { |
| 291 | + CardPageBuildItem card = new CardPageBuildItem(); |
| 292 | + |
| 293 | + List<ExceptionMapperInfo> mapperInfos = neededExceptionMappers(config, capabilities).stream() |
| 294 | + .map(m -> new ExceptionMapperInfo( |
| 295 | + shortName(m.exceptionClassName), |
| 296 | + shortName(m.mapperClassName), |
| 297 | + "Active")) |
| 298 | + .collect(Collectors.toList()); |
| 299 | + |
| 300 | + card.addBuildTimeData("mappers", mapperInfos, |
| 301 | + "List of active HTTP Problem exception mappers with their exception type and status"); |
| 302 | + |
| 303 | + card.addPage(Page.tableDataPageBuilder("Exception Mappers") |
| 304 | + .icon("font-awesome-solid:map") |
| 305 | + .showColumn("exception") |
| 306 | + .showColumn("mapper") |
| 307 | + .showColumn("status") |
| 308 | + .buildTimeDataKey("mappers")); |
| 309 | + |
| 310 | + card.addPage(Page.webComponentPageBuilder() |
| 311 | + .title("Post Processors") |
| 312 | + .icon("font-awesome-solid:layer-group") |
| 313 | + .componentLink("qwc-http-problem-processors.js")); |
| 314 | + |
| 315 | + card.addPage(Page.webComponentPageBuilder() |
| 316 | + .title("Test") |
| 317 | + .icon("font-awesome-solid:flask") |
| 318 | + .componentLink("qwc-http-problem-test.js")); |
| 319 | + |
| 320 | + return card; |
| 321 | + } |
| 322 | + |
| 323 | + @BuildStep |
| 324 | + JsonRPCProvidersBuildItem registerJsonRpcService() { |
| 325 | + return new JsonRPCProvidersBuildItem(ProblemJsonRpcService.class); |
| 326 | + } |
| 327 | + |
| 328 | + private static String shortName(String fqcn) { |
| 329 | + int lastDot = fqcn.lastIndexOf('.'); |
| 330 | + return lastDot >= 0 ? fqcn.substring(lastDot + 1) : fqcn; |
| 331 | + } |
282 | 332 | } |
0 commit comments