From 63edc9f9aa4e89804229688979186ff03f5f888f Mon Sep 17 00:00:00 2001 From: Phillip Kruger Date: Sun, 26 Mar 2023 10:14:08 +1100 Subject: [PATCH] Auto naming for Dev UI Signed-off-by: Phillip Kruger --- .../deployment/devui/ArcDevUIProcessor.java | 6 +- .../dev-ui/{arc => }/qwc-arc-beans.js | 2 +- .../dev-ui/{arc => }/qwc-arc-decorators.js | 3 +- .../dev-ui/{arc => }/qwc-arc-fired-events.js | 2 +- .../dev-ui/{arc => }/qwc-arc-interceptors.js | 2 +- .../{arc => }/qwc-arc-invocation-trees.js | 2 +- .../dev-ui/{arc => }/qwc-arc-observers.js | 2 +- .../{arc => }/qwc-arc-removed-components.js | 6 +- .../CacheDevUiProcessor.java} | 8 +- .../dev-ui/{cache => }/qwc-cache-caches.js | 2 +- .../devui/CaffeineDevUIProcessor.java | 2 +- .../{caffeine => }/qwc-caffeine-card.js | 10 +- .../ContainerImageDevUiProcessor.java | 4 +- .../qwc-container-image-build.js | 25 +-- .../devservices/DevUIDatasourceProcessor.java | 4 +- .../qwc-datasources-reset.js | 6 +- .../dev/HibernateOrmDevUIProcessor.java | 5 +- .../hibernate-orm-entity-types.js | 2 +- .../hibernate-orm-named-queries.js | 2 +- .../hibernate-orm-persistence-units.js | 2 +- ...nateSearchElasticsearchDevUIProcessor.java | 5 +- ...-orm-elasticsearch-indexed-entity-types.js | 2 +- .../devui/LiquibaseDevUIProcessor.java | 6 +- .../{liquibase => }/qwc-liquibase-card.js | 10 +- .../qwc-liquibase-datasources.js | 4 +- .../deployment/MicrometerProcessor.java | 2 +- .../deployment/devui/QuteDevUIProcessor.java | 2 +- .../{qute => }/qwc-qute-extension-methods.js | 2 +- .../{qute => }/qwc-qute-template-data.js | 2 +- .../dev-ui/{qute => }/qwc-qute-templates.js | 2 +- .../devui/ResteasyReactiveDevUIProcessor.java | 6 +- .../qwc-resteasy-reactive-card.js | 4 +- .../qwc-resteasy-reactive-endpoint-scores.js | 2 +- ...qwc-resteasy-reactive-exception-mappers.js | 2 +- ...-reactive-parameter-converter-providers.js | 2 +- .../devui/SchedulerDevUIProcessor.java | 6 +- .../{scheduler => }/qwc-scheduler-log.js | 2 +- .../qwc-scheduler-scheduled-methods.js | 3 +- .../devui/FaultToleranceDevUIProcessor.java | 5 +- .../qwc-fault-tolerance-methods.js | 2 +- .../devui/SmallRyeGraphQLDevUIProcessor.java | 9 +- .../SmallRyeHealthDevUiProcessor.java | 2 +- .../devui/OpenApiDevUIProcessor.java | 4 +- .../ReactiveMessagingDevUiProcessor.java | 7 +- ...wc-smallrye-reactive-messaging-channels.js | 2 +- .../deployment/BuildTimeConstBuildItem.java | 17 +- .../deployment/BuildTimeContentProcessor.java | 75 ++++----- .../devui/deployment/DevUIProcessor.java | 145 ++++++++++------- .../deployment/DevUIRoutesBuildItem.java | 20 ++- .../devui/deployment/extension/Extension.java | 6 +- .../console/ConfigEditorProcessor.java | 2 +- .../resources/dev-ui/controller/jsonrpc.js | 48 +++++- .../resources/dev-ui/controller/notifier.js | 3 +- .../dev-ui/controller/router-controller.js | 48 ++++-- ...uild-steps.js => qwc-build-information.js} | 6 +- .../resources/dev-ui/qwc/qwc-configuration.js | 146 ++++++++++-------- .../dev-ui/qwc/qwc-data-qute-page.js | 6 +- .../resources/dev-ui/qwc/qwc-data-raw-page.js | 22 ++- .../dev-ui/qwc/qwc-data-table-page.js | 19 +-- .../resources/dev-ui/qwc/qwc-dev-services.js | 22 ++- .../dev-ui/qwc/qwc-extension-link.js | 15 +- .../resources/dev-ui/qwc/qwc-extensions.js | 9 +- .../main/resources/dev-ui/qwc/qwc-footer.js | 2 +- .../resources/dev-ui/qwc/qwc-server-log.js | 13 +- .../dev-ui/state/connection-state.js | 18 ++- .../devui/spi/AbstractDevUIBuildItem.java | 65 ++++++-- .../devui/spi/JsonRPCProvidersBuildItem.java | 9 +- .../spi/buildtime/QuteTemplateBuildItem.java | 9 +- .../spi/buildtime/StaticContentBuildItem.java | 9 +- .../devui/spi/page/AbstractPageBuildItem.java | 9 +- .../devui/spi/page/CardPageBuildItem.java | 4 +- .../devui/spi/page/FooterPageBuildItem.java | 9 +- .../devui/spi/page/MenuPageBuildItem.java | 9 +- .../java/io/quarkus/devui/spi/page/Page.java | 5 +- .../quarkus/devui/spi/page/PageBuilder.java | 11 +- .../devui/runtime/comms/JsonRpcRouter.java | 30 +++- .../devui/runtime/jsonrpc/JsonRpcKeys.java | 3 +- 77 files changed, 647 insertions(+), 359 deletions(-) rename extensions/arc/deployment/src/main/resources/dev-ui/{arc => }/qwc-arc-beans.js (99%) rename extensions/arc/deployment/src/main/resources/dev-ui/{arc => }/qwc-arc-decorators.js (93%) rename extensions/arc/deployment/src/main/resources/dev-ui/{arc => }/qwc-arc-fired-events.js (99%) rename extensions/arc/deployment/src/main/resources/dev-ui/{arc => }/qwc-arc-interceptors.js (98%) rename extensions/arc/deployment/src/main/resources/dev-ui/{arc => }/qwc-arc-invocation-trees.js (98%) rename extensions/arc/deployment/src/main/resources/dev-ui/{arc => }/qwc-arc-observers.js (98%) rename extensions/arc/deployment/src/main/resources/dev-ui/{arc => }/qwc-arc-removed-components.js (97%) rename extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/{devconsole/CacheDevUiConsoleProcessor.java => devui/CacheDevUiProcessor.java} (83%) rename extensions/cache/deployment/src/main/resources/dev-ui/{cache => }/qwc-cache-caches.js (98%) rename extensions/caffeine/deployment/src/main/resources/dev-ui/{caffeine => }/qwc-caffeine-card.js (96%) rename extensions/container-image/deployment/src/main/resources/dev-ui/{container-image => }/qwc-container-image-build.js (91%) rename extensions/datasource/deployment/src/main/resources/dev-ui/{datasources => }/qwc-datasources-reset.js (96%) rename extensions/hibernate-orm/deployment/src/main/resources/dev-ui/{hibernate-orm => }/hibernate-orm-entity-types.js (98%) rename extensions/hibernate-orm/deployment/src/main/resources/dev-ui/{hibernate-orm => }/hibernate-orm-named-queries.js (98%) rename extensions/hibernate-orm/deployment/src/main/resources/dev-ui/{hibernate-orm => }/hibernate-orm-persistence-units.js (99%) rename extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-ui/{hibernate-search-+-elasticsearch => }/hibernate-search-orm-elasticsearch-indexed-entity-types.js (98%) rename extensions/liquibase/deployment/src/main/resources/dev-ui/{liquibase => }/qwc-liquibase-card.js (94%) rename extensions/liquibase/deployment/src/main/resources/dev-ui/{liquibase => }/qwc-liquibase-datasources.js (99%) rename extensions/qute/deployment/src/main/resources/dev-ui/{qute => }/qwc-qute-extension-methods.js (98%) rename extensions/qute/deployment/src/main/resources/dev-ui/{qute => }/qwc-qute-template-data.js (98%) rename extensions/qute/deployment/src/main/resources/dev-ui/{qute => }/qwc-qute-templates.js (98%) rename extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/{resteasy-reactive => }/qwc-resteasy-reactive-card.js (95%) rename extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/{resteasy-reactive => }/qwc-resteasy-reactive-endpoint-scores.js (99%) rename extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/{resteasy-reactive => }/qwc-resteasy-reactive-exception-mappers.js (96%) rename extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/{resteasy-reactive => }/qwc-resteasy-reactive-parameter-converter-providers.js (96%) rename extensions/scheduler/deployment/src/main/resources/dev-ui/{scheduler => }/qwc-scheduler-log.js (99%) rename extensions/scheduler/deployment/src/main/resources/dev-ui/{scheduler => }/qwc-scheduler-scheduled-methods.js (99%) rename extensions/smallrye-fault-tolerance/deployment/src/main/resources/dev-ui/{smallrye-fault-tolerance => }/qwc-fault-tolerance-methods.js (99%) rename extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/{devconsole => devui}/ReactiveMessagingDevUiProcessor.java (74%) rename extensions/smallrye-reactive-messaging/deployment/src/main/resources/dev-ui/{smallrye-reactive-messaging => }/qwc-smallrye-reactive-messaging-channels.js (98%) rename extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/{qwc-build-steps.js => qwc-build-information.js} (71%) diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/devui/ArcDevUIProcessor.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/devui/ArcDevUIProcessor.java index 63a8d9ccdcef8..c76dac830e220 100644 --- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/devui/ArcDevUIProcessor.java +++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/devui/ArcDevUIProcessor.java @@ -18,13 +18,11 @@ public class ArcDevUIProcessor { - private static final String NAME = "ArC"; - @BuildStep(onlyIf = IsDevelopment.class) public CardPageBuildItem pages(ArcBeanInfoBuildItem arcBeanInfoBuildItem, ArcConfig config) { DevBeanInfos beanInfos = arcBeanInfoBuildItem.getBeanInfos(); - CardPageBuildItem pageBuildItem = new CardPageBuildItem(NAME); + CardPageBuildItem pageBuildItem = new CardPageBuildItem(); List beans = beanInfos.getBeans(); if (!beans.isEmpty()) { @@ -93,7 +91,7 @@ public CardPageBuildItem pages(ArcBeanInfoBuildItem arcBeanInfoBuildItem, ArcCon @BuildStep(onlyIf = IsDevelopment.class) JsonRPCProvidersBuildItem createJsonRPCService() { - return new JsonRPCProvidersBuildItem(NAME, ArcJsonRPCService.class); + return new JsonRPCProvidersBuildItem(ArcJsonRPCService.class); } private List toDevBeanWithInterceptorInfo(List beans, DevBeanInfos devBeanInfos) { diff --git a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-beans.js b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-beans.js similarity index 99% rename from extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-beans.js rename to extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-beans.js index 223ffb086bbc4..e94e59dd59f38 100644 --- a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-beans.js +++ b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-beans.js @@ -1,6 +1,6 @@ import { LitElement, html, css} from 'lit'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; -import { beans } from 'arc-data'; +import { beans } from 'build-time-data'; import '@vaadin/grid'; import '@vaadin/vertical-layout'; import 'qui-badge'; diff --git a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-decorators.js b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-decorators.js similarity index 93% rename from extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-decorators.js rename to extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-decorators.js index 98dab06b8f02b..af4c2974836ee 100644 --- a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-decorators.js +++ b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-decorators.js @@ -1,5 +1,6 @@ import { LitElement, html, css} from 'lit'; -import { decorators } from 'arc-data'; +import { decorators } from 'build-time-data'; + /** * This component shows the Arc Decorators */ diff --git a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-fired-events.js b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-fired-events.js similarity index 99% rename from extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-fired-events.js rename to extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-fired-events.js index 01c88140479c3..8185976e9a23b 100644 --- a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-fired-events.js +++ b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-fired-events.js @@ -12,7 +12,7 @@ import '@vaadin/checkbox'; * This component shows the Arc Fired Events */ export class QwcArcFiredEvents extends LitElement { - jsonRpc = new JsonRpc("ArC"); + jsonRpc = new JsonRpc(this); static styles = css` .menubar { diff --git a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-interceptors.js b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-interceptors.js similarity index 98% rename from extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-interceptors.js rename to extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-interceptors.js index bd74386125b59..fc26abb7ef5b2 100644 --- a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-interceptors.js +++ b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-interceptors.js @@ -1,5 +1,5 @@ import { LitElement, html, css} from 'lit'; -import { interceptors } from 'arc-data'; +import { interceptors } from 'build-time-data'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; import '@vaadin/grid'; import '@vaadin/vertical-layout'; diff --git a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-invocation-trees.js b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-invocation-trees.js similarity index 98% rename from extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-invocation-trees.js rename to extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-invocation-trees.js index 6a9f9d678676b..0e3e18d482aca 100644 --- a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-invocation-trees.js +++ b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-invocation-trees.js @@ -10,7 +10,7 @@ import '@vaadin/checkbox'; * This component shows the Arc Invocation Trees */ export class QwcArcInvocationTrees extends LitElement { - jsonRpc = new JsonRpc("ArC"); + jsonRpc = new JsonRpc(this); static styles = css` .menubar { diff --git a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-observers.js b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-observers.js similarity index 98% rename from extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-observers.js rename to extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-observers.js index a73d6a3172f22..51a8f2b3339c7 100644 --- a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-observers.js +++ b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-observers.js @@ -1,5 +1,5 @@ import { LitElement, html, css} from 'lit'; -import { observers } from 'arc-data'; +import { observers } from 'build-time-data'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; import '@vaadin/grid'; import '@vaadin/vertical-layout'; diff --git a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-removed-components.js b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-removed-components.js similarity index 97% rename from extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-removed-components.js rename to extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-removed-components.js index 2dcbf60c64aa1..2df3742cee154 100644 --- a/extensions/arc/deployment/src/main/resources/dev-ui/arc/qwc-arc-removed-components.js +++ b/extensions/arc/deployment/src/main/resources/dev-ui/qwc-arc-removed-components.js @@ -6,9 +6,9 @@ import '@vaadin/grid'; import '@vaadin/vertical-layout'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; import 'qui-badge'; -import { removedBeans } from 'arc-data'; -import { removedDecorators } from 'arc-data'; -import { removedInterceptors } from 'arc-data'; +import { removedBeans } from 'build-time-data'; +import { removedDecorators } from 'build-time-data'; +import { removedInterceptors } from 'build-time-data'; /** * This component shows the Arc RemovedComponents diff --git a/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/devconsole/CacheDevUiConsoleProcessor.java b/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/devui/CacheDevUiProcessor.java similarity index 83% rename from extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/devconsole/CacheDevUiConsoleProcessor.java rename to extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/devui/CacheDevUiProcessor.java index b35eb2f58b73f..fc7a59b21e8b2 100644 --- a/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/devconsole/CacheDevUiConsoleProcessor.java +++ b/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/devui/CacheDevUiProcessor.java @@ -1,4 +1,4 @@ -package io.quarkus.cache.deployment.devconsole; +package io.quarkus.cache.deployment.devui; import io.quarkus.cache.runtime.devconsole.CacheJsonRPCService; import io.quarkus.deployment.IsDevelopment; @@ -8,11 +8,11 @@ import io.quarkus.devui.spi.page.CardPageBuildItem; import io.quarkus.devui.spi.page.Page; -public class CacheDevUiConsoleProcessor { +public class CacheDevUiProcessor { @BuildStep(onlyIf = IsDevelopment.class) CardPageBuildItem create(CurateOutcomeBuildItem bi) { - CardPageBuildItem pageBuildItem = new CardPageBuildItem("Cache"); + CardPageBuildItem pageBuildItem = new CardPageBuildItem(); pageBuildItem.addPage(Page.webComponentPageBuilder() .title("Caches") .componentLink("qwc-cache-caches.js") @@ -23,6 +23,6 @@ CardPageBuildItem create(CurateOutcomeBuildItem bi) { @BuildStep(onlyIf = IsDevelopment.class) JsonRPCProvidersBuildItem createJsonRPCServiceForCache() { - return new JsonRPCProvidersBuildItem("Cache", CacheJsonRPCService.class); + return new JsonRPCProvidersBuildItem(CacheJsonRPCService.class); } } diff --git a/extensions/cache/deployment/src/main/resources/dev-ui/cache/qwc-cache-caches.js b/extensions/cache/deployment/src/main/resources/dev-ui/qwc-cache-caches.js similarity index 98% rename from extensions/cache/deployment/src/main/resources/dev-ui/cache/qwc-cache-caches.js rename to extensions/cache/deployment/src/main/resources/dev-ui/qwc-cache-caches.js index 3218fa3775036..f1f1a61cf48ce 100644 --- a/extensions/cache/deployment/src/main/resources/dev-ui/cache/qwc-cache-caches.js +++ b/extensions/cache/deployment/src/main/resources/dev-ui/qwc-cache-caches.js @@ -14,7 +14,7 @@ import '@vaadin/grid/vaadin-grid-sort-column.js'; export class QwcCacheCaches extends LitElement { - jsonRpc = new JsonRpc("Cache"); + jsonRpc = new JsonRpc(this); // Component style static styles = css` diff --git a/extensions/caffeine/deployment/src/main/java/io/quarkus/caffeine/deployment/devui/CaffeineDevUIProcessor.java b/extensions/caffeine/deployment/src/main/java/io/quarkus/caffeine/deployment/devui/CaffeineDevUIProcessor.java index 69218ad0d29b4..c8496f9d861b1 100644 --- a/extensions/caffeine/deployment/src/main/java/io/quarkus/caffeine/deployment/devui/CaffeineDevUIProcessor.java +++ b/extensions/caffeine/deployment/src/main/java/io/quarkus/caffeine/deployment/devui/CaffeineDevUIProcessor.java @@ -20,7 +20,7 @@ public class CaffeineDevUIProcessor { @BuildStep(onlyIf = IsDevelopment.class) void createCard(BuildProducer cardPageBuildItemBuildProducer) { - final CardPageBuildItem card = new CardPageBuildItem("Caffeine"); + final CardPageBuildItem card = new CardPageBuildItem(); final PageBuilder versionPage = Page.externalPageBuilder("Version") .icon("font-awesome-solid:mug-hot") diff --git a/extensions/caffeine/deployment/src/main/resources/dev-ui/caffeine/qwc-caffeine-card.js b/extensions/caffeine/deployment/src/main/resources/dev-ui/qwc-caffeine-card.js similarity index 96% rename from extensions/caffeine/deployment/src/main/resources/dev-ui/caffeine/qwc-caffeine-card.js rename to extensions/caffeine/deployment/src/main/resources/dev-ui/qwc-caffeine-card.js index 51cafedb260ce..2e2f78ce1e95f 100644 --- a/extensions/caffeine/deployment/src/main/resources/dev-ui/caffeine/qwc-caffeine-card.js +++ b/extensions/caffeine/deployment/src/main/resources/dev-ui/qwc-caffeine-card.js @@ -1,5 +1,5 @@ import { LitElement, html, css} from 'lit'; -import { pages } from 'caffeine-data'; +import { pages } from 'build-time-data'; import 'qwc/qwc-extension-link.js'; const NAME = "Caffeine"; @@ -10,16 +10,13 @@ export class QwcCaffeineCard extends LitElement { display: flex; justify-content: flex-start; } - .description { padding-bottom: 10px; } - .logo { padding-bottom: 10px; margin-right: 5px; } - .card-content { color: var(--lumo-contrast-90pct); display: flex; @@ -28,7 +25,6 @@ export class QwcCaffeineCard extends LitElement { padding: 10px 10px; height: 100%; } - .card-content slot { display: flex; flex-flow: column wrap; @@ -74,7 +70,9 @@ export class QwcCaffeineCard extends LitElement { staticLabel="${page.staticLabel}" dynamicLabel="${page.dynamicLabel}" streamingLabel="${page.streamingLabel}" - path="${page.id}" + path="${page.id}" + ?embed=${page.embed} + externalUrl="${page.metadata.externalUrl}" webcomponent="${page.componentLink}" > `)}`; diff --git a/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/devconsole/ContainerImageDevUiProcessor.java b/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/devconsole/ContainerImageDevUiProcessor.java index 6baf87b9549f9..7b90539141f02 100644 --- a/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/devconsole/ContainerImageDevUiProcessor.java +++ b/extensions/container-image/deployment/src/main/java/io/quarkus/container/image/deployment/devconsole/ContainerImageDevUiProcessor.java @@ -28,7 +28,7 @@ CardPageBuildItem create(List extensi JsonArray array = extensions.stream().map(AvailableContainerImageExtensionBuildItem::getName).sorted() .collect(JsonArray::new, JsonArray::add, JsonArray::addAll); - CardPageBuildItem card = new CardPageBuildItem("Container Image"); + CardPageBuildItem card = new CardPageBuildItem(); card.addBuildTimeData("builderTypes", array); card.addPage(Page.webComponentPageBuilder() .title("Build Container") @@ -40,7 +40,7 @@ CardPageBuildItem create(List extensi @BuildStep(onlyIf = IsDevelopment.class) JsonRPCProvidersBuildItem createJsonRPCServiceForContainerBuild() { DevConsoleManager.register("container-image-build-action", build()); - return new JsonRPCProvidersBuildItem("ContainerImage", ContainerBuilderJsonRpcService.class); + return new JsonRPCProvidersBuildItem(ContainerBuilderJsonRpcService.class); } private Function, String> build() { diff --git a/extensions/container-image/deployment/src/main/resources/dev-ui/container-image/qwc-container-image-build.js b/extensions/container-image/deployment/src/main/resources/dev-ui/qwc-container-image-build.js similarity index 91% rename from extensions/container-image/deployment/src/main/resources/dev-ui/container-image/qwc-container-image-build.js rename to extensions/container-image/deployment/src/main/resources/dev-ui/qwc-container-image-build.js index cef131afc6127..ed99ef8854db5 100644 --- a/extensions/container-image/deployment/src/main/resources/dev-ui/container-image/qwc-container-image-build.js +++ b/extensions/container-image/deployment/src/main/resources/dev-ui/qwc-container-image-build.js @@ -5,7 +5,7 @@ import '@vaadin/button'; import {until} from 'lit/directives/until.js'; import '@vaadin/grid'; import '@vaadin/grid/vaadin-grid-sort-column.js'; -import {builderTypes} from 'container-image-data'; +import {builderTypes} from 'build-time-data'; import '@vaadin/text-field'; import '@vaadin/text-area'; import '@vaadin/form-layout'; @@ -18,7 +18,7 @@ import '@vaadin/list-box'; export class QwcContainerImageBuild extends LitElement { - jsonRpc = new JsonRpc("ContainerImage"); + jsonRpc = new JsonRpc(this); static properties = { builders: {type: Array}, @@ -38,15 +38,17 @@ export class QwcContainerImageBuild extends LitElement { } `; - - connectedCallback() { - super.connectedCallback(); + constructor() { + super(); this.build_in_progress = false; this.build_complete = false; this.build_error = false; this.result = ""; - - this.builders = builderTypes.list; + + this.builders = []; + if(builderTypes){ + this.builders = builderTypes.list; + } this.types = []; this.types.push({name: "Default", value: ""}); @@ -65,9 +67,12 @@ export class QwcContainerImageBuild extends LitElement { _renderForm() { const _builders = []; - this.builders.map(item => _builders.push({'label': item, 'value': item})); - const _defaultBuilder = _builders[0].label; - + let _defaultBuilder = ""; + if(this.builders){ + this.builders.map(item => _builders.push({'label': item, 'value': item})); + _defaultBuilder = _builders[0].label; + } + const _types = []; this.types.map(item => _types.push({'label': item.name, 'value': item.value})); const _defaultType = "jar"; diff --git a/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevUIDatasourceProcessor.java b/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevUIDatasourceProcessor.java index ac1ecb958429c..8c8acc1673914 100644 --- a/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevUIDatasourceProcessor.java +++ b/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevUIDatasourceProcessor.java @@ -38,7 +38,7 @@ DevConsoleRouteBuildItem devConsoleCleanDatabaseHandler(DatabaseRecorder recorde @BuildStep(onlyIf = IsDevelopment.class) CardPageBuildItem create(DataSourcesBuildTimeConfig dataSourceBuildTimeConfig) { - CardPageBuildItem card = new CardPageBuildItem("Datasources"); + CardPageBuildItem card = new CardPageBuildItem(); List names = new ArrayList<>(); names.add(""); @@ -54,7 +54,7 @@ CardPageBuildItem create(DataSourcesBuildTimeConfig dataSourceBuildTimeConfig) { @BuildStep(onlyIf = IsDevelopment.class) JsonRPCProvidersBuildItem registerJsonRpcBackend() { - return new JsonRPCProvidersBuildItem("Datasources", DatasourceJsonRpcService.class); + return new JsonRPCProvidersBuildItem(DatasourceJsonRpcService.class); } } diff --git a/extensions/datasource/deployment/src/main/resources/dev-ui/datasources/qwc-datasources-reset.js b/extensions/datasource/deployment/src/main/resources/dev-ui/qwc-datasources-reset.js similarity index 96% rename from extensions/datasource/deployment/src/main/resources/dev-ui/datasources/qwc-datasources-reset.js rename to extensions/datasource/deployment/src/main/resources/dev-ui/qwc-datasources-reset.js index 7cd7013f3ea61..997f9605d9105 100644 --- a/extensions/datasource/deployment/src/main/resources/dev-ui/datasources/qwc-datasources-reset.js +++ b/extensions/datasource/deployment/src/main/resources/dev-ui/qwc-datasources-reset.js @@ -13,12 +13,12 @@ import 'qui-alert'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; import '@vaadin/grid/vaadin-grid-sort-column.js'; -import {datasources} from 'datasources-data'; +import {datasources} from 'build-time-data'; export class QwcDatasourcesReset extends LitElement { - jsonRpc = new JsonRpc("Datasources"); + jsonRpc = new JsonRpc(this); static styles = css` .button { @@ -53,7 +53,6 @@ export class QwcDatasourcesReset extends LitElement { return html`${until(this._renderDataSourceTable(), html`Loading datasources...`)}`; } - _renderDataSourceTable() { if (this._ds) { return html` @@ -63,7 +62,6 @@ export class QwcDatasourcesReset extends LitElement { header="Name" ${columnBodyRenderer(this._nameRenderer, [])}> - cardPageBuildItemBuildProducer) { - final CardPageBuildItem card = new CardPageBuildItem(EXTENSION_NAME); + final CardPageBuildItem card = new CardPageBuildItem(); // card card.setCustomCard("qwc-liquibase-card.js"); @@ -44,7 +42,7 @@ void createCard(BuildProducer cardPageBuildItemBuildProducer) @BuildStep(onlyIf = IsDevelopment.class) JsonRPCProvidersBuildItem registerJsonRpcBackend() { - return new JsonRPCProvidersBuildItem(EXTENSION_NAME, LiquibaseJsonRpcService.class); + return new JsonRPCProvidersBuildItem(LiquibaseJsonRpcService.class); } private static Manifest getManifest(Class clz) { diff --git a/extensions/liquibase/deployment/src/main/resources/dev-ui/liquibase/qwc-liquibase-card.js b/extensions/liquibase/deployment/src/main/resources/dev-ui/qwc-liquibase-card.js similarity index 94% rename from extensions/liquibase/deployment/src/main/resources/dev-ui/liquibase/qwc-liquibase-card.js rename to extensions/liquibase/deployment/src/main/resources/dev-ui/qwc-liquibase-card.js index b175f9f0c6e05..6436fe840ba33 100644 --- a/extensions/liquibase/deployment/src/main/resources/dev-ui/liquibase/qwc-liquibase-card.js +++ b/extensions/liquibase/deployment/src/main/resources/dev-ui/qwc-liquibase-card.js @@ -1,5 +1,5 @@ import { LitElement, html, css} from 'lit'; -import { pages } from 'liquibase-data'; +import { pages } from 'build-time-data'; import 'qwc/qwc-extension-link.js'; const NAME = "Liquibase"; @@ -10,16 +10,13 @@ export class QwcLiquibaseCard extends LitElement { display: flex; justify-content: flex-start; } - .description { padding-bottom: 10px; } - .logo { padding-bottom: 10px; margin-right: 5px; } - .card-content { color: var(--lumo-contrast-90pct); display: flex; @@ -28,7 +25,6 @@ export class QwcLiquibaseCard extends LitElement { padding: 2px 2px; height: 100%; } - .card-content slot { display: flex; flex-flow: column wrap; @@ -74,7 +70,9 @@ export class QwcLiquibaseCard extends LitElement { staticLabel="${page.staticLabel}" dynamicLabel="${page.dynamicLabel}" streamingLabel="${page.streamingLabel}" - path="${page.id}" + path="${page.id}" + ?embed=${page.embed} + externalUrl="${page.metadata.externalUrl}" webcomponent="${page.componentLink}" > `)}`; diff --git a/extensions/liquibase/deployment/src/main/resources/dev-ui/liquibase/qwc-liquibase-datasources.js b/extensions/liquibase/deployment/src/main/resources/dev-ui/qwc-liquibase-datasources.js similarity index 99% rename from extensions/liquibase/deployment/src/main/resources/dev-ui/liquibase/qwc-liquibase-datasources.js rename to extensions/liquibase/deployment/src/main/resources/dev-ui/qwc-liquibase-datasources.js index 81d8690ed7c97..500d1d78b0811 100644 --- a/extensions/liquibase/deployment/src/main/resources/dev-ui/liquibase/qwc-liquibase-datasources.js +++ b/extensions/liquibase/deployment/src/main/resources/dev-ui/qwc-liquibase-datasources.js @@ -16,7 +16,7 @@ import { columnBodyRenderer } from '@vaadin/grid/lit.js'; export class QwcLiquibaseDatasources extends LitElement { - jsonRpc = new JsonRpc("Liquibase"); + jsonRpc = new JsonRpc(this); static styles = css` .button { @@ -67,14 +67,12 @@ export class QwcLiquibaseDatasources extends LitElement { header="Name" ${columnBodyRenderer(this._nameRenderer, [])}> - - registries) { - var card = new CardPageBuildItem("Micrometer metrics"); + var card = new CardPageBuildItem(); var json = registries.stream().filter(r -> "JSON".equals(r.name())).map(RegistryBuildItem::path).findFirst(); var prom = registries.stream().filter(r -> "Prometheus".equals(r.name())).map(RegistryBuildItem::path).findFirst(); diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/devui/QuteDevUIProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/devui/QuteDevUIProcessor.java index ed8f36f27855d..115888424e650 100644 --- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/devui/QuteDevUIProcessor.java +++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/devui/QuteDevUIProcessor.java @@ -36,7 +36,7 @@ public void pages( List templateDatas, BuildProducer cardPages) { - CardPageBuildItem pageBuildItem = new CardPageBuildItem("Qute"); + CardPageBuildItem pageBuildItem = new CardPageBuildItem(); List sortedTemplatePaths = templatePaths.stream() .sorted(Comparator.comparing(tp -> tp.getPath().toLowerCase())).collect(Collectors.toList()); diff --git a/extensions/qute/deployment/src/main/resources/dev-ui/qute/qwc-qute-extension-methods.js b/extensions/qute/deployment/src/main/resources/dev-ui/qwc-qute-extension-methods.js similarity index 98% rename from extensions/qute/deployment/src/main/resources/dev-ui/qute/qwc-qute-extension-methods.js rename to extensions/qute/deployment/src/main/resources/dev-ui/qwc-qute-extension-methods.js index d7f18d448cf24..ab91d3eb03b4d 100644 --- a/extensions/qute/deployment/src/main/resources/dev-ui/qute/qwc-qute-extension-methods.js +++ b/extensions/qute/deployment/src/main/resources/dev-ui/qwc-qute-extension-methods.js @@ -3,7 +3,7 @@ import { LitElement, html, css} from 'lit'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; import '@vaadin/grid'; import '@vaadin/text-field'; -import { extensionMethods } from 'qute-data'; +import { extensionMethods } from 'build-time-data'; /** diff --git a/extensions/qute/deployment/src/main/resources/dev-ui/qute/qwc-qute-template-data.js b/extensions/qute/deployment/src/main/resources/dev-ui/qwc-qute-template-data.js similarity index 98% rename from extensions/qute/deployment/src/main/resources/dev-ui/qute/qwc-qute-template-data.js rename to extensions/qute/deployment/src/main/resources/dev-ui/qwc-qute-template-data.js index bfbf4bb74365a..21679d98aeb4f 100644 --- a/extensions/qute/deployment/src/main/resources/dev-ui/qute/qwc-qute-template-data.js +++ b/extensions/qute/deployment/src/main/resources/dev-ui/qwc-qute-template-data.js @@ -3,7 +3,7 @@ import { LitElement, html, css} from 'lit'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; import '@vaadin/grid'; import '@vaadin/text-field'; -import { templateData } from 'qute-data'; +import { templateData } from 'build-time-data'; /** diff --git a/extensions/qute/deployment/src/main/resources/dev-ui/qute/qwc-qute-templates.js b/extensions/qute/deployment/src/main/resources/dev-ui/qwc-qute-templates.js similarity index 98% rename from extensions/qute/deployment/src/main/resources/dev-ui/qute/qwc-qute-templates.js rename to extensions/qute/deployment/src/main/resources/dev-ui/qwc-qute-templates.js index f8f01ab3f7c4a..605e0420f2094 100644 --- a/extensions/qute/deployment/src/main/resources/dev-ui/qute/qwc-qute-templates.js +++ b/extensions/qute/deployment/src/main/resources/dev-ui/qwc-qute-templates.js @@ -3,7 +3,7 @@ import { LitElement, html, css} from 'lit'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; import '@vaadin/grid'; import '@vaadin/text-field'; -import { templates } from 'qute-data'; +import { templates } from 'build-time-data'; /** diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/devui/ResteasyReactiveDevUIProcessor.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/devui/ResteasyReactiveDevUIProcessor.java index b0f8f7ef74d01..b715670f734c2 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/devui/ResteasyReactiveDevUIProcessor.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/devui/ResteasyReactiveDevUIProcessor.java @@ -10,12 +10,10 @@ public class ResteasyReactiveDevUIProcessor { - private static final String EXTENSION_NAME = "RESTEasy Reactive"; - @BuildStep(onlyIf = IsDevelopment.class) public void createPages(BuildProducer cardPageProducer) { - CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(EXTENSION_NAME); + CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(); // Endpoint Scores cardPageBuildItem.addPage(Page.webComponentPageBuilder() @@ -43,6 +41,6 @@ public void createPages(BuildProducer cardPageProducer) { @BuildStep(onlyIf = IsDevelopment.class) public void createJsonRPCService(BuildProducer jsonRPCServiceProducer) { - jsonRPCServiceProducer.produce(new JsonRPCProvidersBuildItem(EXTENSION_NAME, ResteasyReactiveJsonRPCService.class)); + jsonRPCServiceProducer.produce(new JsonRPCProvidersBuildItem(ResteasyReactiveJsonRPCService.class)); } } diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-card.js b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-card.js similarity index 95% rename from extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-card.js rename to extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-card.js index 196a6c24ebdd9..d9dc80322ee09 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-card.js +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-card.js @@ -1,11 +1,11 @@ import { QwcHotReloadElement, html, css} from 'qwc-hot-reload-element'; -import { pages } from 'resteasy-reactive-data'; +import { pages } from 'build-time-data'; import { JsonRpc } from 'jsonrpc'; import 'echarts-gauge-grade'; import '@vaadin/icon'; export class QwcResteasyReactiveCard extends QwcHotReloadElement { - jsonRpc = new JsonRpc("RESTEasy Reactive"); + jsonRpc = new JsonRpc(this); static styles = css` .graph { diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-endpoint-scores.js b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-endpoint-scores.js similarity index 99% rename from extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-endpoint-scores.js rename to extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-endpoint-scores.js index 0bdc6b31d3ad2..6d3e44dc0f2d5 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-endpoint-scores.js +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-endpoint-scores.js @@ -10,7 +10,7 @@ import 'qui-badge'; * This component shows the Rest Easy Reactive Endpoint scores */ export class QwcResteasyReactiveEndpointScores extends QwcHotReloadElement { - jsonRpc = new JsonRpc("RESTEasy Reactive"); + jsonRpc = new JsonRpc(this); static styles = css` diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-exception-mappers.js b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-exception-mappers.js similarity index 96% rename from extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-exception-mappers.js rename to extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-exception-mappers.js index 4c99c74537138..207a6ff639fd2 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-exception-mappers.js +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-exception-mappers.js @@ -7,7 +7,7 @@ import '@vaadin/grid/vaadin-grid-sort-column.js'; * This component shows the Rest Easy Reactive Exception mappers */ export class QwcResteasyReactiveExceptionMappers extends LitElement { - jsonRpc = new JsonRpc("RESTEasy Reactive"); + jsonRpc = new JsonRpc(this); static styles = css` .datatable { diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-parameter-converter-providers.js b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-parameter-converter-providers.js similarity index 96% rename from extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-parameter-converter-providers.js rename to extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-parameter-converter-providers.js index 8b7d6465b1f9b..c67f8fc91ee90 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/resteasy-reactive/qwc-resteasy-reactive-parameter-converter-providers.js +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/resources/dev-ui/qwc-resteasy-reactive-parameter-converter-providers.js @@ -7,7 +7,7 @@ import '@vaadin/grid/vaadin-grid-sort-column.js'; * This component shows the Rest Easy Reactive Parameter Converter Providers */ export class QwcResteasyReactiveParameterConverterProviders extends LitElement { - jsonRpc = new JsonRpc("RESTEasy Reactive"); + jsonRpc = new JsonRpc(this); static styles = css` .datatable { diff --git a/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/devui/SchedulerDevUIProcessor.java b/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/devui/SchedulerDevUIProcessor.java index dfdff0db747d0..aea981d03abb4 100644 --- a/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/devui/SchedulerDevUIProcessor.java +++ b/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/devui/SchedulerDevUIProcessor.java @@ -20,7 +20,7 @@ void page(List scheduledMethods, BuildProducer cardPages, BuildProducer footerPages) { - CardPageBuildItem pageBuildItem = new CardPageBuildItem("Scheduler"); + CardPageBuildItem pageBuildItem = new CardPageBuildItem(); pageBuildItem.addPage(Page.webComponentPageBuilder() .icon("font-awesome-solid:clock") @@ -32,12 +32,12 @@ void page(List scheduledMethods, .icon("font-awesome-solid:clock") .title("Scheduler") .componentLink("qwc-scheduler-log.js"); - footerPages.produce(new FooterPageBuildItem("Scheduler", logPageBuilder)); + footerPages.produce(new FooterPageBuildItem(logPageBuilder)); } @BuildStep(onlyIf = IsDevelopment.class) JsonRPCProvidersBuildItem rpcProvider() { - return new JsonRPCProvidersBuildItem("Scheduler", SchedulerJsonRPCService.class); + return new JsonRPCProvidersBuildItem(SchedulerJsonRPCService.class); } } diff --git a/extensions/scheduler/deployment/src/main/resources/dev-ui/scheduler/qwc-scheduler-log.js b/extensions/scheduler/deployment/src/main/resources/dev-ui/qwc-scheduler-log.js similarity index 99% rename from extensions/scheduler/deployment/src/main/resources/dev-ui/scheduler/qwc-scheduler-log.js rename to extensions/scheduler/deployment/src/main/resources/dev-ui/qwc-scheduler-log.js index e6091a2da3ced..d472cc30aa0d4 100644 --- a/extensions/scheduler/deployment/src/main/resources/dev-ui/scheduler/qwc-scheduler-log.js +++ b/extensions/scheduler/deployment/src/main/resources/dev-ui/qwc-scheduler-log.js @@ -7,7 +7,7 @@ import { LogController } from 'log-controller'; */ export class QwcSchedulerLog extends LitElement { - jsonRpc = new JsonRpc("Scheduler", false); + jsonRpc = new JsonRpc(this, false); logControl = new LogController(this); static styles = css` diff --git a/extensions/scheduler/deployment/src/main/resources/dev-ui/scheduler/qwc-scheduler-scheduled-methods.js b/extensions/scheduler/deployment/src/main/resources/dev-ui/qwc-scheduler-scheduled-methods.js similarity index 99% rename from extensions/scheduler/deployment/src/main/resources/dev-ui/scheduler/qwc-scheduler-scheduled-methods.js rename to extensions/scheduler/deployment/src/main/resources/dev-ui/qwc-scheduler-scheduled-methods.js index 8e86daa26082d..da36b6f3f4e50 100644 --- a/extensions/scheduler/deployment/src/main/resources/dev-ui/scheduler/qwc-scheduler-scheduled-methods.js +++ b/extensions/scheduler/deployment/src/main/resources/dev-ui/qwc-scheduler-scheduled-methods.js @@ -1,4 +1,3 @@ - import { LitElement, html, css} from 'lit'; import { columnBodyRenderer } from '@vaadin/grid/lit.js'; import { until } from 'lit/directives/until.js'; @@ -12,7 +11,7 @@ import '@vaadin/text-field'; */ export class QwcSchedulerScheduledMethods extends LitElement { - jsonRpc = new JsonRpc("Scheduler"); + jsonRpc = new JsonRpc(this); static styles = css` :host { diff --git a/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/devui/FaultToleranceDevUIProcessor.java b/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/devui/FaultToleranceDevUIProcessor.java index 129e0c204ef5a..a00fb1ea43e6c 100644 --- a/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/devui/FaultToleranceDevUIProcessor.java +++ b/extensions/smallrye-fault-tolerance/deployment/src/main/java/io/quarkus/smallrye/faulttolerance/deployment/devui/FaultToleranceDevUIProcessor.java @@ -8,11 +8,10 @@ import io.quarkus.smallrye.faulttolerance.runtime.devui.FaultToleranceJsonRpcService; public class FaultToleranceDevUIProcessor { - private static final String NAME = "SmallRye Fault Tolerance"; @BuildStep(onlyIf = IsDevelopment.class) CardPageBuildItem cardPage(FaultToleranceInfoBuildItem faultToleranceInfo) { - CardPageBuildItem pageBuildItem = new CardPageBuildItem(NAME); + CardPageBuildItem pageBuildItem = new CardPageBuildItem(); pageBuildItem.addPage(Page.webComponentPageBuilder() .title("Guarded Methods") @@ -25,6 +24,6 @@ CardPageBuildItem cardPage(FaultToleranceInfoBuildItem faultToleranceInfo) { @BuildStep(onlyIf = IsDevelopment.class) JsonRPCProvidersBuildItem jsonRPCService() { - return new JsonRPCProvidersBuildItem(NAME, FaultToleranceJsonRpcService.class); + return new JsonRPCProvidersBuildItem(FaultToleranceJsonRpcService.class); } } diff --git a/extensions/smallrye-fault-tolerance/deployment/src/main/resources/dev-ui/smallrye-fault-tolerance/qwc-fault-tolerance-methods.js b/extensions/smallrye-fault-tolerance/deployment/src/main/resources/dev-ui/qwc-fault-tolerance-methods.js similarity index 99% rename from extensions/smallrye-fault-tolerance/deployment/src/main/resources/dev-ui/smallrye-fault-tolerance/qwc-fault-tolerance-methods.js rename to extensions/smallrye-fault-tolerance/deployment/src/main/resources/dev-ui/qwc-fault-tolerance-methods.js index 55cb27e830b4b..2ea5e05e9c107 100644 --- a/extensions/smallrye-fault-tolerance/deployment/src/main/resources/dev-ui/smallrye-fault-tolerance/qwc-fault-tolerance-methods.js +++ b/extensions/smallrye-fault-tolerance/deployment/src/main/resources/dev-ui/qwc-fault-tolerance-methods.js @@ -6,7 +6,7 @@ import {columnBodyRenderer} from '@vaadin/grid/lit.js'; import '@vaadin/vertical-layout'; export class QwcFaultToleranceMethods extends LitElement { - jsonRpc = new JsonRpc('SmallRye Fault Tolerance'); + jsonRpc = new JsonRpc(this); static styles = css` vaadin-grid { diff --git a/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/devui/SmallRyeGraphQLDevUIProcessor.java b/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/devui/SmallRyeGraphQLDevUIProcessor.java index eb07c0c2df213..306658c374ba1 100644 --- a/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/devui/SmallRyeGraphQLDevUIProcessor.java +++ b/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/devui/SmallRyeGraphQLDevUIProcessor.java @@ -15,7 +15,7 @@ public class SmallRyeGraphQLDevUIProcessor { @BuildStep(onlyIf = IsDevelopment.class) CardPageBuildItem createCard(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem) { - CardPageBuildItem cardPageBuildItem = new CardPageBuildItem("SmallRye GraphQL"); + CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(); // Generated GraphQL Schema PageBuilder schemaPage = Page.externalPageBuilder("GraphQL Schema") @@ -28,8 +28,15 @@ CardPageBuildItem createCard(NonApplicationRootPathBuildItem nonApplicationRootP .icon("font-awesome-solid:table-columns") .url(uiPath); + // Learn + PageBuilder learnLink = Page.externalPageBuilder("Learn more about GraphQL") + .icon("font-awesome-solid:graduation-cap") + .doNotEmbed() + .url("https://graphql.org/"); + cardPageBuildItem.addPage(schemaPage); cardPageBuildItem.addPage(uiPage); + cardPageBuildItem.addPage(learnLink); return cardPageBuildItem; } diff --git a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthDevUiProcessor.java b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthDevUiProcessor.java index 92a736eec4608..c6909315a1a8d 100644 --- a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthDevUiProcessor.java +++ b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthDevUiProcessor.java @@ -23,7 +23,7 @@ CardPageBuildItem create(NonApplicationRootPathBuildItem nonApplicationRootPathB ManagementInterfaceBuildTimeConfig managementInterfaceBuildTimeConfig, LaunchModeBuildItem launchModeBuildItem, SmallRyeHealthRecorder unused) { - CardPageBuildItem pageBuildItem = new CardPageBuildItem("Smallrye Health"); + CardPageBuildItem pageBuildItem = new CardPageBuildItem(); var path = nonApplicationRootPathBuildItem.resolveManagementPath(config.rootPath, managementInterfaceBuildTimeConfig, launchModeBuildItem); diff --git a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java index d14c763217d25..68d100cec746e 100644 --- a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java +++ b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java @@ -8,12 +8,10 @@ public class OpenApiDevUIProcessor { - private static final String NAME = "Smallrye Openapi"; - @BuildStep(onlyIf = IsDevelopment.class) public CardPageBuildItem pages(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem) { - CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(NAME); + CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(); cardPageBuildItem.addPage(Page.externalPageBuilder("Schema yaml") .url(nonApplicationRootPathBuildItem.resolvePath("openapi")) diff --git a/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/devconsole/ReactiveMessagingDevUiProcessor.java b/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/devui/ReactiveMessagingDevUiProcessor.java similarity index 74% rename from extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/devconsole/ReactiveMessagingDevUiProcessor.java rename to extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/devui/ReactiveMessagingDevUiProcessor.java index c4e2b0faf56b0..ef4920a575f95 100644 --- a/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/devconsole/ReactiveMessagingDevUiProcessor.java +++ b/extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/devui/ReactiveMessagingDevUiProcessor.java @@ -1,4 +1,4 @@ -package io.quarkus.smallrye.reactivemessaging.deployment.devconsole; +package io.quarkus.smallrye.reactivemessaging.deployment.devui; import io.quarkus.deployment.IsDevelopment; import io.quarkus.deployment.annotations.BuildStep; @@ -11,7 +11,7 @@ public class ReactiveMessagingDevUiProcessor { @BuildStep(onlyIf = IsDevelopment.class) CardPageBuildItem create() { - CardPageBuildItem card = new CardPageBuildItem("SmallRye Reactive Messaging"); + CardPageBuildItem card = new CardPageBuildItem(); card.addPage(Page.webComponentPageBuilder() .title("Channels") .componentLink("qwc-smallrye-reactive-messaging-channels.js") @@ -22,7 +22,6 @@ CardPageBuildItem create() { @BuildStep(onlyIf = IsDevelopment.class) JsonRPCProvidersBuildItem createJsonRPCServiceForCache() { - return new JsonRPCProvidersBuildItem("SmallRyeReactiveMessaging", - ReactiveMessagingJsonRpcService.class); + return new JsonRPCProvidersBuildItem(ReactiveMessagingJsonRpcService.class); } } diff --git a/extensions/smallrye-reactive-messaging/deployment/src/main/resources/dev-ui/smallrye-reactive-messaging/qwc-smallrye-reactive-messaging-channels.js b/extensions/smallrye-reactive-messaging/deployment/src/main/resources/dev-ui/qwc-smallrye-reactive-messaging-channels.js similarity index 98% rename from extensions/smallrye-reactive-messaging/deployment/src/main/resources/dev-ui/smallrye-reactive-messaging/qwc-smallrye-reactive-messaging-channels.js rename to extensions/smallrye-reactive-messaging/deployment/src/main/resources/dev-ui/qwc-smallrye-reactive-messaging-channels.js index a64f4f8b4f868..2f3afc6022f1b 100644 --- a/extensions/smallrye-reactive-messaging/deployment/src/main/resources/dev-ui/smallrye-reactive-messaging/qwc-smallrye-reactive-messaging-channels.js +++ b/extensions/smallrye-reactive-messaging/deployment/src/main/resources/dev-ui/qwc-smallrye-reactive-messaging-channels.js @@ -11,7 +11,7 @@ import { unsafeHTML } from 'lit-html/directives/unsafe-html.js'; export class QwcSmallryeReactiveMessagingChannels extends LitElement { - jsonRpc = new JsonRpc("SmallRyeReactiveMessaging"); + jsonRpc = new JsonRpc(this); static styles = css` .datatable { diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeConstBuildItem.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeConstBuildItem.java index cdaa579589aea..c95c79d4f7518 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeConstBuildItem.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeConstBuildItem.java @@ -12,12 +12,21 @@ public final class BuildTimeConstBuildItem extends AbstractDevUIBuildItem { private final Map buildTimeData; - public BuildTimeConstBuildItem(String extensionName) { - this(extensionName, new HashMap<>()); + public BuildTimeConstBuildItem() { + this(new HashMap<>()); } - public BuildTimeConstBuildItem(String extensionName, Map buildTimeData) { - super(extensionName); + public BuildTimeConstBuildItem(Map buildTimeData) { + super(); + this.buildTimeData = buildTimeData; + } + + public BuildTimeConstBuildItem(String customIdentifier) { + this(customIdentifier, new HashMap<>()); + } + + public BuildTimeConstBuildItem(String customIdentifier, Map buildTimeData) { + super(customIdentifier); this.buildTimeData = buildTimeData; } diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java index 1a600b9124dec..0f0bdf388d8c1 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java @@ -43,7 +43,6 @@ import io.quarkus.devui.spi.buildtime.QuteTemplateBuildItem; import io.quarkus.devui.spi.buildtime.StaticContentBuildItem; import io.quarkus.devui.spi.page.CardPageBuildItem; -import io.quarkus.devui.spi.page.MenuPageBuildItem; import io.quarkus.devui.spi.page.Page; import io.quarkus.devui.spi.page.PageBuilder; import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem; @@ -72,7 +71,7 @@ InternalImportMapBuildItem createKnownInternalImportMap(NonApplicationRootPathBu InternalImportMapBuildItem internalImportMapBuildItem = new InternalImportMapBuildItem(); - internalImportMapBuildItem.add("devui/", contextRoot + "/"); + internalImportMapBuildItem.add("devui/", contextRoot); // Quarkus Web Components internalImportMapBuildItem.add("qwc/", contextRoot + "qwc/"); internalImportMapBuildItem.add("qwc-hot-reload-element", contextRoot + "qwc/qwc-hot-reload-element.js"); @@ -111,18 +110,21 @@ InternalImportMapBuildItem createKnownInternalImportMap(NonApplicationRootPathBu */ @BuildStep(onlyIf = IsDevelopment.class) void mapPageBuildTimeData(List pageBuildItems, + CurateOutcomeBuildItem curateOutcomeBuildItem, BuildProducer buildTimeConstProducer) { for (CardPageBuildItem pageBuildItem : pageBuildItems) { - Map buildTimeData = getBuildTimeData(pageBuildItem); + String extensionPathName = pageBuildItem.getExtensionPathName(curateOutcomeBuildItem); + Map buildTimeData = getBuildTimeData(curateOutcomeBuildItem, pageBuildItem); if (!buildTimeData.isEmpty()) { buildTimeConstProducer.produce( - new BuildTimeConstBuildItem(pageBuildItem.getExtensionName(), buildTimeData)); + new BuildTimeConstBuildItem(extensionPathName, buildTimeData)); } } } - private Map getBuildTimeData(CardPageBuildItem pageBuildItem) { + private Map getBuildTimeData(CurateOutcomeBuildItem curateOutcomeBuildItem, + CardPageBuildItem pageBuildItem) { Map m = new HashMap<>(); if (pageBuildItem.hasBuildTimeData()) { m.putAll(pageBuildItem.getBuildTimeData()); @@ -133,8 +135,9 @@ private Map getBuildTimeData(CardPageBuildItem pageBuildItem) { List pages = new ArrayList<>(); List pageBuilders = pageBuildItem.getPages(); for (PageBuilder pageBuilder : pageBuilders) { - pageBuilder.extension(pageBuildItem.getExtensionName()); - pageBuilder.namespace(pageBuildItem.getExtensionName()); + String path = pageBuildItem.getExtensionPathName(curateOutcomeBuildItem); + pageBuilder.namespace(path); + pageBuilder.extension(path); pages.add(pageBuilder.build()); } @@ -153,7 +156,7 @@ private Map getBuildTimeData(CardPageBuildItem pageBuildItem) { * @param internalImportMapProducer */ @BuildStep(onlyIf = IsDevelopment.class) - void createBuildTimeConstJsTemplate( + void createBuildTimeConstJsTemplate(CurateOutcomeBuildItem curateOutcomeBuildItem, NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem, List buildTimeConstBuildItems, BuildProducer quteTemplateProducer, @@ -182,7 +185,8 @@ void createBuildTimeConstJsTemplate( if (!data.isEmpty()) { Map qutedata = new HashMap<>(); qutedata.put("buildTimeData", data); - String ref = buildTimeConstBuildItem.getExtensionPathName() + "-data"; + + String ref = buildTimeConstBuildItem.getExtensionPathName(curateOutcomeBuildItem) + "-data"; String file = ref + ".js"; quteTemplateBuildItem.add("build-time-data.js", file, qutedata); internalImportMapBuildItem.add(ref, contextRoot + file); @@ -260,33 +264,31 @@ void loadAllBuildTimeTemplates(BuildProducer buildTimeCo List contentPerExtension = new ArrayList<>(); - if (template.isInternal()) { - List templatesWithData = template.getTemplateDatas(); - for (QuteTemplateBuildItem.TemplateData e : templatesWithData) { - - String templateName = e.getTemplateName(); // Relative to BUILD_TIME_PATH - Map data = e.getData(); - String resourceName = BUILD_TIME_PATH + SLASH + templateName; - String fileName = e.getFileName(); - // TODO: What if we find more than one ? - try (InputStream templateStream = cl.getResourceAsStream(resourceName)) { - if (templateStream != null) { - byte[] templateContent = IoUtil.readBytes(templateStream); - // Internal runs on "naked" namespace - DevUIContent content = DevUIContent.builder() - .fileName(fileName) - .template(templateContent) - .addData(data) - .build(); - contentPerExtension.add(content); - } - } catch (IOException ioe) { - throw new UncheckedIOException("An error occurred while processing " + resourceName, ioe); + List templatesWithData = template.getTemplateDatas(); + for (QuteTemplateBuildItem.TemplateData e : templatesWithData) { + + String templateName = e.getTemplateName(); // Relative to BUILD_TIME_PATH + Map data = e.getData(); + String resourceName = BUILD_TIME_PATH + SLASH + templateName; + String fileName = e.getFileName(); + // TODO: What if we find more than one ? + try (InputStream templateStream = cl.getResourceAsStream(resourceName)) { + if (templateStream != null) { + byte[] templateContent = IoUtil.readBytes(templateStream); + // Internal runs on "naked" namespace + DevUIContent content = DevUIContent.builder() + .fileName(fileName) + .template(templateContent) + .addData(data) + .build(); + contentPerExtension.add(content); } + } catch (IOException ioe) { + throw new UncheckedIOException("An error occurred while processing " + resourceName, ioe); } - buildTimeContentProducer.produce(new StaticContentBuildItem( - StaticContentBuildItem.DEV_UI, contentPerExtension)); } + buildTimeContentProducer.produce(new StaticContentBuildItem( + StaticContentBuildItem.DEV_UI, contentPerExtension)); } } @@ -298,7 +300,6 @@ void createBuildTimeData(BuildProducer buildTimeConstPr BuildProducer themeVarsProducer, NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem, ExtensionsBuildItem extensionsBuildItem, - List menuPageBuildItems, List devServiceDescriptions, List configDescriptionBuildItems, Optional devServicesLauncherConfig) { @@ -350,9 +351,9 @@ void createBuildTimeData(BuildProducer buildTimeConstPr internalBuildTimeData.addBuildTimeData("devServices", devServiceDescriptions); Page buildSteps = Page.webComponentPageBuilder().internal() - .title("Build steps") + .title("Build information") .icon("font-awesome-solid:hammer") - .componentLink("qwc-build-steps.js").build(); + .componentLink("qwc-build-information.js").build(); internalBuildTimeData.addBuildTimeData("buildSteps", "TODO: Build Steps"); @@ -370,11 +371,13 @@ void createBuildTimeData(BuildProducer buildTimeConstPr // Add the Footer tabs Page serverLog = Page.webComponentPageBuilder().internal() + .namespace("devui-logstream") .title("Server") .icon("font-awesome-solid:server") .componentLink("qwc-server-log.js").build(); Page devUiLog = Page.webComponentPageBuilder().internal() + .namespace("devui-jsonrpcstream") .title("Dev UI") .icon("font-awesome-solid:satellite-dish") .componentLink("qwc-jsonrpc-messages.js").build(); diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIProcessor.java index 01d9ff7547905..1e87648d4bc34 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIProcessor.java @@ -1,6 +1,8 @@ package io.quarkus.devui.deployment; +import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.InputStream; import java.io.UncheckedIOException; import java.lang.reflect.Modifier; import java.net.MalformedURLException; @@ -36,6 +38,7 @@ import io.quarkus.deployment.builditem.AdditionalIndexedClassesBuildItem; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.ShutdownContextBuildItem; +import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem; import io.quarkus.devui.deployment.extension.Codestart; import io.quarkus.devui.deployment.extension.Extension; import io.quarkus.devui.runtime.DevUIRecorder; @@ -58,6 +61,7 @@ import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem; import io.quarkus.vertx.http.deployment.RouteBuildItem; 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.smallrye.common.annotation.Blocking; import io.smallrye.common.annotation.NonBlocking; @@ -76,8 +80,6 @@ public class DevUIProcessor { private static final String DEVUI = "dev-ui"; private static final String SLASH = "/"; private static final String DOT = "."; - private static final String SPACE = " "; - private static final String DASH = "-"; private static final String DOUBLE_POINT = ":"; private static final String DASH_DEPLOYMENT = "-deployment"; private static final String SLASH_ALL = SLASH + "*"; @@ -160,23 +162,22 @@ void registerDevUiHandlers( for (StaticContentBuildItem staticContentBuildItem : staticContentBuildItems) { Map urlAndPath = new HashMap<>(); - if (staticContentBuildItem.isInternal()) { - List content = staticContentBuildItem.getContent(); - for (DevUIContent c : content) { - String parsedContent = Qute.fmt(new String(c.getTemplate()), c.getData()); - Path tempFile = devUiBasePath - .resolve(c.getFileName()); - Files.write(tempFile, parsedContent.getBytes(StandardCharsets.UTF_8)); - - urlAndPath.put(c.getFileName(), tempFile.toString()); - } - Handler buildTimeStaticHandler = recorder.buildTimeStaticHandler(basepath, urlAndPath); - routeProducer.produce( - nonApplicationRootPathBuildItem.routeBuilder().route(DEVUI + SLASH_ALL) - .handler(buildTimeStaticHandler) - .build()); + List content = staticContentBuildItem.getContent(); + for (DevUIContent c : content) { + String parsedContent = Qute.fmt(new String(c.getTemplate()), c.getData()); + Path tempFile = devUiBasePath + .resolve(c.getFileName()); + Files.write(tempFile, parsedContent.getBytes(StandardCharsets.UTF_8)); + + urlAndPath.put(c.getFileName(), tempFile.toString()); } + Handler buildTimeStaticHandler = recorder.buildTimeStaticHandler(basepath, urlAndPath); + + routeProducer.produce( + nonApplicationRootPathBuildItem.routeBuilder().route(DEVUI + SLASH_ALL) + .handler(buildTimeStaticHandler) + .build()); } // For the Vaadin router (So that bookmarks/url refreshes work) @@ -218,6 +219,12 @@ void additionalBean(BuildProducer additionalBeanProduce .setDefaultScope(BuiltinScope.APPLICATION.getName()) .setUnremovable().build()); } + + additionalBeanProducer.produce(AdditionalBeanBuildItem.builder() + .addBeanClass(JsonRpcRouter.class) + .setDefaultScope(BuiltinScope.APPLICATION.getName()) + .setUnremovable().build()); + } /** @@ -227,6 +234,7 @@ void additionalBean(BuildProducer additionalBeanProduce void findAllJsonRPCMethods(BuildProducer jsonRPCMethodsProvider, BuildProducer buildTimeConstProducer, CombinedIndexBuildItem combinedIndexBuildItem, + CurateOutcomeBuildItem curateOutcomeBuildItem, List jsonRPCProvidersBuildItems) { IndexView index = combinedIndexBuildItem.getIndex(); @@ -240,8 +248,7 @@ void findAllJsonRPCMethods(BuildProducer jsonRPCMethods for (JsonRPCProvidersBuildItem jsonRPCProvidersBuildItem : jsonRPCProvidersBuildItems) { Class clazz = jsonRPCProvidersBuildItem.getJsonRPCMethodProviderClass(); - String extension = jsonRPCProvidersBuildItem.getExtensionName(); - + String extension = jsonRPCProvidersBuildItem.getExtensionPathName(curateOutcomeBuildItem); Map jsonRpcMethods = new HashMap<>(); if (extensionMethodsMap.containsKey(extension)) { jsonRpcMethods = extensionMethodsMap.get(extension); @@ -334,6 +341,7 @@ void createJsonRpcRouter(DevUIRecorder recorder, void getAllExtensions(List cardPageBuildItems, List menuPageBuildItems, List footerPageBuildItems, + CurateOutcomeBuildItem curateOutcomeBuildItem, BuildProducer extensionsProducer, BuildProducer webJarBuildProducer, BuildProducer devUIWebJarProducer) { @@ -346,9 +354,9 @@ void getAllExtensions(List cardPageBuildItems, devUIWebJarProducer.produce(new DevUIWebJarBuildItem(UI_JAR, DEVUI)); // Now go through all extensions and check them for active components - Map cardPagesMap = getCardPagesMap(cardPageBuildItems); - Map menuPagesMap = getMenuPagesMap(menuPageBuildItems); - Map footerPagesMap = getFooterPagesMap(footerPageBuildItems); + Map cardPagesMap = getCardPagesMap(curateOutcomeBuildItem, cardPageBuildItems); + Map menuPagesMap = getMenuPagesMap(curateOutcomeBuildItem, menuPageBuildItems); + Map footerPagesMap = getFooterPagesMap(curateOutcomeBuildItem, footerPageBuildItems); try { final Yaml yaml = new Yaml(); List activeExtensions = new ArrayList<>(); @@ -371,9 +379,9 @@ void getAllExtensions(List cardPageBuildItems, final Map extensionMap = yaml.load(extensionYaml); if (extensionMap.containsKey(NAME)) { - String name = (String) extensionMap.get(NAME); - extension.setNamespace(getExtensionNamespace(extensionMap)); - extension.setName(name); + String namespace = getExtensionNamespace(extensionMap); + extension.setNamespace(namespace); + extension.setName((String) extensionMap.get(NAME)); extension.setDescription((String) extensionMap.getOrDefault(DESCRIPTION, null)); String artifactId = (String) extensionMap.getOrDefault(ARTIFACT, null); extension.setArtifact(artifactId); @@ -387,7 +395,7 @@ void getAllExtensions(List cardPageBuildItems, try { extension.setGuide(new URL(guide)); } catch (MalformedURLException mue) { - log.warn("Could not set Guide URL [" + guide + "] for exception [" + name + "]"); + log.warn("Could not set Guide URL [" + guide + "] for exception [" + namespace + "]"); } } @@ -414,12 +422,10 @@ void getAllExtensions(List cardPageBuildItems, } } - String nameKey = name.toLowerCase().replaceAll(SPACE, DASH); - - if (!cardPagesMap.containsKey(nameKey)) { // Inactive + if (!cardPagesMap.containsKey(namespace)) { // Inactive inactiveExtensions.add(extension); } else { // Active - CardPageBuildItem cardPageBuildItem = cardPagesMap.get(nameKey); + CardPageBuildItem cardPageBuildItem = cardPagesMap.get(namespace); // Add all card links List cardPageBuilders = cardPageBuildItem.getPages(); @@ -432,20 +438,19 @@ void getAllExtensions(List cardPageBuildItems, // See if there is a custom card component cardPageBuildItem.getOptionalCard().ifPresent((card) -> { - card.setNamespace(extension.getPathName()); + card.setNamespace(extension.getNamespace()); extension.setCard(card); }); // Also make sure the static resources for that static resource is available - produceResources(artifactId, cardPageBuildItem.getExtensionPathName(), webJarBuildProducer, + produceResources(artifactId, webJarBuildProducer, devUIWebJarProducer); - activeExtensions.add(extension); } // Menus on the sections menu - if (menuPagesMap.containsKey(nameKey)) { - MenuPageBuildItem menuPageBuildItem = menuPagesMap.get(nameKey); + if (menuPagesMap.containsKey(namespace)) { + MenuPageBuildItem menuPageBuildItem = menuPagesMap.get(namespace); List menuPageBuilders = menuPageBuildItem.getPages(); Map buildTimeData = menuPageBuildItem.getBuildTimeData(); @@ -454,15 +459,14 @@ void getAllExtensions(List cardPageBuildItems, extension.addMenuPage(page); } // Also make sure the static resources for that static resource is available - produceResources(artifactId, menuPageBuildItem.getExtensionPathName(), webJarBuildProducer, + produceResources(artifactId, webJarBuildProducer, devUIWebJarProducer); - sectionMenuExtensions.add(extension); } // Tabs in the footer - if (footerPagesMap.containsKey(nameKey)) { - FooterPageBuildItem footerPageBuildItem = footerPagesMap.get(nameKey); + if (footerPagesMap.containsKey(namespace)) { + FooterPageBuildItem footerPageBuildItem = footerPagesMap.get(namespace); List footerPageBuilders = footerPageBuildItem.getPages(); Map buildTimeData = footerPageBuildItem.getBuildTimeData(); @@ -471,9 +475,8 @@ void getAllExtensions(List cardPageBuildItems, extension.addFooterPage(page); } // Also make sure the static resources for that static resource is available - produceResources(artifactId, footerPageBuildItem.getExtensionPathName(), webJarBuildProducer, + produceResources(artifactId, webJarBuildProducer, devUIWebJarProducer); - footerTabExtensions.add(extension); } @@ -493,18 +496,38 @@ void getAllExtensions(List cardPageBuildItems, } } - private void produceResources(String artifactId, String extensionPathName, + private void produceResources(String artifactId, BuildProducer webJarBuildProducer, BuildProducer devUIWebJarProducer) { GACT gact = getGACT(artifactId); + String namespace = getNamespace(gact); + if (namespace.isEmpty()) { + namespace = "devui"; + } + String buildTimeDataImport = namespace + "-data"; + webJarBuildProducer.produce(WebJarBuildItem.builder() .artifactKey(gact) - .root(DEVUI + SLASH + extensionPathName + SLASH).build()); + .root(DEVUI + SLASH) + .filter(new WebJarResourcesFilter() { + @Override + public WebJarResourcesFilter.FilterResult apply(String fileName, InputStream file) throws IOException { + if (fileName.endsWith(".js")) { + String content = new String(file.readAllBytes(), StandardCharsets.UTF_8); + content = content.replaceAll("build-time-data", buildTimeDataImport); + return new WebJarResourcesFilter.FilterResult( + new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)), true); + } + + return new WebJarResourcesFilter.FilterResult(file, false); + } + }) + .build()); devUIWebJarProducer.produce( new DevUIWebJarBuildItem(gact, - DEVUI + SLASH + extensionPathName)); + DEVUI)); } @BuildStep(onlyIf = IsDevelopment.class) @@ -516,14 +539,28 @@ void createAllRoutes(WebJarResultsBuildItem webJarResultsBuildItem, WebJarResultsBuildItem.WebJarResult result = webJarResultsBuildItem .byArtifactKey(devUIWebJarBuiltItem.getArtifactKey()); if (result != null) { - devUIRoutesProducer.produce(new DevUIRoutesBuildItem(devUIWebJarBuiltItem.getPath(), + String namespace = getNamespace(devUIWebJarBuiltItem.getArtifactKey()); + devUIRoutesProducer.produce(new DevUIRoutesBuildItem(namespace, devUIWebJarBuiltItem.getPath(), result.getFinalDestination(), result.getWebRootConfigurations())); } } } + private String getNamespace(GACT artifactKey) { + String namespace = artifactKey.getGroupId() + "." + artifactKey.getArtifactId(); + + if (namespace.equals("io.quarkus.quarkus-vertx-http-dev-ui-resources")) { + // Internal + namespace = ""; + } else if (namespace.endsWith("-deployment")) { + int end = namespace.lastIndexOf("-"); + namespace = namespace.substring(0, end); + } + return namespace; + } + private Page buildFinalPage(PageBuilder pageBuilder, Extension extension, Map buildTimeData) { - pageBuilder.namespace(extension.getPathName()); + pageBuilder.namespace(extension.getNamespace()); pageBuilder.extension(extension.getName()); // TODO: Have a nice factory way to load this... @@ -567,26 +604,30 @@ private Class toClass(Type type) { } } - private Map getCardPagesMap(List pages) { + private Map getCardPagesMap(CurateOutcomeBuildItem curateOutcomeBuildItem, + List pages) { Map m = new HashMap<>(); for (CardPageBuildItem pageBuildItem : pages) { - m.put(pageBuildItem.getExtensionPathName(), pageBuildItem); + String name = pageBuildItem.getExtensionPathName(curateOutcomeBuildItem); + m.put(name, pageBuildItem); } return m; } - private Map getMenuPagesMap(List pages) { + private Map getMenuPagesMap(CurateOutcomeBuildItem curateOutcomeBuildItem, + List pages) { Map m = new HashMap<>(); for (MenuPageBuildItem pageBuildItem : pages) { - m.put(pageBuildItem.getExtensionPathName(), pageBuildItem); + m.put(pageBuildItem.getExtensionPathName(curateOutcomeBuildItem), pageBuildItem); } return m; } - private Map getFooterPagesMap(List pages) { + private Map getFooterPagesMap(CurateOutcomeBuildItem curateOutcomeBuildItem, + List pages) { Map m = new HashMap<>(); for (FooterPageBuildItem pageBuildItem : pages) { - m.put(pageBuildItem.getExtensionPathName(), pageBuildItem); + m.put(pageBuildItem.getExtensionPathName(curateOutcomeBuildItem), pageBuildItem); } return m; } diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIRoutesBuildItem.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIRoutesBuildItem.java index 87f74ea9b04ba..6435da254d232 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIRoutesBuildItem.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIRoutesBuildItem.java @@ -10,19 +10,25 @@ */ public final class DevUIRoutesBuildItem extends MultiBuildItem { - private final String path; + private final String namespace; + private final String contextRoot; private final String finalDestination; private final List webRootConfigurations; - public DevUIRoutesBuildItem(String path, String finalDestination, + public DevUIRoutesBuildItem(String namespace, String contextRoot, String finalDestination, List webRootConfigurations) { - this.path = path; + this.namespace = namespace; + this.contextRoot = contextRoot; this.finalDestination = finalDestination; this.webRootConfigurations = webRootConfigurations; } - public String getPath() { - return path; + public String getNamespace() { + return namespace; + } + + public String getContextRoot() { + return contextRoot; } public String getFinalDestination() { @@ -32,4 +38,8 @@ public String getFinalDestination() { public List getWebRootConfigurations() { return webRootConfigurations; } + + public String getPath() { + return contextRoot + "/" + namespace; + } } diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/extension/Extension.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/extension/Extension.java index 61798c1a39e49..af1056cd1896b 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/extension/Extension.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/extension/Extension.java @@ -59,9 +59,9 @@ public void setName(String name) { this.name = name; } - public String getPathName() { - return name.toLowerCase().replaceAll(SPACE, DASH); - } + // public String getPathName() { + // return name.toLowerCase().replaceAll(SPACE, DASH); + // } public String getShortName() { return shortName; 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 index 46a967c116d45..e2ecf0eda4509 100644 --- 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 @@ -161,7 +161,7 @@ JsonRPCProvidersBuildItem registerJsonRpcService() { updateConfig(values); return null; }); - return new JsonRPCProvidersBuildItem("ConfigJsonRpcService", ConfigJsonRpcService.class); + return new JsonRPCProvidersBuildItem("configuration", ConfigJsonRpcService.class); } private Map filterAndApplyProfile(Map autoconfig, List configFilter, diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js index 7d6ff6c7c0c9f..de70b05b72173 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/jsonrpc.js @@ -1,6 +1,7 @@ import { jsonRPCSubscriptions } from 'devui-jsonrpc-data'; import { jsonRPCMethods } from 'devui-jsonrpc-data'; import { connectionState } from 'connection-state'; +import { RouterController } from 'router-controller'; class Level { static Info = new Level("info"); @@ -34,6 +35,7 @@ class MessageType { static Response = new MessageType("Response"); static Void = new MessageType("Void"); static SubscriptionMessage = new MessageType("SubscriptionMessage"); + static HotReload = new MessageType("HotReload"); constructor(messageType) { this.messageType = messageType; @@ -84,8 +86,37 @@ export class JsonRpc { _extensionName; _logTraffic; - constructor(extensionName, logTraffic=true) { - this._extensionName = extensionName; + + + /** + * + * @param {type} host the component using this. + * In the case of full extension pages, the extension namespace will be used and can be found on the router. However, sometimes + * extensions might have multiple services, in that case a serviceIdentifier can be used + * In the case of Menu items, the menu id (what is registered in the router) is used. + * Again serviceIdentifier can allow multiple backends + * In the case of cards or logs, the namespace will be passed in as an attribute (as this component is not registered with the router) + * Again serviceIdentifier can allow multiple backends + * @param {type} logTraffic - if traffic should be logged in the Dev UI Log (json-prc log) + * @param {type} serviceIdentifier - if needed, a backend service identifier + * @returns {Proxy} + */ + constructor(host, logTraffic=true, serviceIdentifier=null) { + var page = RouterController.pageForComponent(host.tagName.toLowerCase()); + + if (page){ + if(page.namespace){ + // For pages + this._setExtensionName(page.namespace, serviceIdentifier); + }else{ + // For Menu items + this._setExtensionName(page.id, serviceIdentifier); + } + } else { + // For cards and logs + this._setExtensionName(host.getAttribute("namespace"), serviceIdentifier); + } + this._logTraffic = logTraffic; if (!JsonRpc.webSocket) { if (window.location.protocol === "https:") { @@ -166,6 +197,14 @@ export class JsonRpc { }) } + _setExtensionName(discoveredNamespace, serviceIdentifier){ + if(serviceIdentifier){ + this._extensionName = discoveredNamespace + "-" + serviceIdentifier; + }else { + this._extensionName = discoveredNamespace; + } + } + static sendJsonRPCMessage(jsonrpcpayload, log=true) { if (JsonRpc.webSocket.readyState !== WebSocket.OPEN) { JsonRpc.initQueue.push(jsonrpcpayload); @@ -206,9 +245,12 @@ export class JsonRpc { var response = JSON.parse(event.data); var devUiResponse = response.result; var messageType = devUiResponse.messageType; - + if (messageType === MessageType.Void.toString()) { // Void response, typically used on initial subscription // Do nothing + } else if (messageType === MessageType.HotReload.toString()){ + connectionState.hotreload(JsonRpc.serverUri); + connectionState.connected(JsonRpc.serverUri) } else if (messageType === MessageType.Response.toString()) { // Normal Request-Response if (JsonRpc.promiseQueue.has(response.id)) { var saved = JsonRpc.promiseQueue.get(response.id); diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/notifier.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/notifier.js index 4e30701f5f974..480fef7bcff3e 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/notifier.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/notifier.js @@ -1,5 +1,6 @@ import { Notification } from '@vaadin/notification'; import { html} from 'lit'; +import { unsafeHTML } from 'lit/directives/unsafe-html.js'; import '@vaadin/icon'; import '@vaadin/horizontal-layout'; @@ -62,7 +63,7 @@ class Notifier { let d = duration * 1000; const notification = Notification.show(html` - ${message} + ${unsafeHTML(message)} `, { position: position, duration: d, diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/router-controller.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/router-controller.js index dabf7b27b5da4..120f3268dc100 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/router-controller.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/controller/router-controller.js @@ -4,11 +4,10 @@ let pageNode = document.querySelector('#page'); pageNode.textContent = ''; export class RouterController { - static router = new Router(pageNode); - static pathContext = new Map(); // deprecated - static pageMap = new Map(); // deprecated + static pageMap = new Map(); // We use this to lookup page for a path + static componentMap = new Map(); // We use this to lookup page for a component /** * Parse the event change event @@ -20,8 +19,6 @@ export class RouterController { var title = RouterController.currentTitle(); var subMenu = RouterController.currentSubMenu(); - - return { 'component': component, 'path': path, @@ -115,6 +112,17 @@ export class RouterController { return null; } + /** + * Get the page for the current path + */ + static currentPage() { + var currentRoutePath = RouterController.currentRoutePath(); + if (currentRoutePath) { + return RouterController.pageForPath(currentRoutePath); + } + return null; + } + /** * Get the metadata for the current path */ @@ -147,17 +155,29 @@ export class RouterController { */ static metaDataForPath(path) { if (RouterController.existingPath(path)) { - return RouterController.pathContext.get(path); - }else{ - return null; + var page = RouterController.pageForPath(path); + if(page){ + return page.metadata; + } } + return null; } + /** + * Get the page for a certain path + */ + static pageForPath(path){ + if (RouterController.existingPath(path)) { + return RouterController.pageMap.get(path); + } + return null; + } + /** * Check if we already know about this path */ static existingPath(path) { - if (RouterController.pathContext && RouterController.pathContext.size > 0 && RouterController.pathContext.has(path)) { + if (RouterController.pageMap && RouterController.pageMap.size > 0 && RouterController.pageMap.has(path)) { return true; } return false; @@ -192,7 +212,7 @@ export class RouterController { */ static addMenuRoute(page, defaultSelection){ var pageref = RouterController.pageRef(page.componentName); - RouterController.addRoute(pageref, page.componentName, page.title, page, defaultSelection); + RouterController.addRoute(page.id, page.componentName, page.title, page, defaultSelection); } static basePath(){ @@ -208,6 +228,10 @@ export class RouterController { return RouterController.basePath() + '/' + RouterController.pageRef(pageName); } + static pageForComponent(component){ + return RouterController.componentMap.get(component); + } + /** * Add a route to the routes */ @@ -216,8 +240,8 @@ export class RouterController { path = base + '/' + path; if (!RouterController.existingPath(path)) { - RouterController.pathContext.set(path, page.metadata); // deprecated - RouterController.pageMap.set(path, page) + RouterController.pageMap.set(path, page); + RouterController.componentMap.set(component, page); var routes = []; var route = {}; route.path = path; diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-build-steps.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-build-information.js similarity index 71% rename from extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-build-steps.js rename to extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-build-information.js index 066ac5e4ceb80..13927bb7c5a61 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-build-steps.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-build-information.js @@ -2,9 +2,9 @@ import { LitElement, html, css} from 'lit'; import { buildSteps } from 'devui-data'; /** - * This component shows the Build Steps Page + * This component shows the Build Information Page */ -export class QwcBuildSteps extends LitElement { +export class QwcBuildInformation extends LitElement { static styles = css` .todo { padding-left: 10px; @@ -26,4 +26,4 @@ export class QwcBuildSteps extends LitElement { } } } -customElements.define('qwc-build-steps', QwcBuildSteps); \ No newline at end of file +customElements.define('qwc-build-information', QwcBuildInformation); \ No newline at end of file diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-configuration.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-configuration.js index 6a5282d615949..f122686e226af 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-configuration.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-configuration.js @@ -1,10 +1,10 @@ -import {LitElement, html, css} from 'lit'; -import {allConfiguration} from 'devui-data'; +import { LitElement, html, css } from 'lit'; +import { allConfiguration } from 'devui-data'; import { JsonRpc } from 'jsonrpc'; -import {until} from 'lit/directives/until.js'; +import { until } from 'lit/directives/until.js'; import '@vaadin/grid'; import 'qui/qui-alert.js'; -import {columnBodyRenderer} from '@vaadin/grid/lit.js'; +import { columnBodyRenderer } from '@vaadin/grid/lit.js'; import '@vaadin/grid/vaadin-grid-sort-column.js'; import '@vaadin/icon'; import '@vaadin/tooltip'; @@ -16,18 +16,25 @@ import '@vaadin/select'; import '@vaadin/vertical-layout'; import '@vaadin/horizontal-layout'; import '@vaadin/details'; -import { QuiAlert} from "qui/qui-alert.js"; +import { notifier } from 'notifier'; import { unsafeHTML } from 'lit/directives/unsafe-html.js'; -import {gridRowDetailsRenderer} from '@vaadin/grid/lit.js'; +import { gridRowDetailsRenderer } from '@vaadin/grid/lit.js'; /** * This component allows users to change the configuration */ export class QwcConfiguration extends LitElement { - jsonRpc = new JsonRpc("ConfigJsonRpcService"); + jsonRpc = new JsonRpc(this); static styles = css` + .conf { + height: 100%; + display: flex; + flex-direction: column; + overflow: hidden; + } + vaadin-grid { height: 100%; } @@ -36,7 +43,7 @@ export class QwcConfiguration extends LitElement { vertical-align: top; width: 100%; } - + .description { padding: 1em; } @@ -44,12 +51,9 @@ export class QwcConfiguration extends LitElement { .input-column { width: 100%; vertical-align: top; + padding: unset; } - .top-align { - vertical-align: top; - } - .full-height { height: 100%; } @@ -74,7 +78,6 @@ export class QwcConfiguration extends LitElement { _configurations: {state: true, type: Array}, _filtered: {state: true, type: Array}, _values: {state: true}, - _message: {state: true}, _detailsOpenedItem: {state: true, type: Array} }; @@ -113,13 +116,12 @@ export class QwcConfiguration extends LitElement { _render() { if (this._filtered && this._values) { - return html` - ${this._message} + return html`
- + - - - `; +
`; } } @@ -207,30 +209,35 @@ export class QwcConfiguration extends LitElement { return html` ` } else if (prop.typeName === "java.lang.Integer" || prop.typeName === "java.lang.Long") { return html` - + theme="small" + id="input-${prop.name}" + @keydown="${this._keydown}"> + + @click="${this._saveClicked}"> ` } else if (prop.typeName === "java.lang.Float" || prop.typeName === "java.lang.Double") { return html` - + + + id="save-button-${prop.name}" @click="${this._saveClicked}"> ` } else if (prop.typeName === "java.lang.Enum" || prop.typeName === "java.util.logging.Level") { let items = []; @@ -248,19 +255,19 @@ export class QwcConfiguration extends LitElement { defaultValue = prop.defaultValue; } return html` - > ` } else { return html` - + + + id="save-button-${prop.name}" @click="${this._saveClicked}"> ` @@ -282,39 +289,54 @@ export class QwcConfiguration extends LitElement { } } res = res.toUpperCase(); - let env = html` -
- Environment variable: ${res} -
` - return html`

${unsafeHTML(prop.description)}

${env}
`; + + let def = "Default value: None"; + if (prop.defaultValue) { + def = "Default value: " + prop.defaultValue; + } + + return html`
+

${unsafeHTML(prop.description)}

+
+ Environment variable: ${res}
+ ${unsafeHTML(def)} +
+
`; } - _updateTextProperty(property, event, val) { - event.preventDefault(); - let value = val; - if (!val) { - const input = this.shadowRoot.getElementById("input-" + property.name); - value = input.value; + _keydown(event){ + if (event.key === 'Enter' || event.keyCode === 13) { + let name = event.target.parentElement.id.replace("input-", ""); + this._updateProperty(name, event.target.value); } - this.jsonRpc.updateProperty({ - 'name': property.name, - 'value': value - }).then(e => { - this._values[property.name] = value; - this._message = html`` - }) } - _updateBooleanProperty(property, event, value) { + + _selectChanged(event){ + let name = event.target.id.replace("select-", ""); + this._updateProperty(name, event.target.value); + } + + _saveClicked(event){ event.preventDefault(); + let parent = event.target.parentElement; + let name = parent.id.replace("input-", ""); + this._updateProperty(name, parent.value); + } + + _checkedChanged(property, event, value) { + event.preventDefault(); + this._updateProperty(property.name, value.toString()); + } + + _updateProperty(name, value){ this.jsonRpc.updateProperty({ - 'name': property.name, - 'value': value.toString() + 'name': name, + 'value': value }).then(e => { - this._values[property.name] = value; - this._message = html`` + this._values[name] = value; + notifier.showInfoMessage("Property " + name + " updated"); }); } - } customElements.define('qwc-configuration', QwcConfiguration); \ No newline at end of file diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-qute-page.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-qute-page.js index d3afc8c1ff099..bdfd4958a5199 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-qute-page.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-qute-page.js @@ -15,9 +15,9 @@ export class QwcDataQutePage extends LitElement { connectedCallback() { super.connectedCallback(); - var metadata = RouterController.currentMetaData(); - if(metadata){ - this._htmlFragment = metadata.htmlFragment; + var page = RouterController.currentPage(); + if(page && page.metadata){ + this._htmlFragment = page.metadata.htmlFragment; } } diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-raw-page.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-raw-page.js index 4c9a3b422c49a..ede43959cccd3 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-raw-page.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-raw-page.js @@ -36,21 +36,17 @@ export class QwcDataRawPage extends observeState(LitElement) { connectedCallback() { super.connectedCallback(); - var extensionId = RouterController.currentExtensionId(); - if(extensionId){ + + var page = RouterController.currentPage(); + if(page && page.metadata){ + this._buildTimeDataKey = page.metadata.buildTimeDataKey; - var metadata = RouterController.currentMetaData(); - if(metadata){ + let modulePath = page.namespace + "-data"; - this._buildTimeDataKey = metadata.buildTimeDataKey; - - let modulePath = extensionId + "-data"; - - import(modulePath) - .then(obj => { - this._buildTimeData = obj[this._buildTimeDataKey]; // TODO: Just use obj and allow multiple keys ? - }); - } + import(modulePath) + .then(obj => { + this._buildTimeData = obj[this._buildTimeDataKey]; // TODO: Just use obj and allow multiple keys ? + }); } } diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-table-page.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-table-page.js index f7d00cf59da19..57fbb4c86809d 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-table-page.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-data-table-page.js @@ -23,27 +23,22 @@ export class QwcDataTablePage extends LitElement { connectedCallback() { super.connectedCallback(); - var extensionId = RouterController.currentExtensionId(); - if(extensionId){ + var page = RouterController.currentPage(); + if(page && page.metadata){ + this._buildTimeDataKey = page.metadata.buildTimeDataKey; - var metadata = RouterController.currentMetaData(); - if(metadata){ + let modulePath = page.namespace + "-data"; - this._buildTimeDataKey = metadata.buildTimeDataKey; - - let modulePath = extensionId + "-data"; - - import(modulePath) + import(modulePath) .then(obj => { this._buildTimeData = obj[this._buildTimeDataKey]; - if(metadata.cols){ - this._cols = metadata.cols.split(','); + if(page.metadata.cols){ + this._cols = page.metadata.cols.split(','); }else{ this._autodetectCols(); } }); - } } } 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 494e85a7ddf2e..203dafdd97a0c 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 @@ -21,6 +21,19 @@ export class QwcDevServices extends LitElement { .dev-service-config { margin-left: 2em; } + .no-dev-services { + display: flex; + flex-direction: column; + align-items: center; + gap: 10px; + border: 1px solid var(--lumo-contrast-20pct); + border-radius: 9px; + padding: 30px; + margin: 30px; + } + .no-dev-services a { + color: var(--lumo-contrast-90pct); + } `; @@ -34,8 +47,7 @@ export class QwcDevServices extends LitElement { } render() { - console.log(this._services); - if (this._services) { + if (this._services && this._services.length>0) { const items = []; for (let i = 0; i < this._services.length; i++) { const ds = this._services[i]; @@ -58,6 +70,12 @@ export class QwcDevServices extends LitElement { } return html`${items}`; + } else { + return html`

+ You do not have any Dev Services running + Read more about Dev Services +

+ ` } } diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension-link.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension-link.js index 61d19eea277d3..7f98ce5d9c913 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension-link.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extension-link.js @@ -44,6 +44,8 @@ export class QwcExtensionLink extends LitElement { streamingLabel: {type: String}, path: {type: String}, webcomponent: {type: String}, + embed: {type: Boolean}, + externalUrl: {type: String}, _effectiveLabel: {state: true}, _observer: {state: false}, }; @@ -51,12 +53,12 @@ export class QwcExtensionLink extends LitElement { connectedCallback() { super.connectedCallback(); if(this.streamingLabel){ - this.jsonRpc = new JsonRpc(this.extensionName); + this.jsonRpc = new JsonRpc(this); this._observer = this.jsonRpc[this.streamingLabel]().onNext(jsonRpcResponse => { this._effectiveLabel = jsonRpcResponse.result; }); }else if(this.dynamicLabel){ - this.jsonRpc = new JsonRpc(this.extensionName); + this.jsonRpc = new JsonRpc(this); this.jsonRpc[this.dynamicLabel]().then(jsonRpcResponse => { this._effectiveLabel = jsonRpcResponse.result; }); @@ -74,11 +76,16 @@ export class QwcExtensionLink extends LitElement { render() { let routerIgnore = false; - if(this.webcomponent === ""){ + + let p = this.path; + let t = "_self"; + if(!this.embed){ routerIgnore = true; + p = this.externalUrl; + t = "_blank"; } return html` - + ${this.displayName} diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extensions.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extensions.js index c5e5f9a9ed40f..8e55cf5e2e24c 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extensions.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-extensions.js @@ -99,11 +99,11 @@ export class QwcExtensions extends observeState(LitElement) { _renderCustomCardContent(extension){ import(extension.card.componentRef); - // TODO: Pass description and links along ${this._renderCardLinks(extension)} let customCardCode = `<${extension.card.componentName} class="card-content" slot="content" - description="${extension.description}"> + description="${extension.description}" + namespace="${extension.namespace}"> `; @@ -123,13 +123,16 @@ export class QwcExtensions extends observeState(LitElement) { return html`${extension.cardPages.map(page => html` `)}`; diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-footer.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-footer.js index d0502fb1c8f6d..40eafe2680784 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-footer.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-footer.js @@ -234,7 +234,7 @@ export class QwcFooter extends observeState(LitElement) { } _renderTabBody(footerTab){ - return html`${unsafeHTML('<' + footerTab.componentName + '>')}`; + return html`${unsafeHTML('<' + footerTab.componentName + ' namespace="' + footerTab.namespace + '">')}`; } _tabSelected(index){ diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-server-log.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-server-log.js index 0591dbf93e7f9..df0f45c1da60e 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-server-log.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-server-log.js @@ -1,4 +1,4 @@ -import { LitElement, html, css} from 'lit'; +import { QwcHotReloadElement, html, css} from 'qwc-hot-reload-element'; import { repeat } from 'lit/directives/repeat.js'; import { LogController } from 'log-controller'; import { JsonRpc } from 'jsonrpc'; @@ -13,10 +13,10 @@ import 'qui-badge'; /** * This component represent the Server Log */ -export class QwcServerLog extends LitElement { +export class QwcServerLog extends QwcHotReloadElement { logControl = new LogController(this); - jsonRpc = new JsonRpc("devui-logstream", false); + jsonRpc = new JsonRpc(this, false); static styles = css` .log { @@ -440,6 +440,11 @@ export class QwcServerLog extends LitElement { } } + hotReload(){ + this._toggleOnOffClicked(false); + this._toggleOnOffClicked(true); + } + _toggleFollowLog(e){ this._followLog = e; this._scrollToBottom(); @@ -464,7 +469,7 @@ export class QwcServerLog extends LitElement { if(last){ last.scrollIntoView({ - behavior: "smooth", + behavior: "smooth", block: "end" }); } diff --git a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/state/connection-state.js b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/state/connection-state.js index 92630dc4de57f..e129729aae578 100644 --- a/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/state/connection-state.js +++ b/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/state/connection-state.js @@ -25,6 +25,7 @@ class ConnectionState extends LitState { newState.isConnected = false; newState.isDisconnected = true; newState.isConnecting = false; + newState.isHotreloading = false; connectionState.current = newState; } @@ -38,6 +39,21 @@ class ConnectionState extends LitState { newState.isConnected = false; newState.isDisconnected = true; newState.isConnecting = true; + newState.isHotreloading = false; + connectionState.current = newState; + } + + hotreload(serverUri){ + const newState = new Object(); + newState.name = "hotreload"; + newState.icon = "plug-circle-bolt"; + newState.color = "var(--lumo-primary-color)"; + newState.message = "Hot reloading " + serverUri; + newState.serverUri = serverUri; + newState.isConnected = false; + newState.isDisconnected = false; + newState.isConnecting = false; + newState.isHotreloading = true; connectionState.current = newState; } @@ -51,7 +67,7 @@ class ConnectionState extends LitState { newState.isConnected = true; newState.isDisconnected = false; newState.isConnecting = false; - + newState.isHotreloading = false; connectionState.current = newState; } } diff --git a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/AbstractDevUIBuildItem.java b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/AbstractDevUIBuildItem.java index 36fe9862f57a5..617949f65e906 100644 --- a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/AbstractDevUIBuildItem.java +++ b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/AbstractDevUIBuildItem.java @@ -1,31 +1,74 @@ package io.quarkus.devui.spi; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + import io.quarkus.builder.item.MultiBuildItem; +import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem; +import io.quarkus.deployment.util.ArtifactInfoUtil; /** * For All DEV UI Build Item, we need to distinguish between the extensions, and the internal usage of Dev UI */ public abstract class AbstractDevUIBuildItem extends MultiBuildItem { - private static final String SPACE = " "; - private static final String DASH = "-"; - protected final String extensionName; + private final Class callerClass; + private String extensionIdentifier = null; + + private static final String DOT = "."; + private final String customIdentifier; - public AbstractDevUIBuildItem(String extensionName) { - this.extensionName = extensionName; + public AbstractDevUIBuildItem() { + this(null); } - public String getExtensionName() { - return extensionName; + public AbstractDevUIBuildItem(String customIdentifier) { + this.customIdentifier = customIdentifier; + + if (this.customIdentifier == null) { + // Get the class that will be used to auto-detect the name + StackWalker stackWalker = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE); + + List stackFrames = stackWalker.walk(frames -> frames.collect(Collectors.toList())); + + Optional stackFrame = stackWalker.walk(frames -> frames + .filter(frame -> (!frame.getDeclaringClass().getPackageName().startsWith("io.quarkus.devui.spi") + && !frame.getDeclaringClass().getPackageName().startsWith("io.quarkus.devui.deployment"))) + .findFirst()); + + if (stackFrame.isPresent()) { + this.callerClass = stackFrame.get().getDeclaringClass(); + } else { + throw new RuntimeException("Could not detect extension identifier automatically"); + } + } else { + this.callerClass = null; + } } - public String getExtensionPathName() { - return extensionName.toLowerCase().replaceAll(SPACE, DASH); + public String getExtensionPathName(CurateOutcomeBuildItem curateOutcomeBuildItem) { + if (this.customIdentifier != null) { + return customIdentifier; + } + if (this.callerClass == null) { + return DEV_UI; + } + + if (this.extensionIdentifier == null) { + + Map.Entry groupIdAndArtifactId = ArtifactInfoUtil.groupIdAndArtifactId(callerClass, + curateOutcomeBuildItem); + this.extensionIdentifier = groupIdAndArtifactId.getKey() + DOT + groupIdAndArtifactId.getValue(); + } + + return this.extensionIdentifier; } public boolean isInternal() { - return this.extensionName == DEV_UI; + return this.customIdentifier != null; } - public static final String DEV_UI = "DevUI"; + public static final String DEV_UI = "devui"; } diff --git a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/JsonRPCProvidersBuildItem.java b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/JsonRPCProvidersBuildItem.java index 9bcdf44d98a85..184c9324c929f 100644 --- a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/JsonRPCProvidersBuildItem.java +++ b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/JsonRPCProvidersBuildItem.java @@ -7,8 +7,13 @@ public final class JsonRPCProvidersBuildItem extends AbstractDevUIBuildItem { private final Class jsonRPCMethodProviderClass; - public JsonRPCProvidersBuildItem(String extensionName, Class jsonRPCMethodProviderClass) { - super(extensionName); + public JsonRPCProvidersBuildItem(Class jsonRPCMethodProviderClass) { + super(); + this.jsonRPCMethodProviderClass = jsonRPCMethodProviderClass; + } + + public JsonRPCProvidersBuildItem(String customIdentifier, Class jsonRPCMethodProviderClass) { + super(customIdentifier); this.jsonRPCMethodProviderClass = jsonRPCMethodProviderClass; } diff --git a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/buildtime/QuteTemplateBuildItem.java b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/buildtime/QuteTemplateBuildItem.java index c9db5ef99730c..7148cc43e2f98 100644 --- a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/buildtime/QuteTemplateBuildItem.java +++ b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/buildtime/QuteTemplateBuildItem.java @@ -18,8 +18,13 @@ public final class QuteTemplateBuildItem extends AbstractDevUIBuildItem { private final List templateDatas; - public QuteTemplateBuildItem(String extensionName) { - super(extensionName); + public QuteTemplateBuildItem() { + super(); + this.templateDatas = new ArrayList<>(); + } + + public QuteTemplateBuildItem(String customIdentifier) { + super(customIdentifier); this.templateDatas = new ArrayList<>(); } diff --git a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/buildtime/StaticContentBuildItem.java b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/buildtime/StaticContentBuildItem.java index e80dca39207b5..66aeeffd4b5a1 100644 --- a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/buildtime/StaticContentBuildItem.java +++ b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/buildtime/StaticContentBuildItem.java @@ -15,8 +15,13 @@ public final class StaticContentBuildItem extends AbstractDevUIBuildItem { private final List content; - public StaticContentBuildItem(String extensionName, List content) { - super(extensionName); + public StaticContentBuildItem(List content) { + super(); + this.content = content; + } + + public StaticContentBuildItem(String customIdentifier, List content) { + super(customIdentifier); this.content = content; } diff --git a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/AbstractPageBuildItem.java b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/AbstractPageBuildItem.java index 16dc8cc10bd94..7de81fa62298a 100644 --- a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/AbstractPageBuildItem.java +++ b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/AbstractPageBuildItem.java @@ -12,8 +12,13 @@ public abstract class AbstractPageBuildItem extends AbstractDevUIBuildItem { protected final Map buildTimeData; - public AbstractPageBuildItem(String extensionName) { - super(extensionName); + public AbstractPageBuildItem() { + super(); + this.buildTimeData = new HashMap<>(); + } + + public AbstractPageBuildItem(String customIdentifier) { + super(customIdentifier); this.buildTimeData = new HashMap<>(); } diff --git a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/CardPageBuildItem.java b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/CardPageBuildItem.java index 14c832067072b..c83b527e425a2 100644 --- a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/CardPageBuildItem.java +++ b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/CardPageBuildItem.java @@ -13,8 +13,8 @@ public final class CardPageBuildItem extends AbstractPageBuildItem { private final List pageBuilders; private Optional optionalCard = Optional.empty(); - public CardPageBuildItem(String extensionName) { - super(extensionName); + public CardPageBuildItem() { + super(); this.pageBuilders = new ArrayList<>(); } diff --git a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/FooterPageBuildItem.java b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/FooterPageBuildItem.java index 45da2850ed8d5..2b9295d1cdf67 100644 --- a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/FooterPageBuildItem.java +++ b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/FooterPageBuildItem.java @@ -10,8 +10,13 @@ public final class FooterPageBuildItem extends AbstractPageBuildItem { private final List pageBuilders; - public FooterPageBuildItem(String extensionName, PageBuilder... pageBuilder) { - super(extensionName); + public FooterPageBuildItem(PageBuilder... pageBuilder) { + super(); + this.pageBuilders = Arrays.asList(pageBuilder); + } + + public FooterPageBuildItem(String customIdentifier, PageBuilder... pageBuilder) { + super(customIdentifier); this.pageBuilders = Arrays.asList(pageBuilder); } diff --git a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/MenuPageBuildItem.java b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/MenuPageBuildItem.java index 61f28eca8424a..9a385c3ebbeed 100644 --- a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/MenuPageBuildItem.java +++ b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/MenuPageBuildItem.java @@ -10,8 +10,13 @@ public final class MenuPageBuildItem extends AbstractPageBuildItem { private final List pageBuilders; - public MenuPageBuildItem(String extensionName, PageBuilder... pageBuilder) { - super(extensionName); + public MenuPageBuildItem(PageBuilder... pageBuilder) { + super(); + this.pageBuilders = Arrays.asList(pageBuilder); + } + + public MenuPageBuildItem(String customIdentifier, PageBuilder... pageBuilder) { + super(customIdentifier); this.pageBuilders = Arrays.asList(pageBuilder); } diff --git a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/Page.java b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/Page.java index a96a2d44832c1..7aec1aaac6b8f 100644 --- a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/Page.java +++ b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/Page.java @@ -21,7 +21,7 @@ public class Page { private final Map metadata; // Key value Metadata private final boolean embed; // if the component is embeded in the page. true in all cases except maybe external pages - private final boolean internalComponent; // True f this component is provided by dev-ui (usually provided by the extension) + private final boolean internalComponent; // True if this component is provided by dev-ui (usually provided by the extension) private String namespace = null; // The namespace can be the extension path or, if internal, qwc @@ -110,7 +110,8 @@ public Map getMetadata() { @Override public String toString() { - return "Page {\n\ticon=" + icon + return "Page {\n\tid=" + getId() + + ", \n\ticon=" + icon + ", \n\ttitle=" + title + ", \n\tstaticLabel=" + staticLabel + ", \n\tdynamicLabel=" + dynamicLabel diff --git a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/PageBuilder.java b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/PageBuilder.java index 046372c9383b0..8a1e4864c0c0b 100644 --- a/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/PageBuilder.java +++ b/extensions/vertx-http/dev-ui-spi/src/main/java/io/quarkus/devui/spi/page/PageBuilder.java @@ -79,9 +79,9 @@ public T internal() { public T extension(String extension) { this.metadata.put("extensionName", extension); this.metadata.put("extensionId", extension.toLowerCase().replaceAll(SPACE, DASH)); - if (this.namespace == null) { - this.namespace = extension.toLowerCase().replaceAll(SPACE, DASH); - } + //if (this.namespace == null) { + // this.namespace = extension.toLowerCase().replaceAll(SPACE, DASH); + //} return (T) this; } @@ -113,7 +113,10 @@ public Page build() { this.title = n.substring(0, 1).toUpperCase() + n.substring(1); // Capitalize first letter } - return new Page(icon, title, staticLabel, dynamicLabel, streamingLabel, componentName, componentLink, metadata, embed, + Page page = new Page(icon, title, staticLabel, dynamicLabel, streamingLabel, componentName, componentLink, metadata, + embed, internalComponent, namespace); + + return page; } } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/comms/JsonRpcRouter.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/comms/JsonRpcRouter.java index b084090b38177..0a1a173c1f53f 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/comms/JsonRpcRouter.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/comms/JsonRpcRouter.java @@ -3,13 +3,15 @@ import static io.quarkus.devui.runtime.jsonrpc.JsonRpcKeys.MessageType; import java.lang.reflect.Method; +import java.time.LocalDateTime; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.event.Observes; import jakarta.inject.Inject; import org.jboss.logging.Logger; @@ -19,6 +21,7 @@ import io.quarkus.devui.runtime.jsonrpc.JsonRpcMethodName; import io.quarkus.devui.runtime.jsonrpc.JsonRpcReader; import io.quarkus.devui.runtime.jsonrpc.JsonRpcWriter; +import io.quarkus.runtime.StartupEvent; import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.infrastructure.Infrastructure; @@ -30,7 +33,6 @@ /** * Route JsonRPC message to the correct method */ -@ApplicationScoped public class JsonRpcRouter { private final Map subscriptions = new ConcurrentHashMap<>(); @@ -38,6 +40,8 @@ public class JsonRpcRouter { // Map json-rpc method to java private final Map jsonRpcToJava = new HashMap<>(); + private static final List SESSIONS = Collections.synchronizedList(new ArrayList<>()); + /** * This gets called on build to build into of the classes we are going to call in runtime * @@ -98,10 +102,32 @@ private Uni invoke(ReflectionInfo info, Object target, Object[] args) { } public void addSocket(ServerWebSocket socket) { + SESSIONS.add(socket); socket.textMessageHandler((e) -> { JsonRpcReader jsonRpcRequest = JsonRpcReader.read(e); route(jsonRpcRequest, socket); + }).closeHandler((e) -> { + purge(); }); + purge(); + } + + void onStart(@Observes StartupEvent ev) { + purge(); + for (ServerWebSocket s : new ArrayList<>(SESSIONS)) { + if (!s.isClosed()) { + s.writeTextMessage( + JsonRpcWriter.writeResponse(-1, LocalDateTime.now().toString(), MessageType.HotReload).encode()); + } + } + } + + private void purge() { + for (ServerWebSocket s : new ArrayList<>(SESSIONS)) { + if (s.isClosed()) { + SESSIONS.remove(s); + } + } } @Inject diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/jsonrpc/JsonRpcKeys.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/jsonrpc/JsonRpcKeys.java index 5f85a35f96519..d027420f55492 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/jsonrpc/JsonRpcKeys.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/jsonrpc/JsonRpcKeys.java @@ -23,6 +23,7 @@ public interface JsonRpcKeys { public static enum MessageType { Void, Response, - SubscriptionMessage + SubscriptionMessage, + HotReload } } \ No newline at end of file