Skip to content

Commit

Permalink
Add a link to the milestone creation page
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Aug 1, 2024
1 parent f2e870a commit 73019aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/main/java/io/quarkus/backports/BackportsResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.IOException;
import java.util.Collection;

import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.jboss.resteasy.reactive.RestPath;

import jakarta.inject.Inject;
Expand All @@ -27,9 +28,12 @@ public class BackportsResource {
@Inject
GitHubService gitHub;

@ConfigProperty(name = "backports.repository")
String repository;

@CheckedTemplate
public static class Templates {
public static native TemplateInstance index(Collection<Milestone> milestones);
public static native TemplateInstance index(String repository, Collection<Milestone> milestones);

public static native TemplateInstance backports(Milestone milestone, Collection<PullRequest> prs);
}
Expand All @@ -39,7 +43,7 @@ public static class Templates {
@CacheInvalidateAll(cacheName = CacheNames.MILESTONES_CACHE_NAME)
@Blocking
public TemplateInstance index() throws IOException {
return Templates.index(gitHub.getOpenMilestones());
return Templates.index(repository, gitHub.getOpenMilestones());
}

@GET
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/META-INF/resources/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
margin-top: 16em;
}

.create-milestone {
text-align: right;
}

.backports {
padding-top: 5em;
padding-bottom: 20em;
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/templates/BackportsResource/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ <h3 class="ui header">Choose a milestone</h3>
{/}
</select>
</div>
<div class="create-milestone"><a href="https://github.com/{repository}/milestones/new">Create missing milestone</a></div>
<div class="ui submit green button" id="lets-backport">Let's backport!</div>
</div>
</div>
Expand All @@ -29,7 +30,7 @@ <h3 class="ui header">Choose a milestone</h3>
{#scripts}
<script type="text/javascript">
$('select.dropdown').dropdown();

$('#lets-backport').click(function() {
window.location.href = '/backports/' + $('select#milestone').children("option:selected").val() + '/';
return false;
Expand Down

0 comments on commit 73019aa

Please sign in to comment.