Skip to content

Commit

Permalink
Fix #148: DevUI Card and Readme (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Oct 14, 2024
1 parent 359c563 commit e985b53
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 9 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Quarkus - JGit
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<div align="center">
<img src="https:/quarkiverse/quarkus-jgit/blob/main/docs/modules/ROOT/assets/images/quarkus.svg" width="67" height="70" ><img src="https:/quarkiverse/quarkus-jgit/blob/main/docs/modules/ROOT/assets/images/plus-sign.svg" height="70" ><img src="https:/quarkiverse/quarkus-jgit/blob/main/docs/modules/ROOT/assets/images/jgit.svg" height="70" >

# Quarkus JGit
</div>
<br>

[![Version](https://img.shields.io/maven-central/v/io.quarkiverse.jgit/quarkus-jgit?logo=apache-maven&style=flat-square)](https://search.maven.org/artifact/io.quarkiverse.jgit/quarkus-jgit)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](https://opensource.org/licenses/Apache-2.0)
[![Build](https:/quarkiverse/quarkus-jgit/actions/workflows/build.yml/badge.svg)](https:/quarkiverse/quarkus-jgit/actions/workflows/build.yml)

## Introduction

Expand Down Expand Up @@ -40,4 +44,4 @@ Thanks go to these wonderful people ([emoji key](https://allcontributors.org/doc

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https:/all-contributors/all-contributors) specification. Contributions of any kind welcome!
This project follows the [all-contributors](https:/all-contributors/all-contributors) specification. Contributions of any kind welcome!
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,39 @@

import java.util.Optional;

import org.eclipse.jgit.api.Git;

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.ExternalPageBuilder;
import io.quarkus.devui.spi.page.Page;
import io.quarkus.jgit.deployment.GiteaDevServiceInfoBuildItem;

public class GiteaDevUIProcessor {

@BuildStep(onlyIf = IsDevelopment.class)
void createCard(Optional<GiteaDevServiceInfoBuildItem> info, BuildProducer<CardPageBuildItem> cardPage) {
CardPageBuildItem card = new CardPageBuildItem();

info.ifPresent(i -> {
String url = "http://" + i.host() + ":" + i.httpPort();
CardPageBuildItem card = new CardPageBuildItem();
card.addPage(Page.externalPageBuilder("Gitea Dashboard")
.doNotEmbed()
.icon("font-awesome-solid:code-branch")
.url(url, url));
cardPage.produce(card);
});

final ExternalPageBuilder versionPage = Page.externalPageBuilder("JGit Version")
.icon("font-awesome-solid:tag")
.url("https://www.eclipse.org/jgit/")
.doNotEmbed()
.staticLabel(Git.class.getPackage().getImplementationVersion());

card.addPage(versionPage);

card.setCustomCard("qwc-jgit-card.js");
cardPage.produce(card);
}
}
}
86 changes: 86 additions & 0 deletions deployment/src/main/resources/dev-ui/qwc-jgit-card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { LitElement, html, css} from 'lit';
import { pages } from 'build-time-data';
import 'qwc/qwc-extension-link.js';

const NAME = "JGit";
export class QwcJGitCard 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: 2px 2px;
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,PHN2ZyB4bWxucz0iaHR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C4zNzEiLz48L2c+PC9zdmc+"
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}"
?embed=${page.embed}
externalUrl="${page.metadata.externalUrl}"
webcomponent="${page.componentLink}" >
</qwc-extension-link>
`)}`;
}

}
customElements.define('qwc-jgit-card', QwcJGitCard);
1 change: 1 addition & 0 deletions docs/modules/ROOT/assets/images/jgit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions docs/modules/ROOT/assets/images/plus-sign.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/assets/images/quarkus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion runtime/src/main/resources/META-INF/quarkus-extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ metadata:
- "git"
categories:
- "miscellaneous"
config:
- "quarkus.jgit."
guide: https://quarkiverse.github.io/quarkiverse-docs/quarkus-jgit/dev/index.html
status: "stable"
icon-url: "https://raw.githubusercontent.com/quarkiverse/quarkus-jgit/main/docs/modules/ROOT/assets/images/jgit.svg"
status: "stable"

0 comments on commit e985b53

Please sign in to comment.