Skip to content
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 a link to gitea in the DevUI #151

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 -> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why making it Optional? If the GiteaDevServiceInfoBuildItem isn't produced, it won't call this method, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the method will be called with a 'null' value.

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);
});
}
}