From 3ed3079768c9582f290315dc14d7ffc1658d9ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szynkiewicz?= Date: Thu, 19 Aug 2021 15:40:54 +0200 Subject: [PATCH] gRPC Dev UI: better size for response text, include streaming services and health endpoint refs #19218 --- .../grpc/deployment/devmode/GrpcDevConsoleProcessor.java | 2 ++ .../src/main/resources/dev-templates/service.html | 3 ++- .../java/io/quarkus/grpc/runtime/devmode/GrpcServices.java | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/devmode/GrpcDevConsoleProcessor.java b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/devmode/GrpcDevConsoleProcessor.java index f977c493bdd96..e4f28696c1b49 100644 --- a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/devmode/GrpcDevConsoleProcessor.java +++ b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/devmode/GrpcDevConsoleProcessor.java @@ -20,6 +20,7 @@ import com.google.protobuf.MessageOrBuilder; import com.google.protobuf.util.JsonFormat; +import grpc.health.v1.HealthGrpc; import io.grpc.MethodDescriptor; import io.grpc.MethodDescriptor.Marshaller; import io.grpc.MethodDescriptor.PrototypeMarshaller; @@ -120,6 +121,7 @@ Collection> getGrpcServices(IndexView index) throws ClassNotFoundExcept for (String className : serviceClassNames) { serviceClasses.add(tccl.loadClass(className)); } + serviceClasses.add(HealthGrpc.class); return serviceClasses; } } diff --git a/extensions/grpc/deployment/src/main/resources/dev-templates/service.html b/extensions/grpc/deployment/src/main/resources/dev-templates/service.html index d8883a972e75f..3c9d339dbbb97 100644 --- a/extensions/grpc/deployment/src/main/resources/dev-templates/service.html +++ b/extensions/grpc/deployment/src/main/resources/dev-templates/service.html @@ -99,7 +99,8 @@ connection.responseText = data.body + connection.responseText; responseElement.value = connection.responseText; - responseElement.style.height = Math.min(responseElement.scrollHeight + 5, 500) + "px" + responseElement.style.height = "1px"; + responseElement.style.height = Math.min(responseElement.scrollHeight + 5, 500) + "px"; } else if (data.status == 'COMPLETED') { const connection = connections.get(data.id); hideConnected(connection); diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devmode/GrpcServices.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devmode/GrpcServices.java index ae4a66fa982a8..436e7a3088d32 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devmode/GrpcServices.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devmode/GrpcServices.java @@ -109,7 +109,7 @@ public boolean hasTestableMethod() { } Map prototypes = DevConsoleManager.getGlobal("io.quarkus.grpc.messagePrototypes"); for (ServerMethodDefinition method : getMethods()) { - if (method.getMethodDescriptor().getType() == MethodType.UNARY + if (method.getMethodDescriptor().getType() != MethodType.UNKNOWN && prototypes.containsKey(method.getMethodDescriptor().getFullMethodName() + "_REQUEST")) { return true; } @@ -146,8 +146,8 @@ public boolean hasPrototype() { } public boolean isTestable() { - return !configuration.server.ssl.certificate.isPresent() - && !configuration.server.ssl.keyStore.isPresent(); + return configuration.server.ssl.certificate.isEmpty() + && configuration.server.ssl.keyStore.isEmpty(); } public String getPrototype() {