Skip to content

Commit

Permalink
Merge pull request #14244 from phillip-kruger/openapi-rootpath-nonapp
Browse files Browse the repository at this point in the history
Dev console fixes and layout improvements
  • Loading branch information
gsmet authored Jan 12, 2021
2 parents 9e93cbc + 08cb956 commit 10610fb
Show file tree
Hide file tree
Showing 64 changed files with 10,105 additions and 250 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
import java.nio.channels.FileLock;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
Expand Down Expand Up @@ -57,47 +60,85 @@ public static Path copyResourcesForDevOrTest(CurateOutcomeBuildItem curateOutcom
rootFolderInJar = normalizeRootFolderInJar(rootFolderInJar);
AppArtifact userApplication = curateOutcomeBuildItem.getEffectiveModel().getAppArtifact();

Path path = createResourcesDirectory(userApplication, resourcesArtifact);
Path deploymentPath = createResourcesDirectory(userApplication, resourcesArtifact);

// Clean if not in dev mode or if the resources jar is a snapshot version
if (!launchMode.getLaunchMode().equals(LaunchMode.DEVELOPMENT)
|| resourcesArtifact.getVersion().contains(SNAPSHOT_VERSION)) {
IoUtils.createOrEmptyDir(path);
IoUtils.createOrEmptyDir(deploymentPath);
}

if (isEmpty(path)) {
if (isEmpty(deploymentPath)) {
ClassLoader classLoader = WebJarUtil.class.getClassLoader();
for (Path p : resourcesArtifact.getPaths()) {
File artifactFile = p.toFile();
try (JarFile jarFile = JarFiles.create(artifactFile)) {
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
if (entry.getName().startsWith(rootFolderInJar)) {
String fileName = entry.getName().replace(rootFolderInJar, "");
Path filePath = path.resolve(fileName);
if (entry.isDirectory()) {
Files.createDirectories(filePath);
} else {
try (InputStream inputStream = jarFile.getInputStream(entry)) {
String modulename = getModuleOverrideName(resourcesArtifact, fileName);
if (IGNORE_LIST.contains(fileName)
&& isOverride(userApplication.getPaths(), classLoader, fileName, modulename)) {
try (InputStream override = getOverride(userApplication.getPaths(), classLoader,
fileName, modulename)) {
createFile(override, filePath);
if (artifactFile.isFile()) {
// case of a jar file
try (JarFile jarFile = JarFiles.create(artifactFile)) {
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
if (entry.getName().startsWith(rootFolderInJar)) {
String fileName = entry.getName().replace(rootFolderInJar, "");
Path filePath = deploymentPath.resolve(fileName);
if (entry.isDirectory()) {
Files.createDirectories(filePath);
} else {
try (InputStream inputStream = jarFile.getInputStream(entry)) {
String modulename = getModuleOverrideName(resourcesArtifact, fileName);
if (IGNORE_LIST.contains(fileName)
&& isOverride(userApplication.getPaths(), classLoader, fileName, modulename)) {
try (InputStream override = getOverride(userApplication.getPaths(), classLoader,
fileName, modulename)) {
createFile(override, filePath);
}
} else {
createFile(inputStream, filePath);
}
} else {
createFile(inputStream, filePath);
}
}
}
}
}
} else {
// case of a directory
Path rootFolderToCopy = p.resolve(rootFolderInJar);
if (!Files.isDirectory(rootFolderToCopy)) {
continue;
}

Files.walkFileTree(rootFolderToCopy, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(final Path dir,
final BasicFileAttributes attrs) throws IOException {
Files.createDirectories(deploymentPath.resolve(rootFolderToCopy.relativize(dir)));
return FileVisitResult.CONTINUE;
}

@Override
public FileVisitResult visitFile(final Path file,
final BasicFileAttributes attrs) throws IOException {
String fileName = rootFolderToCopy.relativize(file).toString();
Path targetFilePath = deploymentPath.resolve(rootFolderToCopy.relativize(file));

String modulename = getModuleOverrideName(resourcesArtifact, fileName);
if (IGNORE_LIST.contains(fileName)
&& isOverride(userApplication.getPaths(), classLoader, fileName, modulename)) {
try (InputStream override = getOverride(userApplication.getPaths(), classLoader,
fileName, modulename)) {
createFile(override, targetFilePath);
}
} else {
Files.copy(file, targetFilePath);
}

return FileVisitResult.CONTINUE;
}
});
}
}
}
return path;
return deploymentPath;
}

public static void updateFile(Path original, byte[] newContent) throws IOException {
Expand Down
8 changes: 7 additions & 1 deletion docs/src/main/asciidoc/dev-console.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ but note that this might change in the future.

The main template also includes https://jquery.com/[jQuery 3.5.1], but here again this might change.

=== Accessing Config Properties

A `config:property(name)` expression can be used to output the config value for the given property name.
The property name can be either a string literal or obtained dynamically by another expression.
For example `{config:property('quarkus.lambda.handler')}` and `{config:property(foo.propertyName)}`.

== Adding full pages

To add full pages for your DEV Console extension such as this one:
Expand Down Expand Up @@ -348,4 +354,4 @@ The following Quarkus extensions currently support the DEV Console:
- link:./openapi-swaggerui[quarkus-smallrye-openapi]
- link:./qute[quarkus-qute]
- link:./resteasy-reactive[quarkus-resteasy-reactive]
- link:./scheduler[quarkus-schedule]
- link:./scheduler[quarkus-scheduler]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
color: gray;
}
{/style}
{#title}Quarkus ArC Beans{/title}
{#title}Beans{/title}
{#body}
<table class="table table-striped">
<thead class="thead-dark">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
<a href="{urlbase}/beans" class="badge badge-light">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-egg" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M8 15a5 5 0 0 0 5-5c0-1.956-.69-4.286-1.742-6.12-.524-.913-1.112-1.658-1.704-2.164C8.956 1.206 8.428 1 8 1c-.428 0-.956.206-1.554.716-.592.506-1.18 1.251-1.704 2.164C3.69 5.714 3 8.044 3 10a5 5 0 0 0 5 5zm0 1a6 6 0 0 0 6-6c0-4.314-3-10-6-10S2 5.686 2 10a6 6 0 0 0 6 6z"/>
</svg>
<i class="fa fa-egg fa-fw"></i>
Beans <span class="badge badge-light">{info:devBeanInfos.beans.size()}</span></a>
<br>
<a href="{urlbase}/observers" class="badge badge-light">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-eye" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.134 13.134 0 0 0 1.66 2.043C4.12 11.332 5.88 12.5 8 12.5c2.12 0 3.879-1.168 5.168-2.457A13.134 13.134 0 0 0 14.828 8a13.133 13.133 0 0 0-1.66-2.043C11.879 4.668 10.119 3.5 8 3.5c-2.12 0-3.879 1.168-5.168 2.457A13.133 13.133 0 0 0 1.172 8z"/>
<path fill-rule="evenodd" d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
</svg>
<i class="fa fa-eye fa-fw"></i>
Observers <span class="badge badge-light">{info:arcContainer.observers.size()}</span></a>
<br>
<a href="{urlbase}/removed-beans" class="badge badge-light">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-trash" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/>
<path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/>
</svg>
<i class="fa fa-trash-alt fa-fw"></i>
Removed Beans <span class="badge badge-light">{info:arcContainer.removedBeans.size()}</span></a>
<br>
<span class="badge badge-light">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-stoplights" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M9.5 3.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0 4a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0 4a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"/>
<path fill-rule="evenodd" d="M10 1H6a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM6 0a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H6z"/>
<path d="M14 2h-2v2c1.2-.4 1.833-1.5 2-2zM2 2h2v2c-1.2-.4-1.833-1.5-2-2zm12 4h-2v2c1.2-.4 1.833-1.5 2-2zM2 6h2v2c-1.2-.4-1.833-1.5-2-2zm12 4h-2v2c1.2-.4 1.833-1.5 2-2zM2 10h2v2c-1.2-.4-1.833-1.5-2-2z"/>
</svg>
Interceptors <span class="badge badge-light">{info:arcContainer.interceptors.size()}</span></span>
<i class="fa fa-traffic-light fa-fw"></i>
Interceptors <span class="badge badge-light">{info:arcContainer.interceptors.size()}</span></span>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{#include main}
{#title}Quarkus ArC Observers{/title}
{#include main fluid=true}
{#title}Observers{/title}
{#body}
<table class="table table-striped">
<thead class="thead-dark">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
color: gray;
}
{/style}
{#title}Quarkus ArC Removed Beans{/title}
{#title}Removed Beans{/title}
{#body}
<table class="table table-striped">
<thead class="thead-dark">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
color: gray;
}
{/style}
{#title}Quarkus Cache{/title}
{#title}Caches{/title}
{#body}
<table class="table table-striped">
<thead class="thead-dark">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<a href="{urlbase}/caches" class="badge badge-light">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-cash-stack" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M14 3H1a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1h-1z"/>
<path fill-rule="evenodd" d="M15 5H1v8h14V5zM1 4a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H1z"/>
<path d="M13 5a2 2 0 0 0 2 2V5h-2zM3 5a2 2 0 0 1-2 2V5h2zm10 8a2 2 0 0 1 2-2v2h-2zM3 13a2 2 0 0 0-2-2v2h2zm7-4a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"/>
</svg>
<i class="fa fa-boxes fa-fw"></i>
Caches <span class="badge badge-light">{info:cacheInfos.size()}</span></a>
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
{#include main}
{#style}
.annotation {
color: gray;
}
{/style}
{#title}Build Container Image{/title}
{#title}Build{/title}
{#body}

<form method="post" enctype="application/x-www-form-urlencoded">
Build Type:
<select name="quarkus.build.package-type" required="false">
<option value="">Default</option>
<option value="jar">Jar</option>
<option value="mutable-jar">Mutable Jar</option>
<option value="fast-jar">Fast Jar</option>
<option value="native">Native</option>
</select>

Builder Type:
<select name="quarkus.container-image.builder" required="false">
{#for item in info:builder}
<option value="{item.name}">{item.name}</option>
{/for}
</select>

<input type="submit" value="Build" >
<div class="form-group">
<label for="quarkus.build.package-type">Build Type</label>
<select name="quarkus.build.package-type" required="false" class="form-control">
<option value="">Default</option>
<option value="jar">Jar</option>
<option value="mutable-jar">Mutable Jar</option>
<option value="fast-jar">Fast Jar</option>
<option value="native">Native</option>
</select>
</div>
<div class="form-group">
<label for="quarkus.container-image.builder">Builder Type</label>
<select name="quarkus.container-image.builder" required="false" class="form-control">
{#for item in info:builder}
<option value="{item.name}">{item.name}</option>
{/for}
</select>
</div>
<button type="submit" class="btn btn-primary">Build</button>
</form>
{/body}
{/include}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<a href="{urlbase}/build" class="badge badge-light">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-cash-stack" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M14 3H1a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1h-1z"/>
<path fill-rule="evenodd" d="M15 5H1v8h14V5zM1 4a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H1z"/>
<path d="M13 5a2 2 0 0 0 2 2V5h-2zM3 5a2 2 0 0 1-2 2V5h2zm10 8a2 2 0 0 1 2-2v2h-2zM3 13a2 2 0 0 0-2-2v2h2zm7-4a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"/>
</svg>
<i class="fa fa-industry fa-fw"></i>
Build</a>
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{#include main}
{#style}
.annotation {
color: gray;
}
{/style}
{#title}Quarkus Flyway{/title}
{#title}Containers{/title}
{#body}
<table class="table table-striped">
<thead class="thead-dark">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<a href="{urlbase}/containers" class="badge badge-light">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-cash-stack" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M14 3H1a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1h-1z"/>
<path fill-rule="evenodd" d="M15 5H1v8h14V5zM1 4a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H1z"/>
<path d="M13 5a2 2 0 0 0 2 2V5h-2zM3 5a2 2 0 0 1-2 2V5h2zm10 8a2 2 0 0 1 2-2v2h-2zM3 13a2 2 0 0 0-2-2v2h2zm7-4a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"/>
</svg>
<i class="fa fa-database fa-fw"></i>
Datasources <span class="badge badge-light">{info:containers.size()}</span></a>
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
{#include main}
{#style}
.annotation {
color: gray;
}
{/style}
{#title}Deploy to Openshift{/title}
{#title}Deploy to OpenShift{/title}
{#body}

<form method="post" enctype="application/x-www-form-urlencoded">
Build Type:
<select name="quarkus.build.package-type">
<option value="">Default</option>
<option value="jar">Jar</option>
<option value="mutable-jar">Mutable Jar</option>
<option value="fast-jar">Fast Jar</option>
<option value="native">Native</option>
</select>
<br/>
Expose:
<select name="quarkus.openshift.expose">
<option value="true">Yes</option>
<option value="false">No</option>
</select>
<br>
<input type="submit" value="Deploy">
<div class="form-group">
<label for="quarkus.build.package-type">Build Type</label>
<select name="quarkus.build.package-type" class="form-control">
<option value="">Default</option>
<option value="jar">Jar</option>
<option value="mutable-jar">Mutable Jar</option>
<option value="fast-jar">Fast Jar</option>
<option value="native">Native</option>
</select>
</div>
<div class="form-group">
<label for="quarkus.openshift.expose">Expose</label>
<select name="quarkus.openshift.expose" class="form-control">
<option value="true">Yes</option>
<option value="false">No</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Deploy</button>
</form>
{/body}
{/include}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<a href="{urlbase}/deploy" class="badge badge-light">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-cash-stack" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M14 3H1a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1h-1z"/>
<path fill-rule="evenodd" d="M15 5H1v8h14V5zM1 4a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H1z"/>
<path d="M13 5a2 2 0 0 0 2 2V5h-2zM3 5a2 2 0 0 1-2 2V5h2zm10 8a2 2 0 0 1 2-2v2h-2zM3 13a2 2 0 0 0-2-2v2h2zm7-4a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"/>
</svg>
<i class="fa fa-rocket fa-fw"></i>
Deploy</a>
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{#include main}
{#style}
.annotation {
color: gray;
}
{/style}
{#title}Quarkus Liquibase{/title}
{#title}Containers{/title}
{#body}
<table class="table table-striped">
<thead class="thead-dark">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<a href="{urlbase}/containers" class="badge badge-light">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-cash-stack" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M14 3H1a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1h-1z"/>
<path fill-rule="evenodd" d="M15 5H1v8h14V5zM1 4a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H1z"/>
<path d="M13 5a2 2 0 0 0 2 2V5h-2zM3 5a2 2 0 0 1-2 2V5h2zm10 8a2 2 0 0 1 2-2v2h-2zM3 13a2 2 0 0 0-2-2v2h2zm7-4a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"/>
</svg>
<i class="fa fa-database fa-fw"></i>
Datasources <span class="badge badge-light">{info:containers.size()}</span></a>
Loading

0 comments on commit 10610fb

Please sign in to comment.