diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java index 7347c5ad90db5..6818ff8fb5c38 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/ConfigurationProcessor.java @@ -1,12 +1,14 @@ package io.quarkus.devui.deployment.menu; -import static io.quarkus.vertx.http.deployment.devmode.console.ConfigEditorProcessor.cleanUpAsciiDocIfNecessary; -import static io.quarkus.vertx.http.deployment.devmode.console.ConfigEditorProcessor.isSetByDevServices; - +import java.io.BufferedWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -23,15 +25,15 @@ import io.quarkus.deployment.annotations.Record; import io.quarkus.deployment.builditem.ConfigDescriptionBuildItem; import io.quarkus.deployment.builditem.DevServicesLauncherConfigResultBuildItem; +import io.quarkus.dev.config.CurrentConfig; import io.quarkus.dev.console.DevConsoleManager; import io.quarkus.devui.deployment.InternalPageBuildItem; +import io.quarkus.devui.runtime.config.ConfigDescription; import io.quarkus.devui.runtime.config.ConfigDescriptionBean; -import io.quarkus.devui.runtime.config.ConfigDevUiRecorder; +import io.quarkus.devui.runtime.config.ConfigDevUIRecorder; import io.quarkus.devui.runtime.config.ConfigJsonRPCService; import io.quarkus.devui.spi.JsonRPCProvidersBuildItem; import io.quarkus.devui.spi.page.Page; -import io.quarkus.vertx.http.deployment.devmode.console.ConfigEditorProcessor; -import io.quarkus.vertx.http.runtime.devmode.ConfigDescription; /** * This creates Extensions Page @@ -66,7 +68,7 @@ InternalPageBuildItem createConfigurationPages( @Record(ExecutionTime.STATIC_INIT) void registerConfigs(List configDescriptionBuildItems, Optional devServicesLauncherConfig, - ConfigDevUiRecorder recorder) { + ConfigDevUIRecorder recorder) { List configDescriptions = new ArrayList<>(); for (ConfigDescriptionBuildItem item : configDescriptionBuildItems) { @@ -93,16 +95,16 @@ void registerConfigs(List configDescriptionBuildItem void registerJsonRpcService( BuildProducer jsonRPCProvidersProducer, BuildProducer syntheticBeanProducer, - ConfigDevUiRecorder recorder) { + ConfigDevUIRecorder recorder) { DevConsoleManager.register("config-update-property", map -> { Map values = Collections.singletonMap(map.get("name"), map.get("value")); - ConfigEditorProcessor.updateConfig(values, false); + updateConfig(values); return null; }); DevConsoleManager.register("config-set-properties", value -> { String content = value.get("content"); - ConfigEditorProcessor.setConfig(content, false); + setConfig(content); return null; }); @@ -113,6 +115,8 @@ void registerJsonRpcService( .setRuntimeInit() .done()); + CurrentConfig.EDITOR = ConfigurationProcessor::updateConfig; + jsonRPCProvidersProducer.produce(new JsonRPCProvidersBuildItem("devui-configuration", ConfigJsonRPCService.class)); } @@ -131,4 +135,98 @@ private static String formatJavadoc(String val) { val = val.replace("@deprecated", "
Deprecated"); return val; } + + private static String cleanUpAsciiDocIfNecessary(String docs) { + if (docs == null || !docs.toLowerCase(Locale.ROOT).contains("@asciidoclet")) { + return docs; + } + // TODO #26199 Ideally we'd use a proper AsciiDoc renderer, but for now we'll just clean it up a bit. + return docs.replace("@asciidoclet", "") + // Avoid problems with links. + .replace("<<", "<<") + .replace(">>", ">>") + // Try to render line breaks... kind of. + .replace("\n\n", "

") + .replace("\n", "
"); + } + + private static boolean isSetByDevServices(Optional devServicesLauncherConfig, + String propertyName) { + if (devServicesLauncherConfig.isPresent()) { + return devServicesLauncherConfig.get().getConfig().containsKey(propertyName); + } + return false; + } + + public static void updateConfig(Map values) { + if (values != null && !values.isEmpty()) { + try { + Path configPath = getConfigPath(); + List lines = Files.readAllLines(configPath); + for (Map.Entry entry : values.entrySet()) { + String name = entry.getKey(); + String value = entry.getValue(); + int nameLine = -1; + for (int i = 0, linesSize = lines.size(); i < linesSize; i++) { + String line = lines.get(i); + if (line.startsWith(name + "=")) { + nameLine = i; + break; + } + } + if (nameLine != -1) { + if (value.isEmpty()) { + lines.remove(nameLine); + } else { + lines.set(nameLine, name + "=" + value); + } + } else { + if (!value.isEmpty()) { + lines.add(name + "=" + value); + } + } + } + + try (BufferedWriter writer = Files.newBufferedWriter(configPath)) { + for (String i : lines) { + writer.write(i); + writer.newLine(); + } + } + } catch (Throwable t) { + throw new RuntimeException(t); + } + } + } + + private static void setConfig(String value) { + try { + Path configPath = getConfigPath(); + try (BufferedWriter writer = Files.newBufferedWriter(configPath)) { + if (value == null || value.isEmpty()) { + writer.newLine(); + } else { + writer.write(value); + } + } + } catch (Throwable t) { + throw new RuntimeException(t); + } + } + + private static Path getConfigPath() throws IOException { + List resourcesDir = DevConsoleManager.getHotReplacementContext().getResourcesDir(); + if (resourcesDir.isEmpty()) { + throw new IllegalStateException("Unable to manage configurations - no resource directory found"); + } + + // In the current project only + Path path = resourcesDir.get(0); + Path configPath = path.resolve("application.properties"); + if (!Files.exists(configPath)) { + Files.createDirectories(configPath.getParent()); + configPath = Files.createFile(path.resolve("application.properties")); + } + return configPath; + } } diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ConfigEditorProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ConfigEditorProcessor.java deleted file mode 100644 index 1603a6c48d1f6..0000000000000 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/ConfigEditorProcessor.java +++ /dev/null @@ -1,421 +0,0 @@ -package io.quarkus.vertx.http.deployment.devmode.console; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - -import org.aesh.command.Command; -import org.aesh.command.CommandDefinition; -import org.aesh.command.CommandException; -import org.aesh.command.CommandResult; -import org.aesh.command.GroupCommand; -import org.aesh.command.GroupCommandDefinition; -import org.aesh.command.completer.CompleterInvocation; -import org.aesh.command.completer.OptionCompleter; -import org.aesh.command.invocation.CommandInvocation; -import org.aesh.command.option.Argument; -import org.aesh.command.option.Option; -import org.aesh.command.validator.CommandValidator; -import org.aesh.command.validator.CommandValidatorException; - -import io.quarkus.deployment.IsDevelopment; -import io.quarkus.deployment.annotations.BuildProducer; -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.ExecutionTime; -import io.quarkus.deployment.annotations.Record; -import io.quarkus.deployment.builditem.ConfigDescriptionBuildItem; -import io.quarkus.deployment.builditem.ConsoleCommandBuildItem; -import io.quarkus.deployment.builditem.DevServicesLauncherConfigResultBuildItem; -import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem; -import io.quarkus.dev.config.CurrentConfig; -import io.quarkus.dev.console.DevConsoleManager; -import io.quarkus.devconsole.runtime.spi.DevConsolePostHandler; -import io.quarkus.devconsole.spi.DevConsoleRouteBuildItem; -import io.quarkus.devconsole.spi.DevConsoleRuntimeTemplateInfoBuildItem; -import io.quarkus.vertx.http.runtime.devmode.ConfigDescription; -import io.quarkus.vertx.http.runtime.devmode.ConfigDescriptionsManager; -import io.quarkus.vertx.http.runtime.devmode.ConfigDescriptionsRecorder; -import io.quarkus.vertx.http.runtime.devmode.HasDevServicesSupplier; -import io.vertx.core.MultiMap; -import io.vertx.core.buffer.Buffer; -import io.vertx.ext.web.RoutingContext; - -public class ConfigEditorProcessor { - - @BuildStep(onlyIf = IsDevelopment.class) - @Record(ExecutionTime.RUNTIME_INIT) - public void config(BuildProducer devConsoleRuntimeTemplateProducer, - List configDescriptionBuildItems, - BuildProducer consoleCommandBuildItemBuildProducer, - CurateOutcomeBuildItem curateOutcomeBuildItem, BuildProducer devConsoleRouteProducer, - Optional devServicesLauncherConfig, ConfigDescriptionsRecorder recorder) { - List configDescriptions = new ArrayList<>(); - for (ConfigDescriptionBuildItem item : configDescriptionBuildItems) { - configDescriptions.add( - new ConfigDescription(item.getPropertyName(), - cleanUpAsciiDocIfNecessary(item.getDocs()), - item.getDefaultValue(), - isSetByDevServices(devServicesLauncherConfig, item.getPropertyName()), - item.getValueTypeName(), - item.getAllowedValues(), - item.getConfigPhase().name())); - } - Set devServicesConfig = new HashSet<>(); - if (devServicesLauncherConfig.isPresent()) { - devServicesConfig.addAll(devServicesLauncherConfig.get().getConfig().keySet()); - } - - ConfigDescriptionsManager configDescriptionsManager = recorder.manager(configDescriptions, devServicesConfig); - - consoleCommandBuildItemBuildProducer.produce( - new ConsoleCommandBuildItem(new ConfigCommandGroup(new ConfigDescriptionsManager(configDescriptions)))); - - devConsoleRuntimeTemplateProducer.produce(new DevConsoleRuntimeTemplateInfoBuildItem("config", - configDescriptionsManager, this.getClass(), curateOutcomeBuildItem)); - - devConsoleRuntimeTemplateProducer.produce(new DevConsoleRuntimeTemplateInfoBuildItem("hasDevServices", - new HasDevServicesSupplier(devServicesLauncherConfig.isPresent() - && devServicesLauncherConfig.get().getConfig() != null - && !devServicesLauncherConfig.get().getConfig().isEmpty()), - this.getClass(), - curateOutcomeBuildItem)); - - devConsoleRouteProducer.produce(new DevConsoleRouteBuildItem("add-named-group", "POST", configDescriptionsManager)); - devConsoleRouteProducer.produce(new DevConsoleRouteBuildItem("config", "POST", new DevConsolePostHandler() { - @Override - protected void handlePost(RoutingContext event, MultiMap form) throws Exception { - String action = event.request().getFormAttribute("action"); - if (action.equals("updateProperty")) { - String name = event.request().getFormAttribute("name"); - String value = event.request().getFormAttribute("value"); - String wildcard = event.request().getFormAttribute("wildcard"); - if (!"true".equals(wildcard)) { - Map values = Collections.singletonMap(name, value); - updateConfig(values); - } else { - String newProp = name + value; - configDescriptionsManager.addNamedConfigGroup(newProp); - } - } else if (action.equals("copyDevServices") && devServicesLauncherConfig.isPresent()) { - String environment = event.request().getFormAttribute("environment"); - String filter = event.request().getParam("filterConfigKeys"); - List configFilter = getConfigFilter(filter); - Map autoconfig = devServicesLauncherConfig.get().getConfig(); - - autoconfig = filterAndApplyProfile(autoconfig, configFilter, environment.toLowerCase()); - - updateConfig(autoconfig); - } else if (action.equals("updateProperties")) { - String values = event.request().getFormAttribute("values"); - setConfig(values); - } - } - })); - - } - - public static String cleanUpAsciiDocIfNecessary(String docs) { - if (docs == null || !docs.toLowerCase(Locale.ROOT).contains("@asciidoclet")) { - return docs; - } - // TODO #26199 Ideally we'd use a proper AsciiDoc renderer, but for now we'll just clean it up a bit. - return docs.replace("@asciidoclet", "") - // Avoid problems with links. - .replace("<<", "<<") - .replace(">>", ">>") - // Try to render line breaks... kind of. - .replace("\n\n", "

") - .replace("\n", "
"); - } - - @BuildStep - void handleRequests(BuildProducer devConsoleRouteProducer, - Optional devServicesLauncherConfig) { - - CurrentConfig.EDITOR = ConfigEditorProcessor::updateConfig; - - devConsoleRouteProducer.produce(new DevConsoleRouteBuildItem("config/all", "GET", (e) -> { - e.end(Buffer.buffer(getConfig())); - })); - } - - private Map filterAndApplyProfile(Map autoconfig, List configFilter, - String profile) { - return autoconfig.entrySet().stream() - .filter((t) -> { - if (configFilter != null && !configFilter.isEmpty()) { - for (String sw : configFilter) { - if (t.getKey().startsWith(sw)) { - return true; - } - } - } else { - return true; - } - return false; - }) - .collect(Collectors.toMap( - e -> appendProfile(profile, e.getKey()), - Map.Entry::getValue)); - } - - private List getConfigFilter(String filter) { - if (filter != null && !filter.isEmpty()) { - if (filter.contains(",")) { - return Arrays.asList(filter.split(",")); - } else { - return List.of(filter); - } - } - return Collections.EMPTY_LIST; - } - - private String appendProfile(String profile, String originalKey) { - return String.format("%%%s.%s", profile, originalKey); - } - - static byte[] getConfig() { - try { - List resourcesDir = DevConsoleManager.getHotReplacementContext().getResourcesDir(); - if (resourcesDir.isEmpty()) { - throw new IllegalStateException("Unable to manage configurations - no resource directory found"); - } - - // In the current project only - Path path = resourcesDir.get(0); - Path configPath = path.resolve("application.properties"); - if (!Files.exists(configPath)) { - return "".getBytes(); - } - - return Files.readAllBytes(configPath); - - } catch (Throwable t) { - throw new RuntimeException(t); - } - } - - public static void updateConfig(Map values) { - updateConfig(values, true); - } - - public static void updateConfig(Map values, boolean preventKill) { - if (values != null && !values.isEmpty()) { - try { - Path configPath = getConfigPath(); - List lines = Files.readAllLines(configPath); - for (Map.Entry entry : values.entrySet()) { - String name = entry.getKey(); - String value = entry.getValue(); - int nameLine = -1; - for (int i = 0, linesSize = lines.size(); i < linesSize; i++) { - String line = lines.get(i); - if (line.startsWith(name + "=")) { - nameLine = i; - break; - } - } - if (nameLine != -1) { - if (value.isEmpty()) { - lines.remove(nameLine); - } else { - lines.set(nameLine, name + "=" + value); - } - } else { - if (!value.isEmpty()) { - lines.add(name + "=" + value); - } - } - } - - try (BufferedWriter writer = Files.newBufferedWriter(configPath)) { - for (String i : lines) { - writer.write(i); - writer.newLine(); - } - } - if (preventKill) - preventKill(); - } catch (Throwable t) { - throw new RuntimeException(t); - } - } - } - - public static void setConfig(String value) { - setConfig(value, true); - } - - public static void setConfig(String value, boolean preventKill) { - try { - Path configPath = getConfigPath(); - try (BufferedWriter writer = Files.newBufferedWriter(configPath)) { - if (value == null || value.isEmpty()) { - writer.newLine(); - } else { - writer.write(value); - } - } - if (preventKill) - preventKill(); - } catch (Throwable t) { - throw new RuntimeException(t); - } - } - - private static void preventKill() throws Exception { - //if we don't set this the connection will be killed on restart - DevConsoleManager.setDoingHttpInitiatedReload(true); - try { - DevConsoleManager.getHotReplacementContext().doScan(true); - } finally { - DevConsoleManager.setDoingHttpInitiatedReload(false); - } - } - - private static Path getConfigPath() throws IOException { - List resourcesDir = DevConsoleManager.getHotReplacementContext().getResourcesDir(); - if (resourcesDir.isEmpty()) { - throw new IllegalStateException("Unable to manage configurations - no resource directory found"); - } - - // In the current project only - Path path = resourcesDir.get(0); - Path configPath = path.resolve("application.properties"); - if (!Files.exists(configPath)) { - Files.createDirectories(configPath.getParent()); - configPath = Files.createFile(path.resolve("application.properties")); - } - return configPath; - } - - public static boolean isSetByDevServices(Optional devServicesLauncherConfig, - String propertyName) { - if (devServicesLauncherConfig.isPresent()) { - return devServicesLauncherConfig.get().getConfig().containsKey(propertyName); - } - return false; - } - - @GroupCommandDefinition(name = "config", description = "Config Editing Commands") - public static class ConfigCommandGroup implements GroupCommand { - - final ConfigDescriptionsManager configDescriptionsManager; - - @Option(shortName = 'h', hasValue = false, overrideRequired = true) - public boolean help; - - public ConfigCommandGroup(ConfigDescriptionsManager configDescriptionsManager) { - this.configDescriptionsManager = configDescriptionsManager; - } - - @Override - public List getCommands() { - return List.of(new SetConfigCommand(configDescriptionsManager)); - } - - @Override - public CommandResult execute(CommandInvocation commandInvocation) throws CommandException, InterruptedException { - commandInvocation.getShell().writeln(commandInvocation.getHelpInfo()); - return CommandResult.SUCCESS; - } - } - - @CommandDefinition(name = "set", description = "Sets a config value", validator = SetValidator.class) - public static class SetConfigCommand implements Command { - - final ConfigDescriptionsManager configDescriptionsManager; - - @Argument(required = true, completer = SetConfigCompleter.class) - private String command; - - public SetConfigCommand(ConfigDescriptionsManager configDescriptionsManager) { - this.configDescriptionsManager = configDescriptionsManager; - } - - @Override - public CommandResult execute(CommandInvocation commandInvocation) throws CommandException, InterruptedException { - int pos = command.indexOf('='); - String key = command.substring(0, pos); - String value = command.substring(pos + 1); - CurrentConfig.EDITOR.accept(Map.of(key, value)); - return CommandResult.SUCCESS; - } - } - - public static class SetConfigCompleter implements OptionCompleter { - - @Override - public void complete(CompleterInvocation completerInvocation) { - String soFar = completerInvocation.getGivenCompleteValue(); - String configKey = null; - if (soFar.indexOf('=') != -1) { - configKey = soFar.substring(0, soFar.indexOf('=')); - } - SetConfigCommand command = (SetConfigCommand) completerInvocation.getCommand(); - Set possible = new HashSet<>(); - for (var j : command.configDescriptionsManager.values().values()) { - for (var i : j) { - if (i.getDescription() == null) { - continue; - } - //we have found the entry for the selected key - if (configKey != null && configKey.equals(i.getName())) { - if (i.getAllowedValues() != null && !i.getAllowedValues().isEmpty()) { - for (String val : i.getAllowedValues()) { - String value = i.getName() + "=" + val; - if (value.startsWith(soFar)) { - completerInvocation.addCompleterValue(value); - } - } - } - return; - } - if (i.isWildcardEntry()) { - continue; - } - if (i.getName().equals(soFar)) { - possible.add(soFar + "="); - } else if (i.getName().startsWith(soFar)) { - //we just want to complete the next segment - int pos = i.getName().indexOf('.', soFar.length() + 1); - if (pos == -1) { - possible.add(i.getName() + "="); - } else { - possible.add(i.getName().substring(0, pos) + "."); - } - } - } - } - completerInvocation.setAppendSpace(false); - completerInvocation.addAllCompleterValues(possible); - - } - } - - public static class SetValidator implements CommandValidator { - - @Override - public void validate(SetConfigCommand command) throws CommandValidatorException { - //-1 because the last char can't be equals - for (int i = 0; i < command.command.length() - 1; ++i) { - if (command.command.charAt(i) == '=') { - return; - } - } - throw new CommandValidatorException("Set command must be in the form key=value"); - } - } - -} diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleFailedStartHandler.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleFailedStartHandler.java index 89fc0f2d9185c..da733c5769dcf 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleFailedStartHandler.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleFailedStartHandler.java @@ -2,11 +2,12 @@ import io.quarkus.dev.config.CurrentConfig; import io.quarkus.dev.spi.DeploymentFailedStartHandler; +import io.quarkus.devui.deployment.menu.ConfigurationProcessor; public class DevConsoleFailedStartHandler implements DeploymentFailedStartHandler { @Override public void handleFailedInitialStart() { DevConsoleProcessor.initializeVirtual(); - CurrentConfig.EDITOR = ConfigEditorProcessor::updateConfig; + CurrentConfig.EDITOR = ConfigurationProcessor::updateConfig; } } diff --git a/extensions/vertx-http/deployment/src/main/resources/dev-templates/index.html b/extensions/vertx-http/deployment/src/main/resources/dev-templates/index.html index aaf619e193ee9..58f57398de474 100644 --- a/extensions/vertx-http/deployment/src/main/resources/dev-templates/index.html +++ b/extensions/vertx-http/deployment/src/main/resources/dev-templates/index.html @@ -4,23 +4,6 @@

-
-
-
- Configuration - - - -
- -
-
{#each actionableExtensions} {#actionableExtension it/} {/each} diff --git a/extensions/vertx-http/deployment/src/main/resources/dev-templates/io.quarkus.quarkus-vertx-http/config.html b/extensions/vertx-http/deployment/src/main/resources/dev-templates/io.quarkus.quarkus-vertx-http/config.html deleted file mode 100644 index 2df31d7407937..0000000000000 --- a/extensions/vertx-http/deployment/src/main/resources/dev-templates/io.quarkus.quarkus-vertx-http/config.html +++ /dev/null @@ -1,579 +0,0 @@ -{#include main fluid=true} -{#style} -table { - table-layout:fixed; - width:100%; -} - -td { - word-wrap:break-word; - word-break:break-all; -} - -#tables{ - margin-bottom: unset; -} - -.mousePointer:hover { - cursor: pointer; -} - -.formInputButton:hover { - color: #3366ac !important; - cursor: pointer; -} - -#filterInputGroup { - padding-bottom: 10px; -} -{/style} - -{#styleref} - - -{/styleref} - -{#script} -$(document).ready(function(){ - $("#filterInput").on("keyup", function() { - var value = $(this).val().toLowerCase(); - $(".configTable tr").filter(function() { - $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1); - }); - hideEmptyTables(); - }); - - $(".configInput").on("keyup", function(event) { - event.preventDefault(); - if (event.keyCode === 13) { - event.preventDefault(); - changeInputValue(event.target.id); - } - }); - - $(function () { - $('[data-toggle="tooltip"]').tooltip() - }); - -}); - -function clearFilterInput(){ - $("#filterInput").val(""); - $(".configTable tr").each(function() { - $(this).toggle(true) - }); - hideEmptyTables(); -} - -function changeSelectValue(element, name){ - var $el = $("select[id='" + name + "']"); - var $tr = $("tr[id='tr-" + name + "']"); - var value = element.options[element.selectedIndex].text; - - postChangeConfigValue(name, value, $el); -} - -function changeCheckboxValue(element, name){ - var $el = $("input[id='" + name + "']"); - var $tr = $("tr[id='tr-" + name + "']"); - var value = element.checked; - - postChangeConfigValue(name, value, $el); -} - -function changeInputValue(name){ - var $el = $("input[id='" + name + "']"); - var $tr = $("tr[id='tr-" + name + "']"); - var value = $el.val(); - - postChangeConfigValue(name, value, $el); -} - -function postChangeConfigValue(name, value, $el){ - $el.prop('disabled', true); - $.post("", - { - action: "updateProperty", - name: name, - value: value - }, - function(data, status){ - if(status === "success"){ - showToastMessage("Update", "Configuration update successful"); - hideEmptyTables(); - changeBackgroundColor("#76be6b", $el); - }else{ - showToastMessage("Update", "Configuration update failed"); - hideEmptyTables(); - changeBackgroundColor("#ff6366", $el); - } - $el.prop('disabled', false); - }); - -} - -function changeBackgroundColor(color, element){ - var x = 3000; - var originalColor = element.css("background"); - - element.css("background", color); - setTimeout(function(){ - element.css("background", originalColor); - }, x); -} - -function showApplicationPropertiesFile(){ - $(".application-properties-form").hide(); - $(".application-properties-file").show(); - reloadApplicationPropertiesFile(); -} - -function showApplicationPropertiesForm(){ - reloadApplicationPropertiesForm(); - $(".application-properties-file").hide(); - $(".application-properties-form").show(); - -} - -function saveApplicationPropertiesFile(){ - var properties = editor.getDoc().getValue(); - $.post("", - { - action: "updateProperties", - values: properties - }, - function(data, status){ - if(status === "success"){ - showToastMessage("Update", "Configuration update successful"); - }else{ - showToastMessage("Update", "Configuration update failed"); - } - hideEmptyTables(); - reloadApplicationPropertiesFile(); - }); -} - -function reloadApplicationPropertiesFile(){ - - $.get("config/all", - function(data, status){ - if(status === "success"){ - editor.getDoc().setValue(data); - }else{ - showToastMessage("Properties file", "Failed to load properties"); - } - }); -} - -function reloadApplicationPropertiesForm(){ - $.get("config", - function(data, status){ - if(status === "success"){ - var formPart = $('#tables', data); - $('#tables').replaceWith(formPart); - }else{ - showToastMessage("Properties file", "Failed to load properties"); - } - }); -} - -function copyTestDevServices(){ - copyDevServices("Test"); -} - -function copyProdDevServices(){ - copyDevServices("Prod"); -} - -function copyDevServices(environment){ - $.post("", - { - action: "copyDevServices", - environment: environment, - filter: configfilter - }, - function(data, status){ - if(status === "success"){ - showToastMessage("DevServices", "All configuration automatically set by DevServices copied for " + environment); - }else{ - showToastMessage("DevServices", "Failed to copied configuration for " + environment); - } - reloadApplicationPropertiesFile(); - }); -} - -var editor = CodeMirror.fromTextArea(document.getElementById("code"), { - mode: "properties", - styleActiveLine: true, - lineNumbers: true, - lineWrapping: true, - extraKeys: {"Ctrl-Space": "autocomplete"} -}); - -editor.setSize(null, getEditorHeight()); -editor.on("blur", function(codeMirror) { codeMirror.save(); }); -editor.refresh(); - -$('.application-properties-file').hide(); -$('#application-properties-form').css('height',getFormHeight()); - -function getEditorHeight(){ - let headerBar = document.querySelector('#stickyTopHeaderNavBar'); - let headerBarHeight = headerBar.offsetHeight; - - let editorBar = document.querySelector('#editorNavBar'); - let editorBarHeight = editorBar.offsetHeight; - - let footerBarHeight = 80; - - return window.innerHeight-headerBarHeight - editorBarHeight - footerBarHeight; -} - -function getFormHeight(){ - let headerBar = document.querySelector('#stickyTopHeaderNavBar'); - let headerBarHeight = headerBar.offsetHeight; - - let filterInput = document.querySelector('#filterInputGroup'); - let filterInputHeight = filterInput.offsetHeight; - - let tableHeader = document.querySelector('#formTableHeader'); - let tableHeaderHeight = tableHeader.offsetHeight; - - let footerBarHeight = 95; - - return window.innerHeight-headerBarHeight - filterInputHeight - tableHeaderHeight - footerBarHeight; -} - - -var configfilter = ""; -$('#configCurrentFilter').hide(); - -const queryParams = new URLSearchParams(window.location.search); - -var filterByExtensionName = ""; -if(queryParams.has("filterByExtension")){ - filterByExtensionName = queryParams.get("filterByExtension"); -} -var filterConfigKeys = ""; -if(queryParams.has("filterConfigKeys")){ - filterConfigKeys = queryParams.get("filterConfigKeys"); -} - -if(filterConfigKeys!=="" && filterByExtensionName!==""){ - filterByConfigExtension(filterByExtensionName,filterConfigKeys); -} - -$('#configFilterModal').on('shown.bs.modal', function () { - $('#configFilterModalInput').trigger('focus'); -}); - -configFilterModalInput.addEventListener("keyup", function(event) { - if (event.keyCode === 13) { - event.preventDefault(); - configFilterModalInputButton.click(); - } -}); - -configFilterModalInputButton.addEventListener("click", applyConfigFilter); - -function applyConfigFilter(){ - filterByConfigExtension($('#configFilterModalInput').find(":selected").text(), $('#configFilterModalInput').find(":selected").val()); -} - -function filterByConfigExtension(configfilterText, configfilterKeys){ - if(configfilterKeys.startsWith("[") && configfilterKeys.endsWith("]")){ - configfilterKeys = configfilterKeys.substring(1, configfilterKeys.length-1); - } - - configfilter = configfilterKeys.split(","); - $('#configCurrentFilter').show(); - configCurrentFilter.innerHTML = "" + configfilterText + " "; - - $(".filterableConfigKey").each(function() { - var ck = $(this).text().trim(); - var hide = true; - configfilter.forEach(function (item, index) { - item = item.trim(); - if(ck.startsWith(item)){ - hide = false; - } - }); - if(hide){ - $(this).parent().hide(); - } - }); - - $('#configFilterModal').modal('hide'); - - showHideDevServicesButton(); - - hideEmptyTables(); -} - -function showHideDevServicesButton(){ - // Check if there is any dev services visible on the page - var numberOfMagicConfig = $('.fa-magic:visible').length; - if(numberOfMagicConfig === 0){ - $('.devservices').hide(); - }else { - $('.devservices').show(); - } -} - -function hideEmptyTables(){ - - $('.filterableTable').filter(function(index){ - var tableTrNumber = $(this).find('tr').length; - var tableTrHiddenNumber = $(this).find('tr:hidden').length + 1; - if(tableTrNumber == tableTrHiddenNumber){ - $(this).hide(); - }else{ - $(this).show(); - } - }); -} - -function clearConfigFilter(){ - configfilter = ""; - $("#configFilterModalInput").val(""); - configCurrentFilter.innerHTML = ""; - $('#configCurrentFilter').hide(); - - $(".filterableConfigKey").each(function() { - $(this).parent().show(); - }); - clearFilterInput(); - showHideDevServicesButton(); -} - -{/script} - -{#scriptref} - - - - -{/scriptref} - -{#title}Config Editor{/title} -{#body} - - -
-
- - - - - - -
- -
- -
-
- {#if info:hasDevServices} -
- - -
- {/if} - -
-
- -
- - - - - - - - -
PropertyValueDescription
- -
- {#for configsource in info:config.values()} - -
- - - - - - - - - {#for item in configsource.value} - - - - - - - {/for} - -
{configsource.key}
- {#if item.configPhase?? && (item.configPhase == "BUILD_AND_RUN_TIME_FIXED" || item.configPhase == "BUILD_TIME")} - - {/if} - - {item.configValue.name} - - {#if item.autoFromDevServices} - - {/if} - {#if item.wildcardEntry} - - {/if} - - - {#if item.wildcardEntry} -
-
- - -
- -
-
-
- {#else if item.typeName && item.typeName == "java.lang.Boolean"} -
-
- - -
-
- {#else if item.typeName && (item.typeName == "java.lang.Integer" || item.typeName == "java.lang.Long")} -
- -
- -
-
- {#else if item.typeName && (item.typeName == "java.lang.Float" || item.typeName == "java.lang.Double")} -
- -
- -
-
- {#else if item.typeName && (item.typeName == "java.lang.Enum" || item.typeName == "java.util.logging.Level")} -
- -
- {#else} -
- -
- -
-
- - {/if} -
- {#let description=item.description.fmtJavadoc??} {#if description} -

{description}

- {/} {/} - {#if configsource.key.showEnvVarName} -
- Environment variable: {item.configValue.name.toEnvVar} -
- {/} -
-
- {/for} -
-
- -
- - -
- -
- -
- - - -{/body} -{/include} diff --git a/extensions/vertx-http/deployment/src/main/resources/dev-templates/tags/actionableExtension.html b/extensions/vertx-http/deployment/src/main/resources/dev-templates/tags/actionableExtension.html index ced8561a6df8a..abb50980659bf 100644 --- a/extensions/vertx-http/deployment/src/main/resources/dev-templates/tags/actionableExtension.html +++ b/extensions/vertx-http/deployment/src/main/resources/dev-templates/tags/actionableExtension.html @@ -24,10 +24,5 @@ {/if}

- {#if it.metadata.config??} - - {/if}
diff --git a/extensions/vertx-http/deployment/src/main/resources/dev-templates/tags/nonActionableExtension.html b/extensions/vertx-http/deployment/src/main/resources/dev-templates/tags/nonActionableExtension.html index c6065930c904d..2f7543b664b6b 100644 --- a/extensions/vertx-http/deployment/src/main/resources/dev-templates/tags/nonActionableExtension.html +++ b/extensions/vertx-http/deployment/src/main/resources/dev-templates/tags/nonActionableExtension.html @@ -24,10 +24,5 @@ {/if}

- {#if it.metadata.config??} - - {/if} \ No newline at end of file diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigEditorBodyHandlerTest.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigEditorBodyHandlerTest.java index 484155820e7b7..f8b2837e2f574 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigEditorBodyHandlerTest.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigEditorBodyHandlerTest.java @@ -1,8 +1,11 @@ package io.quarkus.vertx.http.devconsole; +import java.util.Map; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import io.quarkus.devui.tests.DevUIJsonRPCTest; import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; @@ -13,25 +16,26 @@ * The config editor is a deployment side handler, so this test that the deployment side functions of the dev console * handle body handlers correctly. */ -public class DevConsoleConfigEditorBodyHandlerTest { +public class DevConsoleConfigEditorBodyHandlerTest extends DevUIJsonRPCTest { @RegisterExtension static final QuarkusDevModeTest config = new QuarkusDevModeTest() .withApplicationRoot((jar) -> jar.addClass(BodyHandlerBean.class)); + public DevConsoleConfigEditorBodyHandlerTest() { + super("devui-configuration"); + } + @Test - public void testChangeHttpRoute() { + public void testChangeHttpRoute() throws Exception { RestAssured.with() .get("q/arc/beans") .then() .statusCode(200); - RestAssured.with().formParam("name", "quarkus.http.root-path") - .formParam("value", "/foo") - .formParam("action", "updateProperty") - .redirects().follow(false) - .post("q/dev-v1/io.quarkus.quarkus-vertx-http/config") - .then() - .statusCode(303); + super.executeJsonRPCMethod("updateProperty", + Map.of( + "name", "quarkus.http.root-path", + "value", "/foo")); RestAssured.with() .get("q/arc/beans") .then() diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigEditorTest.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigEditorTest.java index eb8795f235ce6..3290b3a5a8c28 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigEditorTest.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigEditorTest.java @@ -1,30 +1,34 @@ package io.quarkus.vertx.http.devconsole; +import java.util.Map; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import io.quarkus.devui.tests.DevUIJsonRPCTest; import io.quarkus.test.QuarkusDevModeTest; import io.restassured.RestAssured; -public class DevConsoleConfigEditorTest { +public class DevConsoleConfigEditorTest extends DevUIJsonRPCTest { @RegisterExtension static final QuarkusDevModeTest config = new QuarkusDevModeTest() .withEmptyApplication(); + public DevConsoleConfigEditorTest() { + super("devui-configuration"); + } + @Test - public void testChangeHttpRoute() { + public void testChangeHttpRoute() throws Exception { RestAssured.with() .get("q/arc/beans") .then() .statusCode(200); - RestAssured.with().formParam("name", "quarkus.http.root-path") - .formParam("value", "/foo") - .formParam("action", "updateProperty") - .redirects().follow(false) - .post("q/dev-v1/io.quarkus.quarkus-vertx-http/config") - .then() - .statusCode(303); + super.executeJsonRPCMethod("updateProperty", + Map.of( + "name", "quarkus.http.root-path", + "value", "/foo")); RestAssured.with() .get("q/arc/beans") .then() @@ -37,18 +41,15 @@ public void testChangeHttpRoute() { } @Test - public void testSetEmptyValue() { + public void testSetEmptyValue() throws Exception { RestAssured.with() .get("q/arc/beans") .then() .statusCode(200); - RestAssured.with().formParam("name", "quarkus.http.root-path") - .formParam("value", "") - .formParam("action", "updateProperty") - .redirects().follow(false) - .post("q/dev-v1/io.quarkus.quarkus-vertx-http/config") - .then() - .statusCode(303); + super.executeJsonRPCMethod("updateProperty", + Map.of( + "name", "quarkus.http.root-path", + "value", "")); RestAssured.with() .get("q/arc/beans") .then() diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigMisinterpretedDoubleUnderscoreTest.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigMisinterpretedDoubleUnderscoreTest.java index 6314a417481f8..d210591ff8bdd 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigMisinterpretedDoubleUnderscoreTest.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleConfigMisinterpretedDoubleUnderscoreTest.java @@ -25,8 +25,8 @@ public class DevConsoleConfigMisinterpretedDoubleUnderscoreTest { @Test public void testNoFailure() { - RestAssured.get("q/dev-v1/io.quarkus.quarkus-vertx-http/config") + RestAssured.get("q/dev-ui/configuration-form-editor") .then() - .statusCode(200).body(Matchers.containsString("Config Editor")); + .statusCode(200).body(Matchers.containsString("loading")); } } diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleCorsTest.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleCorsTest.java index 67488658358a9..fa899341ad7fe 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleCorsTest.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devconsole/DevConsoleCorsTest.java @@ -24,7 +24,7 @@ public void testPreflightHttpLocalhostOrigin() { .header("Origin", origin) .header("Access-Control-Request-Method", methods) .when() - .options("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .options("q/dev-ui/configuration-form-editor").then() .statusCode(200) .header("Access-Control-Allow-Origin", origin) .header("Access-Control-Allow-Methods", methods) @@ -39,7 +39,7 @@ public void testPreflightHttpLocalhostIpOrigin() { .header("Origin", origin) .header("Access-Control-Request-Method", methods) .when() - .options("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .options("q/dev-ui/configuration-form-editor").then() .statusCode(200) .header("Access-Control-Allow-Origin", origin) .header("Access-Control-Allow-Methods", methods) @@ -54,7 +54,7 @@ public void testPreflightHttpsLocalhostOrigin() { .header("Origin", origin) .header("Access-Control-Request-Method", methods) .when() - .options("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .options("q/dev-ui/configuration-form-editor").then() .statusCode(200) .header("Access-Control-Allow-Origin", origin) .header("Access-Control-Allow-Methods", methods) @@ -69,7 +69,7 @@ public void testPreflightHttpsLocalhostIpOrigin() { .header("Origin", origin) .header("Access-Control-Request-Method", methods) .when() - .options("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .options("q/dev-ui/configuration-form-editor").then() .statusCode(200) .header("Access-Control-Allow-Origin", origin) .header("Access-Control-Allow-Methods", methods) @@ -83,7 +83,7 @@ public void testPreflightNonLocalhostOrigin() { .header("Origin", "https://quarkus.io/http://localhost") .header("Access-Control-Request-Method", methods) .when() - .options("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .options("q/dev-ui/configuration-form-editor").then() .statusCode(403) .header("Access-Control-Allow-Origin", nullValue()) .header("Access-Control-Allow-Methods", nullValue()) @@ -97,7 +97,7 @@ public void testPreflightBadLocalhostOrigin() { .header("Origin", "http://localhost:8080/devui") .header("Access-Control-Request-Method", methods) .when() - .options("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .options("q/dev-ui/configuration-form-editor").then() .statusCode(403) .header("Access-Control-Allow-Origin", nullValue()) .body(emptyOrNullString()); @@ -110,7 +110,7 @@ public void testPreflightBadLocalhostIpOrigin() { .header("Origin", "http://127.0.0.1:8080/devui") .header("Access-Control-Request-Method", methods) .when() - .options("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .options("q/dev-ui/configuration-form-editor").then() .statusCode(403) .header("Access-Control-Allow-Origin", nullValue()) .body(emptyOrNullString()); @@ -123,7 +123,7 @@ public void testPreflightLocalhostOriginWithoutPort() { .header("Origin", "http://localhost") .header("Access-Control-Request-Method", methods) .when() - .options("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .options("q/dev-ui/configuration-form-editor").then() .statusCode(403) .header("Access-Control-Allow-Origin", nullValue()) .body(emptyOrNullString()); @@ -135,7 +135,7 @@ public void testSimpleRequestHttpLocalhostOrigin() { RestAssured.given() .header("Origin", origin) .when() - .get("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .get("q/dev-ui/configuration-form-editor").then() .statusCode(200) .header("Access-Control-Allow-Origin", origin) .header("Access-Control-Allow-Methods", nullValue()) @@ -148,7 +148,7 @@ public void testSimpleRequestHttpLocalhostIpOrigin() { RestAssured.given() .header("Origin", origin) .when() - .get("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .get("q/dev-ui/configuration-form-editor").then() .statusCode(200) .header("Access-Control-Allow-Origin", origin) .header("Access-Control-Allow-Methods", nullValue()) @@ -161,7 +161,7 @@ public void testSimpleRequestHttpsLocalhostOrigin() { RestAssured.given() .header("Origin", origin) .when() - .get("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .get("q/dev-ui/configuration-form-editor").then() .statusCode(200) .header("Access-Control-Allow-Origin", origin) .header("Access-Control-Allow-Methods", nullValue()) @@ -174,7 +174,7 @@ public void testSimpleRequestHttpsLocalhostIpOrigin() { RestAssured.given() .header("Origin", origin) .when() - .get("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .get("q/dev-ui/configuration-form-editor").then() .statusCode(200) .header("Access-Control-Allow-Origin", origin) .header("Access-Control-Allow-Methods", nullValue()) @@ -186,7 +186,7 @@ public void testSimpleRequestNonLocalhostOrigin() { RestAssured.given() .header("Origin", "https://quarkus.io/http://localhost") .when() - .get("q/dev-v1/io.quarkus.quarkus-vertx-http/config").then() + .get("q/dev-ui/configuration-form-editor").then() .statusCode(403) .header("Access-Control-Allow-Origin", nullValue()) .body(emptyOrNullString()); diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescription.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDescription.java similarity index 98% rename from extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescription.java rename to extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDescription.java index 7f772777fd7df..7663dc2838e14 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescription.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDescription.java @@ -1,4 +1,4 @@ -package io.quarkus.vertx.http.runtime.devmode; +package io.quarkus.devui.runtime.config; import java.util.List; diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDescriptionBean.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDescriptionBean.java index 7d687de6770bc..efff206a81a2e 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDescriptionBean.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDescriptionBean.java @@ -2,8 +2,6 @@ import java.util.List; -import io.quarkus.vertx.http.runtime.devmode.ConfigDescription; - public class ConfigDescriptionBean { private List allConfig; diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDevUiRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDevUIRecorder.java similarity index 98% rename from extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDevUiRecorder.java rename to extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDevUIRecorder.java index bc1ef42721023..c4ca99a1391e7 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDevUiRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigDevUIRecorder.java @@ -14,12 +14,11 @@ import org.eclipse.microprofile.config.spi.ConfigSource; import io.quarkus.runtime.annotations.Recorder; -import io.quarkus.vertx.http.runtime.devmode.ConfigDescription; import io.smallrye.config.ConfigValue; import io.smallrye.config.SmallRyeConfig; @Recorder -public class ConfigDevUiRecorder { +public class ConfigDevUIRecorder { private static final String QUOTED_DOT = "\".\""; private static final String QUOTED_DOT_KEY = "$$QUOTED_DOT$$"; @@ -27,8 +26,8 @@ public class ConfigDevUiRecorder { private static Set devServicesConfig; public void registerConfigs(final List configDescriptions, final Set devServicesConfig) { - ConfigDevUiRecorder.configDescriptions = configDescriptions; - ConfigDevUiRecorder.devServicesConfig = devServicesConfig; + ConfigDevUIRecorder.configDescriptions = configDescriptions; + ConfigDevUIRecorder.devServicesConfig = devServicesConfig; } public Supplier configDescriptionBean() { diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigJsonRPCService.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigJsonRPCService.java index 289565ef5b588..e9f2e00d5c825 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigJsonRPCService.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/config/ConfigJsonRPCService.java @@ -18,7 +18,6 @@ import io.quarkus.dev.console.DevConsoleManager; import io.quarkus.devui.runtime.comms.JsonRpcMessage; import io.quarkus.devui.runtime.comms.MessageType; -import io.quarkus.vertx.http.runtime.devmode.ConfigDescription; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManager.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManager.java index 98becec8c3602..3572733e61cf0 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManager.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManager.java @@ -16,6 +16,7 @@ import org.eclipse.microprofile.config.spi.ConfigSource; import io.quarkus.devconsole.runtime.spi.DevConsolePostHandler; +import io.quarkus.devui.runtime.config.ConfigDescription; import io.smallrye.config.ConfigValue; import io.smallrye.config.SmallRyeConfig; import io.vertx.core.MultiMap; diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsRecorder.java deleted file mode 100644 index aaf82e33425b4..0000000000000 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsRecorder.java +++ /dev/null @@ -1,14 +0,0 @@ -package io.quarkus.vertx.http.runtime.devmode; - -import java.util.List; -import java.util.Set; - -import io.quarkus.runtime.annotations.Recorder; - -@Recorder -public class ConfigDescriptionsRecorder { - - public ConfigDescriptionsManager manager(List descriptions, Set devServicesProperties) { - return new ConfigDescriptionsManager(descriptions, devServicesProperties); - } -} diff --git a/extensions/vertx-http/runtime/src/test/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManagerUnitTest.java b/extensions/vertx-http/runtime/src/test/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManagerUnitTest.java index 96baeac1b91d7..593be9aead61e 100644 --- a/extensions/vertx-http/runtime/src/test/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManagerUnitTest.java +++ b/extensions/vertx-http/runtime/src/test/java/io/quarkus/vertx/http/runtime/devmode/ConfigDescriptionsManagerUnitTest.java @@ -8,6 +8,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import io.quarkus.devui.runtime.config.ConfigDescription; import io.smallrye.config.PropertiesConfigSource; public class ConfigDescriptionsManagerUnitTest { diff --git a/integration-tests/devmode/src/test/java/io/quarkus/test/devconsole/DevConsoleConfigSmokeTest.java b/integration-tests/devmode/src/test/java/io/quarkus/test/devconsole/DevConsoleConfigSmokeTest.java deleted file mode 100644 index 401b1b8e1f38a..0000000000000 --- a/integration-tests/devmode/src/test/java/io/quarkus/test/devconsole/DevConsoleConfigSmokeTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package io.quarkus.test.devconsole; - -import org.hamcrest.Matchers; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -import io.quarkus.test.QuarkusDevModeTest; -import io.restassured.RestAssured; - -/** - * Note that this test cannot be placed under the relevant {@code -deployment} module because then the DEV UI processor would - * not be able to locate the template resources correctly. - */ -public class DevConsoleConfigSmokeTest { - - @RegisterExtension - static final QuarkusDevModeTest config = new QuarkusDevModeTest() - .withEmptyApplication(); - - @Test - public void testConfigEditor() { - RestAssured.get("q/dev-v1/io.quarkus.quarkus-vertx-http/config") - .then() - .statusCode(200).body(Matchers.containsString("Config Editor")); - - } -}