Skip to content

Commit

Permalink
Display index names in Hibernate Search Dev UI
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Mar 17, 2023
1 parent 7da2552 commit c7ab1c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,17 @@ export class HibernateSearchOrmElasticsearchIndexedEntitiesComponent extends Lit
header="Class name"
path="javaClass">
</vaadin-grid-column>
<vaadin-grid-column auto-width
header="Index names"
${columnBodyRenderer(this._indexNameRenderer, [])}>
</vaadin-grid-column>
</vaadin-grid>`;
}

_indexNameRenderer(entity) {
return entity.indexNames.map((indexName) => html`<qui-badge>${indexName}</qui-badge>`);
}

_selectEntityTypes(puName, selectedItems) {
if (this._selectedEntityTypes[puName].toString() !== selectedItems.toString()) {
this._selectedEntityTypes[puName] = selectedItems.slice();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package io.quarkus.hibernate.search.orm.elasticsearch.runtime.dev;

import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import org.hibernate.search.backend.elasticsearch.index.ElasticsearchIndexManager;
import org.hibernate.search.mapper.orm.entity.SearchIndexedEntity;

import io.quarkus.hibernate.orm.runtime.PersistenceUnitUtil;
Expand Down Expand Up @@ -62,10 +64,14 @@ public static class IndexedEntity implements Comparable<IndexedEntity> {

public final String jpaName;
public final String javaClass;
public final Set<String> indexNames = new HashSet<>();

IndexedEntity(SearchIndexedEntity<?> searchIndexedEntity) {
this.jpaName = searchIndexedEntity.jpaName();
this.javaClass = searchIndexedEntity.javaClass().getName();
ElasticsearchIndexManager indexManager = searchIndexedEntity.indexManager().unwrap(ElasticsearchIndexManager.class);
indexNames.add(indexManager.descriptor().readName());
indexNames.add(indexManager.descriptor().writeName());
}

@Override
Expand Down

0 comments on commit c7ab1c9

Please sign in to comment.