generated from quarkiverse/quarkiverse-template
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new Dev UI card #242
Merged
Merged
Add new Dev UI card #242
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
:quarkus-version: 3.1.0.Final | ||
:quarkus-version: 3.1.2.Final | ||
:quarkus-minio-version: 3.1.0.Final |
38 changes: 38 additions & 0 deletions
38
...src/main/java/io/quarkiverse/minio/client/deployment/devui/MinioClientDevUIProcessor.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,38 @@ | ||
package io.quarkiverse.minio.client.deployment.devui; | ||
|
||
import io.quarkiverse.minio.client.MiniosBuildTimeConfiguration; | ||
import io.quarkiverse.minio.client.deployment.devservices.MinioBuildTimeConfig; | ||
import io.quarkiverse.minio.client.devui.MinioJsonRPCService; | ||
import io.quarkus.deployment.IsDevelopment; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.devui.spi.JsonRPCProvidersBuildItem; | ||
import io.quarkus.devui.spi.page.CardPageBuildItem; | ||
import io.quarkus.devui.spi.page.Page; | ||
|
||
public class MinioClientDevUIProcessor { | ||
|
||
@BuildStep(onlyIf = IsDevelopment.class) | ||
void createCard(BuildProducer<CardPageBuildItem> cardProducer, MinioBuildTimeConfig devServiceConfig, | ||
MiniosBuildTimeConfiguration configuration) { | ||
|
||
final CardPageBuildItem card = new CardPageBuildItem(); | ||
|
||
card.addBuildTimeData("enabled", devServiceConfig.devservices.enabled.orElse(true)); | ||
|
||
card.addPage(Page.externalPageBuilder("Min.io console") | ||
.icon("font-awesome-solid:signs-post") | ||
.dynamicUrlJsonRPCMethodName("getMinioConsoleUrl") | ||
.doNotEmbed()); | ||
|
||
card.setCustomCard("qwc-minio-card.js"); | ||
|
||
cardProducer.produce(card); | ||
} | ||
|
||
@BuildStep(onlyIf = IsDevelopment.class) | ||
JsonRPCProvidersBuildItem createJsonRPCServiceForCache() { | ||
return new JsonRPCProvidersBuildItem(MinioJsonRPCService.class); | ||
} | ||
|
||
} |
105 changes: 105 additions & 0 deletions
105
minio-client/deployment/src/main/resources/dev-ui/qwc-minio-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,105 @@ | ||
import { LitElement, html, css} from 'lit'; | ||
import { pages } from 'build-time-data'; | ||
import { enabled } from 'build-time-data'; | ||
import 'qwc/qwc-extension-link.js'; | ||
import { JsonRpc } from 'jsonrpc' | ||
import 'qui-badge'; | ||
|
||
export class QwcMinioCard extends LitElement { | ||
jsonRpc = new JsonRpc(this); | ||
|
||
static styles = css` | ||
.identity { | ||
display: flex; | ||
justify-content: flex-start; | ||
} | ||
.loginDetails { | ||
padding-top: 10px; | ||
color: var(--lumo-contrast-70pct); | ||
font-size: smaller; | ||
text-align: center; | ||
} | ||
.description { | ||
padding-bottom: 10px; | ||
} | ||
.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 = { | ||
extensionName: {type: String}, | ||
description: {type: String}, | ||
guide: {type: String}, | ||
namespace: {type: String}, | ||
_loginDetails: {type: String} | ||
} | ||
|
||
constructor() { | ||
super(); | ||
} | ||
|
||
connectedCallback() { | ||
super.connectedCallback(); | ||
this.jsonRpc.getLoginDetails().then(jsonRpcResponse => { | ||
this._loginDetails = jsonRpcResponse.result; | ||
}); | ||
} | ||
|
||
render() { | ||
return html`<div class="card-content" slot="content"> | ||
<div class="identity"> | ||
<div class="description">${this.description}</div> | ||
</div> | ||
${this._renderCardLinks()} | ||
${this._renderLoginDetails()} | ||
</div> | ||
`; | ||
} | ||
|
||
_renderCardLinks(){ | ||
if(enabled){ | ||
|
||
return html`${pages.map(page => html` | ||
<qwc-extension-link slot="link" | ||
namespace="${this.namespace}" | ||
extensionName="${this.name}" | ||
iconName="${page.icon}" | ||
displayName="${page.title}" | ||
staticLabel="${page.staticLabel}" | ||
dynamicLabel="${page.dynamicLabel}" | ||
streamingLabel="${page.streamingLabel}" | ||
path="${page.id}" | ||
?embed=${page.embed} | ||
externalUrl="${page.metadata.externalUrl}" | ||
dynamicUrlMethodName="${page.metadata.dynamicUrlMethodName}" | ||
webcomponent="${page.componentLink}" > | ||
</qwc-extension-link> | ||
`)}`; | ||
} else { | ||
return html`<span>Disabled</span>`; | ||
} | ||
|
||
} | ||
|
||
_renderLoginDetails(){ | ||
if(this._loginDetails){ | ||
return html`<div class="loginDetails"> | ||
<span>Access Key: <qui-badge><span>${this._loginDetails.accesskey}</span></qui-badge></span><br/> | ||
<span>Secret Key: <qui-badge><span>${this._loginDetails.secretkey}</span></qui-badge></span> | ||
</div>`; | ||
} | ||
} | ||
|
||
} | ||
customElements.define('qwc-minio-card', QwcMinioCard); |
24 changes: 24 additions & 0 deletions
24
...o-client/runtime/src/main/java/io/quarkiverse/minio/client/devui/MinioJsonRPCService.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,24 @@ | ||
package io.quarkiverse.minio.client.devui; | ||
|
||
import org.eclipse.microprofile.config.Config; | ||
import org.eclipse.microprofile.config.ConfigProvider; | ||
|
||
import io.smallrye.common.annotation.NonBlocking; | ||
import io.vertx.core.json.JsonObject; | ||
|
||
public class MinioJsonRPCService { | ||
|
||
Config config = ConfigProvider.getConfig(); | ||
|
||
@NonBlocking | ||
public String getMinioConsoleUrl() { | ||
return config.getOptionalValue("quarkus.minio.console", String.class).orElse(null); | ||
} | ||
|
||
@NonBlocking | ||
public JsonObject getLoginDetails() { | ||
return JsonObject.of( | ||
"accesskey", config.getOptionalValue("quarkus.minio.access-key", String.class).orElse(null), | ||
"secretkey", config.getOptionalValue("quarkus.minio.secret-key", String.class).orElse(null)); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check notice
Code scanning / CodeQL
Useless parameter