Skip to content

Commit

Permalink
Remove old Dev UI: Extension and Core
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Kruger <[email protected]>
  • Loading branch information
phillip-kruger committed Aug 19, 2023
1 parent 01902ac commit 19aae16
Show file tree
Hide file tree
Showing 48 changed files with 89 additions and 3,344 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
import io.quarkus.deployment.builditem.ApplicationArchivesBuildItem;
import io.quarkus.deployment.builditem.ConsoleCommandBuildItem;
import io.quarkus.deployment.console.QuarkusCommand;
import io.quarkus.devui.deployment.ide.IdeProcessor;
import io.quarkus.resteasy.reactive.server.runtime.ExceptionMapperRecorder;
import io.quarkus.resteasy.reactive.server.runtime.NotFoundExceptionMapper;
import io.quarkus.resteasy.reactive.spi.CustomExceptionMapperBuildItem;
import io.quarkus.vertx.http.deployment.HttpRootPathBuildItem;
import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem;
import io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem;
import io.quarkus.vertx.http.deployment.devmode.RouteDescriptionBuildItem;
import io.quarkus.vertx.http.deployment.devmode.console.DevConsoleProcessor;
import io.quarkus.vertx.http.runtime.devmode.AdditionalRouteDescription;
import io.quarkus.vertx.http.runtime.devmode.RouteDescription;

Expand Down Expand Up @@ -150,7 +150,7 @@ public OpenCommand(HttpRootPathBuildItem rp, NonApplicationRootPathBuildItem np,

@Override
public CommandResult doExecute(CommandInvocation commandInvocation) throws CommandException, InterruptedException {
DevConsoleProcessor.openBrowser(rp, np, url.startsWith("/") ? url : "/" + url, host, port);
IdeProcessor.openBrowser(rp, np, url.startsWith("/") ? url : "/" + url, host, port);
return CommandResult.SUCCESS;
}
}
Expand Down
300 changes: 2 additions & 298 deletions extensions/vertx-http/deployment/pom.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import io.quarkus.devui.deployment.extension.Codestart;
import io.quarkus.devui.deployment.extension.Extension;
import io.quarkus.devui.deployment.jsonrpc.DevUIDatabindCodec;
import io.quarkus.devui.runtime.DevUICORSFilter;
import io.quarkus.devui.runtime.DevUIRecorder;
import io.quarkus.devui.runtime.comms.JsonRpcRouter;
import io.quarkus.devui.runtime.jsonrpc.JsonRpcMethod;
Expand All @@ -70,7 +71,6 @@
import io.quarkus.vertx.http.deployment.webjar.WebJarBuildItem;
import io.quarkus.vertx.http.deployment.webjar.WebJarResourcesFilter;
import io.quarkus.vertx.http.deployment.webjar.WebJarResultsBuildItem;
import io.quarkus.vertx.http.runtime.devmode.DevConsoleCORSFilter;
import io.smallrye.common.annotation.Blocking;
import io.smallrye.common.annotation.NonBlocking;
import io.smallrye.mutiny.Multi;
Expand Down Expand Up @@ -140,7 +140,7 @@ void registerDevUiHandlers(
if (devUIConfig.cors.enabled) {
routeProducer.produce(nonApplicationRootPathBuildItem.routeBuilder()
.orderedRoute(DEVUI + SLASH_ALL, -1 * FilterBuildItem.CORS)
.handler(new DevConsoleCORSFilter())
.handler(new DevUICORSFilter())
.build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.util.Optional;
import java.util.concurrent.TimeUnit;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.logging.Logger;

import io.quarkus.deployment.IsDevelopment;
Expand All @@ -18,6 +20,9 @@
import io.quarkus.dev.console.DevConsoleManager;
import io.quarkus.devui.runtime.ide.IdeJsonRPCService;
import io.quarkus.devui.spi.JsonRPCProvidersBuildItem;
import io.quarkus.utilities.OS;
import io.quarkus.vertx.http.deployment.HttpRootPathBuildItem;
import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem;

/**
* Processor for Ide interaction in Dev UI
Expand Down Expand Up @@ -91,6 +96,52 @@ public void run() {
return true;
}

public static void openBrowser(HttpRootPathBuildItem rp, NonApplicationRootPathBuildItem np, String path, String host,
String port) {
if (path.startsWith("/q")) {
path = np.resolvePath(path.substring(3));
} else {
path = rp.resolvePath(path.substring(1));
}

StringBuilder sb = new StringBuilder("http://");
Config c = ConfigProvider.getConfig();
sb.append(host);
sb.append(":");
sb.append(port);
sb.append(path);
String url = sb.toString();

Runtime rt = Runtime.getRuntime();
OS os = OS.determineOS();
String[] command = null;
try {
switch (os) {
case MAC:
command = new String[] { "open", url };
break;
case LINUX:
command = new String[] { "xdg-open", url };
break;
case WINDOWS:
command = new String[] { "rundll32", "url.dll,FileProtocolHandler", url };
break;
case OTHER:
log.error("Cannot launch browser on this operating system");
}
if (command != null) {
rt.exec(command);
}
} catch (Exception e) {
log.debug("Failed to launch browser", e);
if (command != null) {
log.warn("Unable to open browser using command: '" + String.join(" ", command) + "'. Failure is: '"
+ e.getMessage() + "'");
}
}

}

private boolean isNullOrEmpty(String arg) {
return arg == null || arg.isBlank();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import io.quarkus.builder.item.SimpleBuildItem;
import io.quarkus.deployment.util.UriNormalizationUtil;
import io.quarkus.vertx.http.deployment.RouteBuildItem.RouteType;
import io.quarkus.vertx.http.deployment.devmode.ConfiguredPathInfo;
import io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem;
import io.quarkus.vertx.http.deployment.devmode.console.ConfiguredPathInfo;
import io.quarkus.vertx.http.runtime.BasicRoute;
import io.quarkus.vertx.http.runtime.HandlerType;
import io.vertx.core.Handler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import io.quarkus.builder.item.SimpleBuildItem;
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import io.quarkus.deployment.util.UriNormalizationUtil;
import io.quarkus.vertx.http.deployment.devmode.ConfiguredPathInfo;
import io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem;
import io.quarkus.vertx.http.deployment.devmode.console.ConfiguredPathInfo;
import io.quarkus.vertx.http.runtime.HandlerType;
import io.quarkus.vertx.http.runtime.management.ManagementInterfaceBuildTimeConfig;
import io.vertx.core.Handler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import org.eclipse.microprofile.config.ConfigProvider;

import io.quarkus.builder.item.MultiBuildItem;
import io.quarkus.vertx.http.deployment.devmode.ConfiguredPathInfo;
import io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem;
import io.quarkus.vertx.http.deployment.devmode.console.ConfiguredPathInfo;
import io.quarkus.vertx.http.runtime.BasicRoute;
import io.quarkus.vertx.http.runtime.HandlerType;
import io.vertx.core.Handler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkus.vertx.http.deployment.devmode.console;
package io.quarkus.vertx.http.deployment.devmode;

import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import io.quarkus.runtime.TemplateHtmlBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package io.quarkus.vertx.http.deployment.devmode.console;
package io.quarkus.vertx.http.deployment.devmode;

import io.quarkus.dev.config.CurrentConfig;
import io.quarkus.dev.spi.DeploymentFailedStartHandler;
import io.quarkus.devui.deployment.menu.ConfigurationProcessor;

public class DevConsoleFailedStartHandler implements DeploymentFailedStartHandler {
public class DevModeFailedStartHandler implements DeploymentFailedStartHandler {
@Override
public void handleFailedInitialStart() {
DevConsoleProcessor.initializeVirtual();
CurrentConfig.EDITOR = ConfigurationProcessor::updateConfig;
}
}
Loading

0 comments on commit 19aae16

Please sign in to comment.