From 0275906573e4991dc5f0c1b9e4047a978b0c78da Mon Sep 17 00:00:00 2001 From: nmirasch Date: Wed, 10 Apr 2024 13:49:25 +0200 Subject: [PATCH] =?UTF-8?q?[incubator-kie-kogito-runtimes#3454]=20GraphQL?= =?UTF-8?q?=20UI=20link=20visible=20in=20the=20l=E2=80=A6=20(#3464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [incubator-kie-kogito-runtimes#3454] GraphQL UI link visible in the last Quarkus Dev UI * review suggestions applied and testing fix --- .../KogitoDevServicesProcessor.java | 21 +++++++++++++++++++ ...erverlessWorkflowDevServicesProcessor.java | 21 +++++++++++++++++++ .../AbstractDevServicesProcessor.java | 6 ++++++ 3 files changed, 48 insertions(+) diff --git a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-deployment/src/main/java/org/kie/kogito/quarkus/processes/deployment/KogitoDevServicesProcessor.java b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-deployment/src/main/java/org/kie/kogito/quarkus/processes/deployment/KogitoDevServicesProcessor.java index 58fe5f7c1c4..05fb6777d5d 100644 --- a/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-deployment/src/main/java/org/kie/kogito/quarkus/processes/deployment/KogitoDevServicesProcessor.java +++ b/quarkus/extensions/kogito-quarkus-processes-extension/kogito-quarkus-processes-deployment/src/main/java/org/kie/kogito/quarkus/processes/deployment/KogitoDevServicesProcessor.java @@ -18,15 +18,23 @@ */ package org.kie.kogito.quarkus.processes.deployment; +import java.util.List; +import java.util.Optional; + import org.kie.kogito.quarkus.processes.devservices.DevModeWorkflowLogger; import org.kie.kogito.quarkus.workflow.deployment.AbstractDevServicesProcessor; import org.kie.kogito.quarkus.workflow.deployment.config.KogitoWorkflowBuildTimeConfig; import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.processor.DotNames; +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.deployment.builditem.SystemPropertyBuildItem; +import io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig; +import io.quarkus.devui.spi.page.CardPageBuildItem; +import io.quarkus.devui.spi.page.Page; /** * Starts a Data Index as dev service if needed. @@ -40,4 +48,17 @@ public void logger(BuildProducer additionalBean, Launch } } + @BuildStep(onlyIf = { GlobalDevServicesConfig.Enabled.class, IsDevelopment.class }) + CardPageBuildItem createDevUILink(List systemPropertyBuildItems) { + Optional dataindex_url_prop = getProperty(systemPropertyBuildItems, "kogito.data-index.url"); + if (dataindex_url_prop.isPresent()) { + CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(); + cardPageBuildItem.addPage(Page.externalPageBuilder("Data Index GraphQL UI") + .url(dataindex_url_prop.get() + "/q/graphql-ui/") + .isHtmlContent() + .icon("font-awesome-solid:signs-post")); + return cardPageBuildItem; + } + return null; + } } diff --git a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/deployment/ServerlessWorkflowDevServicesProcessor.java b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/deployment/ServerlessWorkflowDevServicesProcessor.java index 31fa077fb66..02cba0f8d7d 100644 --- a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/deployment/ServerlessWorkflowDevServicesProcessor.java +++ b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/quarkus/serverless/workflow/deployment/ServerlessWorkflowDevServicesProcessor.java @@ -18,15 +18,23 @@ */ package org.kie.kogito.quarkus.serverless.workflow.deployment; +import java.util.List; +import java.util.Optional; + import org.kie.kogito.quarkus.workflow.deployment.AbstractDevServicesProcessor; import org.kie.kogito.quarkus.workflow.deployment.config.KogitoWorkflowBuildTimeConfig; import org.kie.kogito.serverless.workflow.devservices.DevModeServerlessWorkflowLogger; import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.arc.processor.DotNames; +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.deployment.builditem.SystemPropertyBuildItem; +import io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig; +import io.quarkus.devui.spi.page.CardPageBuildItem; +import io.quarkus.devui.spi.page.Page; public class ServerlessWorkflowDevServicesProcessor extends AbstractDevServicesProcessor { @BuildStep @@ -36,4 +44,17 @@ public void logger(BuildProducer additionalBean, Launch } } + @BuildStep(onlyIf = { GlobalDevServicesConfig.Enabled.class, IsDevelopment.class }) + CardPageBuildItem createDevUILink(List systemPropertyBuildItems) { + Optional dataindex_url_prop = getProperty(systemPropertyBuildItems, "kogito.data-index.url"); + if (dataindex_url_prop.isPresent()) { + CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(); + cardPageBuildItem.addPage(Page.externalPageBuilder("Data Index GraphQL UI") + .url(dataindex_url_prop.get() + "/q/graphql-ui/") + .isHtmlContent() + .icon("font-awesome-solid:signs-post")); + return cardPageBuildItem; + } + return null; + } } diff --git a/quarkus/extensions/kogito-quarkus-workflow-extension-common/kogito-quarkus-workflow-common-deployment/src/main/java/org/kie/kogito/quarkus/workflow/deployment/AbstractDevServicesProcessor.java b/quarkus/extensions/kogito-quarkus-workflow-extension-common/kogito-quarkus-workflow-common-deployment/src/main/java/org/kie/kogito/quarkus/workflow/deployment/AbstractDevServicesProcessor.java index b6e137be98d..6bbb90352cc 100644 --- a/quarkus/extensions/kogito-quarkus-workflow-extension-common/kogito-quarkus-workflow-common-deployment/src/main/java/org/kie/kogito/quarkus/workflow/deployment/AbstractDevServicesProcessor.java +++ b/quarkus/extensions/kogito-quarkus-workflow-extension-common/kogito-quarkus-workflow-common-deployment/src/main/java/org/kie/kogito/quarkus/workflow/deployment/AbstractDevServicesProcessor.java @@ -71,6 +71,12 @@ protected static boolean shouldInclude(LaunchModeBuildItem launchMode, KogitoWor return launchMode.getLaunchMode().isDevOrTest() || config.alwaysInclude; } + protected Optional getProperty(List systemPropertyBuildItems, String propertyKey) { + return systemPropertyBuildItems.stream().filter(property -> property.getKey().equals(propertyKey)) + .findAny() + .map(SystemPropertyBuildItem::getValue); + } + @BuildStep(onlyIf = { GlobalDevServicesConfig.Enabled.class, IsDevelopment.class }) public void startDataIndexDevService( BuildProducer additionalBean,