From 900e0b3ed0b6e9e22fdf07c1e50cea831eecc4a7 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Tue, 8 Jun 2021 14:21:24 +0200 Subject: [PATCH 1/4] Load jQuery in While loading it at the bottom of the page is an optimization, it makes things harder for extension developers and we can live without the optimization. --- .../src/main/resources/dev-templates/main.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extensions/vertx-http/deployment/src/main/resources/dev-templates/main.html b/extensions/vertx-http/deployment/src/main/resources/dev-templates/main.html index d63db0fe8ec8d..2ebb33ce421a2 100644 --- a/extensions/vertx-http/deployment/src/main/resources/dev-templates/main.html +++ b/extensions/vertx-http/deployment/src/main/resources/dev-templates/main.html @@ -17,6 +17,10 @@ {#insert style/} + + + + {#if currentExtensionName && currentExtensionName != 'Eclipse Vert.x - HTTP'} {currentExtensionName} › @@ -100,10 +104,7 @@ {#include logmanagerModals}{/include} {#include testsModals}{/include} - - <script src="{devRootAppend}/resources/js/jquery.min.js"></script> - <script src="{devRootAppend}/resources/js/bootstrap.bundle.min.js"></script> - <script src="{devRootAppend}/resources/js/dev-console.js"></script> + <script src="{devRootAppend}/resources/js/logstream.js"></script> <script src="{devRootAppend}/resources/js/tests.js"></script> From 5ea108e372d706858bc34f43844c3e50170d9229 Mon Sep 17 00:00:00 2001 From: Guillaume Smet <guillaume.smet@gmail.com> Date: Tue, 8 Jun 2021 14:22:27 +0200 Subject: [PATCH 2/4] Tweak column size for Hibernate Search Dev UI --- .../src/main/resources/dev-templates/entity-types.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/entity-types.html b/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/entity-types.html index a257afacb8225..d08d8e0b63bef 100644 --- a/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/entity-types.html +++ b/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/entity-types.html @@ -4,6 +4,10 @@ <form method="post" enctype="application/x-www-form-urlencoded"> <input id="index" type="submit" class="btn btn-primary mb-2" value="Reindex Entities" > <table id="table" class="table table-striped"> + <colgroup> + <col span="1" style="width: 5%;"> + <col span="1" style="width: 95%;"> + </colgroup> <thead class="thead-dark"> <tr> <th scope="col"> From bb23c4347060bbe898e98f39f97bc0a8c1317e93 Mon Sep 17 00:00:00 2001 From: Guillaume Smet <guillaume.smet@gmail.com> Date: Tue, 8 Jun 2021 14:23:40 +0200 Subject: [PATCH 3/4] Add the entity type information It might be useful to have the package name. --- ...earchElasticsearchDevConsoleProcessor.java | 2 +- .../resources/dev-templates/embedded.html | 2 +- .../resources/dev-templates/entity-types.html | 11 +++++--- .../devconsole/HibernateSearchSupplier.java | 25 ++++++++++++++++--- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/devconsole/HibernateSearchElasticsearchDevConsoleProcessor.java b/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/devconsole/HibernateSearchElasticsearchDevConsoleProcessor.java index e77c3b5bd5044..8bdb25083a5b1 100644 --- a/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/devconsole/HibernateSearchElasticsearchDevConsoleProcessor.java +++ b/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/devconsole/HibernateSearchElasticsearchDevConsoleProcessor.java @@ -14,7 +14,7 @@ public class HibernateSearchElasticsearchDevConsoleProcessor { @BuildStep(onlyIf = IsDevelopment.class) public DevConsoleRuntimeTemplateInfoBuildItem collectBeanInfo() { - return new DevConsoleRuntimeTemplateInfoBuildItem("entityTypes", new HibernateSearchSupplier()); + return new DevConsoleRuntimeTemplateInfoBuildItem("indexedEntityTypes", new HibernateSearchSupplier()); } @BuildStep diff --git a/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/embedded.html b/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/embedded.html index 7f7027a3cb8cc..10c92d629e123 100644 --- a/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/embedded.html +++ b/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/embedded.html @@ -1,4 +1,4 @@ <a href="{urlbase}/entity-types" class="badge badge-light"> <i class="fa fa-search fa-fw"></i> - Indexed entity types <span class="badge badge-light">{info:entityTypes.size()}</span></a> + Indexed entity types <span class="badge badge-light">{info:indexedEntityTypes.size()}</span></a> <br> diff --git a/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/entity-types.html b/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/entity-types.html index d08d8e0b63bef..b659d423fe987 100644 --- a/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/entity-types.html +++ b/extensions/hibernate-search-orm-elasticsearch/deployment/src/main/resources/dev-templates/entity-types.html @@ -6,7 +6,8 @@ <table id="table" class="table table-striped"> <colgroup> <col span="1" style="width: 5%;"> - <col span="1" style="width: 95%;"> + <col span="1" style="width: 30%;"> + <col span="1" style="width: 65%;"> </colgroup> <thead class="thead-dark"> <tr> @@ -15,18 +16,20 @@ <input type="checkbox" class="form-check-input" id="check-all"> </div> </th> + <th scope="col">Entity name</th> <th scope="col">Entity type</th> </tr> </thead> <tbody> - {#for entityType in info:entityTypes} + {#for indexedEntityType in info:indexedEntityTypes} <tr> <td> <div class="custom-control"> - <input type="checkbox" class="form-check-input checkbox" name="{entityType}" id="{entityType}"> + <input type="checkbox" class="form-check-input checkbox" name="{indexedEntityType.jpaName}" id="{indexedEntityType.jpaName}"> </div> </td> - <td>{entityType}</td> + <td>{indexedEntityType.jpaName}</td> + <td>{indexedEntityType.javaClass}</td> </tr> {/for} </tbody> diff --git a/extensions/hibernate-search-orm-elasticsearch/runtime/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/runtime/devconsole/HibernateSearchSupplier.java b/extensions/hibernate-search-orm-elasticsearch/runtime/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/runtime/devconsole/HibernateSearchSupplier.java index 1f6cb8579a691..e83a357cefe7b 100644 --- a/extensions/hibernate-search-orm-elasticsearch/runtime/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/runtime/devconsole/HibernateSearchSupplier.java +++ b/extensions/hibernate-search-orm-elasticsearch/runtime/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/runtime/devconsole/HibernateSearchSupplier.java @@ -9,20 +9,37 @@ import org.hibernate.search.mapper.orm.mapping.SearchMapping; import io.quarkus.arc.Arc; +import io.quarkus.hibernate.search.orm.elasticsearch.runtime.devconsole.HibernateSearchSupplier.DevUiIndexedEntity; + +public class HibernateSearchSupplier implements Supplier<List<DevUiIndexedEntity>> { -public class HibernateSearchSupplier implements Supplier<List<String>> { @Override - public List<String> get() { + public List<DevUiIndexedEntity> get() { SearchMapping mapping = searchMapping(); if (mapping == null) { return Collections.emptyList(); } - return mapping.allIndexedEntities().stream().map(SearchIndexedEntity::jpaName).sorted() + return mapping.allIndexedEntities().stream().map(DevUiIndexedEntity::new).sorted() .collect(Collectors.toList()); - } public static SearchMapping searchMapping() { return Arc.container().instance(SearchMapping.class).get(); } + + public static class DevUiIndexedEntity implements Comparable<DevUiIndexedEntity> { + + public final String jpaName; + public final String javaClass; + + DevUiIndexedEntity(SearchIndexedEntity<?> searchIndexedEntity) { + this.jpaName = searchIndexedEntity.jpaName(); + this.javaClass = searchIndexedEntity.javaClass().getName(); + } + + @Override + public int compareTo(DevUiIndexedEntity o) { + return this.jpaName.compareTo(o.jpaName); + } + } } From 2f88c9be03a0e16f0a09749a1bf61be24bb062fc Mon Sep 17 00:00:00 2001 From: Guillaume Smet <guillaume.smet@gmail.com> Date: Tue, 8 Jun 2021 18:54:56 +0200 Subject: [PATCH 4/4] Make error message a bit more neutral --- .../runtime/devconsole/HibernateSearchDevConsoleRecorder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/hibernate-search-orm-elasticsearch/runtime/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/runtime/devconsole/HibernateSearchDevConsoleRecorder.java b/extensions/hibernate-search-orm-elasticsearch/runtime/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/runtime/devconsole/HibernateSearchDevConsoleRecorder.java index c472dac77e565..993f0bf0e29ca 100644 --- a/extensions/hibernate-search-orm-elasticsearch/runtime/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/runtime/devconsole/HibernateSearchDevConsoleRecorder.java +++ b/extensions/hibernate-search-orm-elasticsearch/runtime/src/main/java/io/quarkus/hibernate/search/orm/elasticsearch/runtime/devconsole/HibernateSearchDevConsoleRecorder.java @@ -25,7 +25,7 @@ protected void handlePostAsync(RoutingContext event, MultiMap form) throws Excep } SearchMapping mapping = HibernateSearchSupplier.searchMapping(); if (mapping == null) { - flashMessage(event, "There aren't any indexed entity types!", FlashScopeUtil.FlashMessageStatus.ERROR); + flashMessage(event, "There are no indexed entity types.", FlashScopeUtil.FlashMessageStatus.ERROR); return; } mapping.scope(Object.class,