Skip to content

Commit

Permalink
feat: Add Gitea link to DevUI (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
iocanel authored Oct 13, 2024
1 parent ead88d9 commit 359c563
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ DevServicesResultBuildItem createContainer(JGitBuildTimeConfig config,
closeBuildItem.addCloseTask(closeable::close, true);
devService = new RunningDevService(JGitProcessor.FEATURE, gitServer.getContainerId(), closeable, configOverrides);

giteaServiceInfo.produce(
new GiteaDevServiceInfoBuildItem(
gitServer.getHost(),
gitServer.getHttpPort(),
config.devservices().adminUsername(),
config.devservices().adminPassword()));
giteaServiceInfo.produce(new GiteaDevServiceInfoBuildItem(
gitServer.getHost(),
gitServer.getHttpPort(),
config.devservices().adminUsername(),
config.devservices().adminPassword()));
return devService.toBuildItem();
}

Expand All @@ -59,5 +58,4 @@ public boolean getAsBoolean() {
return config.devservices().enabled();
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.quarkus.jgit.deployment.devui;

import java.util.Optional;

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.jgit.deployment.GiteaDevServiceInfoBuildItem;

public class GiteaDevUIProcessor {

@BuildStep(onlyIf = IsDevelopment.class)
void createCard(Optional<GiteaDevServiceInfoBuildItem> info, BuildProducer<CardPageBuildItem> cardPage) {
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);
});
}
}

0 comments on commit 359c563

Please sign in to comment.