Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[incubator-kie-kogito-runtimes#3454] GraphQL UI link visible in the l… #3464

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -40,4 +48,17 @@ public void logger(BuildProducer<AdditionalBeanBuildItem> additionalBean, Launch
}
}

@BuildStep(onlyIf = { GlobalDevServicesConfig.Enabled.class, IsDevelopment.class })
CardPageBuildItem createDevUILink(List<SystemPropertyBuildItem> systemPropertyBuildItems) {
Optional<String> 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -36,4 +44,17 @@ public void logger(BuildProducer<AdditionalBeanBuildItem> additionalBean, Launch
}
}

@BuildStep(onlyIf = { GlobalDevServicesConfig.Enabled.class, IsDevelopment.class })
CardPageBuildItem createDevUILink(List<SystemPropertyBuildItem> systemPropertyBuildItems) {
Optional<String> 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ protected static boolean shouldInclude(LaunchModeBuildItem launchMode, KogitoWor
return launchMode.getLaunchMode().isDevOrTest() || config.alwaysInclude;
}

protected Optional<String> getProperty(List<SystemPropertyBuildItem> 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<AdditionalBeanBuildItem> additionalBean,
Expand Down
Loading