-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16764 from TomasHofman/devui-db-schema-1.13
DevUI pages for Hibernate ORM
- Loading branch information
Showing
12 changed files
with
503 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...ent/src/main/java/io/quarkus/hibernate/orm/deployment/devconsole/DevConsoleProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.quarkus.hibernate.orm.deployment.devconsole; | ||
|
||
import io.quarkus.deployment.IsDevelopment; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.devconsole.spi.DevConsoleRuntimeTemplateInfoBuildItem; | ||
import io.quarkus.hibernate.orm.runtime.devconsole.HibernateOrmDevConsoleInfoSupplier; | ||
|
||
public class DevConsoleProcessor { | ||
|
||
@BuildStep(onlyIf = IsDevelopment.class) | ||
public DevConsoleRuntimeTemplateInfoBuildItem collectDeploymentUnits() { | ||
return new DevConsoleRuntimeTemplateInfoBuildItem("persistence", new HibernateOrmDevConsoleInfoSupplier()); | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
extensions/hibernate-orm/deployment/src/main/resources/dev-templates/embedded.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<a href="{urlbase}/persistence-units" class="badge badge-light"> | ||
<i class="fa fa-boxes fa-fw"></i> | ||
Persistence units <span class="badge badge-light">{info:persistence.persistenceUnits.size}</span></a> | ||
|
||
<a href="{urlbase}/managed-entities" class="badge badge-light"> | ||
<i class="fa fa-table fa-fw"></i> | ||
Entities <span class="badge badge-light">{info:persistence.numberOfEntities}</span></a> | ||
|
||
<a href="{urlbase}/named-queries" class="badge badge-light"> | ||
<i class="fa fa-question-circle fa-fw"></i> | ||
Named Queries <span class="badge badge-light">{info:persistence.numberOfNamedQueries}</span></a> |
40 changes: 40 additions & 0 deletions
40
extensions/hibernate-orm/deployment/src/main/resources/dev-templates/managed-entities.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{#include main} | ||
{#style} | ||
{/style} | ||
{#title}Managed Entities{/title} | ||
{#body} | ||
|
||
{#if info:persistence.persistenceUnits.isEmpty} | ||
<p>No persistence units were found.</p> | ||
{#else} | ||
|
||
{#for pu in info:persistence.persistenceUnits} | ||
<h4><span class="badge">Persistence Unit</span> <i class="badge badge-info">{pu}</i></h4> | ||
|
||
{#if info:persistence.getManagedEntities(pu).isEmpty} | ||
<p>No entities were found.</p> | ||
{#else} | ||
<table class="table table-striped"> | ||
<thead class="thead-dark"> | ||
<tr> | ||
<th scope="col">#</th> | ||
<th scope="col">Class name</th> | ||
<th scope="col">Table name</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{#for entity in info:persistence.getManagedEntities(pu)} | ||
<tr> | ||
<td>{count}.</td> | ||
<td>{entity.className}</td> | ||
<td>{entity.tableName}</td> | ||
</tr> | ||
{/for} | ||
</tbody> | ||
</table> | ||
{/if} | ||
{/for} | ||
|
||
{/if} | ||
{/body} | ||
{/include} |
47 changes: 47 additions & 0 deletions
47
extensions/hibernate-orm/deployment/src/main/resources/dev-templates/named-queries.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{#include main} | ||
{#style} | ||
{/style} | ||
{#title}Named Queries{/title} | ||
{#body} | ||
|
||
{#if info:persistence.persistenceUnits.isEmpty} | ||
<p>No persistence units were found.</p> | ||
{#else} | ||
|
||
{#for pu in info:persistence.persistenceUnits} | ||
<h4><span class="badge">Persistence Unit</span> <i class="badge badge-info">{pu}</i></h4> | ||
|
||
{#if info:persistence.getAllNamedQueries(pu).isEmpty} | ||
<p>No named queries were found.</p> | ||
{#else} | ||
<table class="table table-striped"> | ||
<thead class="thead-dark"> | ||
<tr> | ||
<th scope="col">#</th> | ||
<th scope="col">Name</th> | ||
<th scope="col">Query</th> | ||
<th scope="col">Lock Mode</th> | ||
<th scope="col">Cacheable</th> | ||
<th scope="col">Query Type</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{#for query in info:persistence.getAllNamedQueries(pu)} | ||
<tr> | ||
<td>{count}.</td> | ||
<td>{query.name}</td> | ||
<td>{query.query}</td> | ||
<td>{query.lockMode}</td> | ||
<td>{query.cacheable}</td> | ||
<td>{query.type}</td> | ||
</tr> | ||
{/for} | ||
</tbody> | ||
</table> | ||
{/if} | ||
|
||
{/for} | ||
{/if} | ||
|
||
{/body} | ||
{/include} |
76 changes: 76 additions & 0 deletions
76
extensions/hibernate-orm/deployment/src/main/resources/dev-templates/persistence-units.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{#include main} | ||
{#style} | ||
.ddl-script { | ||
padding: 5px; | ||
} | ||
th .badge { | ||
font-size: 100%; | ||
} | ||
{/style} | ||
{#title}Persistence Units{/title} | ||
{#body} | ||
|
||
{#if info:persistence.persistenceUnits.isEmpty} | ||
<p>No persistence units found.</p> | ||
{#else} | ||
{#for unit in info:persistence.persistenceUnits} | ||
<table class="table table-striped"> | ||
<thead class="thead-dark"> | ||
<tr> | ||
<th scope="col">Persistence Unit <i class="badge badge-info">{unit}</i></th> | ||
</tr> | ||
</thead> | ||
<thead class="thead-light"> | ||
<tr> | ||
<th scope="col">Create Script</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<pre id="create-script-{count}" class="ddl-script">{info:persistence.createDDLs.get(unit)}</pre> | ||
<p class="float-right"> | ||
<a href="#" onclick="copyToClipboard('create-script-{count}'); return false;"> | ||
<i class="fa fa-clipboard"></i><span class="badge">Copy</span></a> | ||
</p> | ||
</td> | ||
</tr> | ||
<thead class="thead-light"> | ||
<tr> | ||
<th scope="col">Drop Script</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<pre id="drop-script-{count}" class="ddl-script">{info:persistence.dropDDLs.get(unit)}</pre> | ||
<p class="float-right"> | ||
<a href="#" onclick="copyToClipboard('drop-script-{count}'); return false;"> | ||
<i class="fa fa-clipboard"></i><span class="badge">Copy</span></a> | ||
</p> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
{/for} | ||
{/if} | ||
|
||
<script> | ||
<!-- | ||
function copyToClipboard(elementId) { | ||
var element = document.getElementById(elementId); | ||
var range = document.createRange(); | ||
range.setStartBefore(element.firstChild); | ||
range.setEndAfter(element.lastChild); | ||
var selection = window.getSelection(); | ||
selection.removeAllRanges(); | ||
selection.addRange(range); | ||
document.execCommand('copy'); | ||
selection.removeAllRanges(); | ||
} | ||
//--> | ||
|
||
</script> | ||
|
||
{/body} | ||
{/include} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.