Skip to content

Commit

Permalink
Add GraphQL UI to test endpoints in OIDC Dev UI
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Kruger <phillip.kruger@gmail.com>
  • Loading branch information
phillip-kruger committed Sep 14, 2021
1 parent 409a0c6 commit 5e993ab
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public interface Capability {
String SMALLRYE_OPENTRACING = QUARKUS_PREFIX + "smallrye.opentracing";
String SMALLRYE_HEALTH = QUARKUS_PREFIX + "smallrye.health";
String SMALLRYE_OPENAPI = QUARKUS_PREFIX + "smallrye.openapi";
String SMALLRYE_GRAPHQL = QUARKUS_PREFIX + "smallrye.graphql";
String SMALLRYE_FAULT_TOLERANCE = QUARKUS_PREFIX + "smallrye.faulttolerance";

String SPRING_WEB = QUARKUS_PREFIX + "spring.web";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ public void setConfigProperties(BuildProducer<DevConsoleTemplateInfoBuildItem> c
new DevConsoleTemplateInfoBuildItem("authorizationUrl", realmUrl + "/protocol/openid-connect/auth"));
console.produce(new DevConsoleTemplateInfoBuildItem("logoutUrl", realmUrl + "/protocol/openid-connect/logout"));
console.produce(new DevConsoleTemplateInfoBuildItem("oidcGrantType", config.devservices.grant.type.getGrantType()));
console.produce(new DevConsoleTemplateInfoBuildItem("swaggerIsAvailable",
capabilities.isPresent(Capability.SMALLRYE_OPENAPI)));

if (capabilities.isPresent(Capability.SMALLRYE_OPENAPI)) {
console.produce(new DevConsoleTemplateInfoBuildItem("swaggerIsAvailable", true));
}
if (capabilities.isPresent(Capability.SMALLRYE_GRAPHQL)) {
console.produce(new DevConsoleTemplateInfoBuildItem("graphqlIsAvailable", true));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
}

function navigateToSwaggerUi(){
{#if info:swaggerIsAvailable}
{#if info:swaggerIsAvailable??}
var url = "{config:http-path('quarkus.swagger-ui.path')}";

var authorizedValue = {
Expand All @@ -163,6 +163,15 @@
{/if}
}

function navigateToGraphQLUi(){
{#if info:graphqlIsAvailable??}
var url = "{config:http-path('quarkus.smallrye-graphql.ui.root-path')}";
var headerJson = '{"authorization": "Bearer ' + accessToken + '"}';
url = url + '/?' + encodeURIComponent('headers') + '=' + encodeURIComponent(headerJson);
window.open(url, '_blank').focus();
{/if}
}

function copyToClipboard(token, type){
var dummy = document.createElement("input");
document.body.appendChild(dummy);
Expand Down Expand Up @@ -408,11 +417,16 @@ <h5 class="card-title text-light">Decoded</h5>
Test your service
</div>
<div class="float-right">
{#if info:swaggerIsAvailable}
{#if info:swaggerIsAvailable??}
<a onclick="navigateToSwaggerUi();" class="btn btn-link" title="Test in Swagger UI">
<i class="fas fa-external-link-alt"></i> Swagger UI
</a>
{/if}
{#if info:graphqlIsAvailable??}
<a onclick="navigateToGraphQLUi();" class="btn btn-link" title="Test in GraphQL UI">
<i class="fas fa-external-link-alt"></i> GraphQL UI
</a>
{/if}
</div>
</div>
<div class="card-body border-0">
Expand Down
5 changes: 5 additions & 0 deletions extensions/smallrye-graphql/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-maven-plugin</artifactId>
<configuration>
<capabilities>
<provides>io.quarkus.smallrye.graphql</provides>
</capabilities>
</configuration>
<executions>
<execution>
<goals>
Expand Down

0 comments on commit 5e993ab

Please sign in to comment.