-
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.
- Loading branch information
Showing
4 changed files
with
137 additions
and
0 deletions.
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
48 changes: 48 additions & 0 deletions
48
...deployment/src/main/java/io/quarkus/caffeine/deployment/devui/CaffeineDevUIProcessor.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,48 @@ | ||
package io.quarkiverse.caffeine.deployment.devui; | ||
|
||
import java.io.InputStream; | ||
import java.net.URL; | ||
import java.util.jar.Manifest; | ||
|
||
import com.github.benmanes.caffeine.cache.Caffeine; | ||
|
||
import io.quarkus.deployment.IsDevelopment; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.devui.spi.page.CardPageBuildItem; | ||
import io.quarkus.devui.spi.page.Page; | ||
import io.quarkus.devui.spi.page.PageBuilder; | ||
|
||
/** | ||
* Dev UI card for displaying important details such as the Caffeine library version. | ||
*/ | ||
public class CaffeineDevUIProcessor { | ||
|
||
@BuildStep(onlyIf = IsDevelopment.class) | ||
void createCard(BuildProducer<CardPageBuildItem> cardPageBuildItemBuildProducer) { | ||
final CardPageBuildItem card = new CardPageBuildItem("Caffeine"); | ||
|
||
final PageBuilder versionPage = Page.externalPageBuilder("Version") | ||
.icon("font-awesome-solid:mug-hot") | ||
.url("https://github.com/ben-manes/caffeine") | ||
.doNotEmbed() | ||
.staticLabel(getManifest(Caffeine.class).getMainAttributes().getValue("Bundle-Version")); | ||
card.addPage(versionPage); | ||
|
||
card.setCustomCard("qwc-caffeine-card.js"); | ||
|
||
cardPageBuildItemBuildProducer.produce(card); | ||
} | ||
|
||
public static Manifest getManifest(Class<?> clz) { | ||
String resource = "/" + clz.getName().replace(".", "/") + ".class"; | ||
String fullPath = clz.getResource(resource).toString(); | ||
String archivePath = fullPath.substring(0, fullPath.length() - resource.length()); | ||
|
||
try (InputStream input = new URL(archivePath + "/META-INF/MANIFEST.MF").openStream()) { | ||
return new Manifest(input); | ||
} catch (Exception e) { | ||
throw new RuntimeException("Loading MANIFEST for class " + clz + " failed!", e); | ||
} | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
extensions/caffeine/deployment/src/main/resources/dev-ui/caffeine/qwc-caffeine-card.js
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,84 @@ | ||
import { LitElement, html, css} from 'lit'; | ||
import { pages } from 'caffeine-data'; | ||
import 'qwc/qwc-extension-link.js'; | ||
|
||
const NAME = "Caffeine"; | ||
export class QwcCaffeineCard extends LitElement { | ||
|
||
static styles = css` | ||
.identity { | ||
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; | ||
flex-direction: column; | ||
justify-content: flex-start; | ||
padding: 10px 10px; | ||
height: 100%; | ||
} | ||
.card-content slot { | ||
display: flex; | ||
flex-flow: column wrap; | ||
padding-top: 5px; | ||
} | ||
`; | ||
|
||
static properties = { | ||
description: {type: String} | ||
}; | ||
|
||
constructor() { | ||
super(); | ||
} | ||
|
||
connectedCallback() { | ||
super.connectedCallback(); | ||
} | ||
|
||
render() { | ||
return html`<div class="card-content" slot="content"> | ||
<div class="identity"> | ||
<div class="logo"> | ||
<img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0id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wb2ludHM9IjIzOS43LDE5OC41IDIzOS42LDE5OC41IDIyNS4zLDE3Ni4yIDIyMS4zLDE3Ni4yIDIyMS4zLDIwNC45IDIyNC45LDIwNC45IDIyNC45LDE4Mi41IDIyNSwxODIuNSAyMzkuNCwyMDQuOSAKCQkyNDMuMywyMDQuOSAyNDMuMywxNzYuMiAyMzkuNywxNzYuMiAJIi8+Cgk8cG9seWdvbiBwb2ludHM9IjIyNC45LDg5LjMgMjI1LDg5LjMgMjM5LjQsMTExLjcgMjQzLjMsMTExLjcgMjQzLjMsODMgMjM5LjcsODMgMjM5LjcsMTA1LjMgMjM5LjYsMTA1LjMgMjI1LjMsODMgMjIxLjMsODMgCgkJMjIxLjMsMTExLjcgMjI0LjksMTExLjcgCSIvPgo8L2c+Cjwvc3ZnPgo=" | ||
alt="${NAME}" | ||
title="${NAME}" | ||
width="32" | ||
height="32"> | ||
</div> | ||
<div class="description">${this.description}</div> | ||
</div> | ||
${this._renderCardLinks()} | ||
</div> | ||
`; | ||
} | ||
|
||
_renderCardLinks(){ | ||
return html`${pages.map(page => html` | ||
<qwc-extension-link slot="link" | ||
extensionName="${NAME}" | ||
iconName="${page.icon}" | ||
displayName="${page.title}" | ||
staticLabel="${page.staticLabel}" | ||
dynamicLabel="${page.dynamicLabel}" | ||
streamingLabel="${page.streamingLabel}" | ||
path="${page.id}" | ||
webcomponent="${page.componentLink}" > | ||
</qwc-extension-link> | ||
`)}`; | ||
} | ||
|
||
} | ||
customElements.define('qwc-caffeine-card', QwcCaffeineCard); |
1 change: 1 addition & 0 deletions
1
extensions/caffeine/runtime/src/main/resources/META-INF/quarkus-extension.yaml
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