diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java index 7645cc96b49da..5c59ad4e2ca26 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java @@ -20,11 +20,17 @@ public final class DevServicesResultBuildItem extends MultiBuildItem { private final String name; + private final String description; private final String containerId; private final Map config; public DevServicesResultBuildItem(String name, String containerId, Map config) { + this(name, null, containerId, config); + } + + public DevServicesResultBuildItem(String name, String description, String containerId, Map config) { this.name = name; + this.description = description; this.containerId = containerId; this.config = config; } @@ -33,6 +39,10 @@ public String getName() { return name; } + public String getDescription() { + return description; + } + public String getContainerId() { return containerId; } @@ -44,6 +54,7 @@ public Map getConfig() { public static class RunningDevService implements Closeable { private final String name; + private final String description; private final String containerId; private final Map config; private final Closeable closeable; @@ -54,12 +65,25 @@ private static Map mapOf(String key, String value) { return map; } - public RunningDevService(String name, String containerId, Closeable closeable, String key, String value) { - this(name, containerId, closeable, mapOf(key, value)); + public RunningDevService(String name, String containerId, Closeable closeable, String key, + String value) { + this(name, null, containerId, closeable, mapOf(key, value)); + } + + public RunningDevService(String name, String description, String containerId, Closeable closeable, String key, + String value) { + this(name, description, containerId, closeable, mapOf(key, value)); + } + + public RunningDevService(String name, String containerId, Closeable closeable, + Map config) { + this(name, null, containerId, closeable, config); } - public RunningDevService(String name, String containerId, Closeable closeable, Map config) { + public RunningDevService(String name, String description, String containerId, Closeable closeable, + Map config) { this.name = name; + this.description = description; this.containerId = containerId; this.closeable = closeable; this.config = Collections.unmodifiableMap(config); @@ -69,6 +93,10 @@ public String getName() { return name; } + public String getDescription() { + return description; + } + public String getContainerId() { return containerId; } @@ -93,7 +121,7 @@ public void close() throws IOException { } public DevServicesResultBuildItem toBuildItem() { - return new DevServicesResultBuildItem(name, containerId, config); + return new DevServicesResultBuildItem(name, description, containerId, config); } } } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/devservices/DevServiceDescriptionBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/devservices/DevServiceDescriptionBuildItem.java index c5b7651297c0e..e1898f49dee2c 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/devservices/DevServiceDescriptionBuildItem.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/devservices/DevServiceDescriptionBuildItem.java @@ -9,14 +9,22 @@ public final class DevServiceDescriptionBuildItem extends MultiBuildItem { private String name; + private String description; private ContainerInfo containerInfo; private Map configs; public DevServiceDescriptionBuildItem() { } - public DevServiceDescriptionBuildItem(String name, ContainerInfo containerInfo, Map configs) { + public DevServiceDescriptionBuildItem(String name, ContainerInfo containerInfo, + Map configs) { + this(name, null, containerInfo, configs); + } + + public DevServiceDescriptionBuildItem(String name, String description, ContainerInfo containerInfo, + Map configs) { this.name = name; + this.description = description; this.containerInfo = containerInfo; this.configs = configs instanceof SortedMap ? configs : new TreeMap<>(configs); } @@ -29,6 +37,10 @@ public String getName() { return name; } + public String getDescription() { + return description; + } + public ContainerInfo getContainerInfo() { return containerInfo; } @@ -41,6 +53,10 @@ public void setName(String name) { this.name = name; } + public void setDescription(String description) { + this.description = description; + } + public void setContainerInfo(ContainerInfo containerInfo) { this.containerInfo = containerInfo; } diff --git a/extensions/devservices/deployment/src/main/java/io/quarkus/devservices/deployment/DevServicesProcessor.java b/extensions/devservices/deployment/src/main/java/io/quarkus/devservices/deployment/DevServicesProcessor.java index eee6ef9f55134..c1af246c71515 100644 --- a/extensions/devservices/deployment/src/main/java/io/quarkus/devservices/deployment/DevServicesProcessor.java +++ b/extensions/devservices/deployment/src/main/java/io/quarkus/devservices/deployment/DevServicesProcessor.java @@ -130,7 +130,7 @@ private List buildServiceDescriptions( config.remove(key); } if (!config.isEmpty()) { - descriptions.add(new DevServiceDescriptionBuildItem("Additional Dev Services config", null, config)); + descriptions.add(new DevServiceDescriptionBuildItem("Additional Dev Services config", null, null, config)); } } return descriptions; @@ -151,9 +151,11 @@ private Map fetchContainerInfos(DockerStatusBuildItem dockerS private DevServiceDescriptionBuildItem toDevServiceDescription(DevServicesResultBuildItem buildItem, Container container) { if (container == null) { - return new DevServiceDescriptionBuildItem(buildItem.getName(), null, buildItem.getConfig()); + return new DevServiceDescriptionBuildItem(buildItem.getName(), buildItem.getDescription(), null, + buildItem.getConfig()); } else { - return new DevServiceDescriptionBuildItem(buildItem.getName(), toContainerInfo(container), buildItem.getConfig()); + return new DevServiceDescriptionBuildItem(buildItem.getName(), buildItem.getDescription(), + toContainerInfo(container), buildItem.getConfig()); } } diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/DevServicesProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/DevServicesProcessor.java index 228d1b1eb3d35..e1a317e322dc0 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/DevServicesProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/menu/DevServicesProcessor.java @@ -1,9 +1,13 @@ package io.quarkus.devui.deployment.menu; +import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.TreeMap; import io.quarkus.deployment.IsDevelopment; import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.DevServicesResultBuildItem; import io.quarkus.deployment.dev.devservices.DevServiceDescriptionBuildItem; import io.quarkus.devui.deployment.InternalPageBuildItem; import io.quarkus.devui.spi.page.Page; @@ -14,7 +18,10 @@ public class DevServicesProcessor { @BuildStep(onlyIf = IsDevelopment.class) - InternalPageBuildItem createDevServicesPages(List devServiceDescriptions) { + InternalPageBuildItem createDevServicesPages(List devServiceDescriptions, + List devServicesResultBuildItems) { + + List otherDevServices = getOtherDevServices(devServicesResultBuildItems); InternalPageBuildItem devServicesPages = new InternalPageBuildItem("Dev Services", 40); @@ -24,9 +31,37 @@ InternalPageBuildItem createDevServicesPages(List combined = new TreeMap<>(); + addToMap(combined, devServiceDescriptions); + addToMap(combined, otherDevServices); + + devServicesPages.addBuildTimeData("devServices", combined.values()); return devServicesPages; } -} \ No newline at end of file + + private void addToMap(Map m, List list) { + if (!list.isEmpty()) { + for (DevServiceDescriptionBuildItem i : list) { + if (!m.containsKey(i.getName())) { + m.put(i.getName(), i); + } + } + } + } + + private List getOtherDevServices( + List devServicesResultBuildItems) { + List devServiceDescriptions = new ArrayList<>(); + for (DevServicesResultBuildItem devServicesResultBuildItem : devServicesResultBuildItems) { + if (devServicesResultBuildItem.getContainerId() == null) { + devServiceDescriptions.add(new DevServiceDescriptionBuildItem(devServicesResultBuildItem.getName(), + devServicesResultBuildItem.getDescription(), + null, + devServicesResultBuildItem.getConfig())); + } + } + return devServiceDescriptions; + } +} diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-dev-services.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-dev-services.js index 0b59e6c8a1f58..512d665a6b182 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-dev-services.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-dev-services.js @@ -38,6 +38,15 @@ export class QwcDevServices extends observeState(QwcHotReloadElement) { padding-left: 10px; background: var(--lumo-contrast-5pct); } + + .content { + padding: 15px; + } + + .description { + padding-bottom: 10px; + color: var(--lumo-contrast-50pct); + } `; static properties = { @@ -71,13 +80,20 @@ export class QwcDevServices extends observeState(QwcHotReloadElement) { _renderCard(devService){ return html` -
+
+ ${this._renderDescription(devService)} ${this._renderContainerDetails(devService)} ${this._renderConfigDetails(devService)}
`; } + _renderDescription(devService){ + if(devService.description){ + return html`
${devService.description}
`; + } + } + _renderContainerDetails(devService){ if (devService.containerInfo) { return html`