Skip to content

Commit

Permalink
add links for repository and commit (#3)
Browse files Browse the repository at this point in the history
* add links for repository and commit

* link to tree, not commit
  • Loading branch information
NateBrady23 authored and michaelhixson committed Apr 17, 2018
1 parent 3983263 commit ccc4617
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/main/java/tfb/status/view/HomePageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,20 @@ public static final class ResultsGitView {
public final String commitId;
@Nullable public final String repositoryUrl;
@Nullable public final String branchName;
@Nullable public final String commitUrl;

public ResultsGitView(String commitId,
@Nullable String repositoryUrl,
@Nullable String branchName) {
this.commitId = Objects.requireNonNull(commitId);
this.repositoryUrl = repositoryUrl;
this.branchName = branchName;
if (this.repositoryUrl != null) {
this.commitUrl = repositoryUrl.replace(".git$", "")
+ "/tree/" + this.commitId;
} else {
this.commitUrl = null;
}
}
}
}
12 changes: 9 additions & 3 deletions src/main/resources/mustache/detail.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ The HTML of the results detail page.
{{#git}}
<dl>
<dt>TFB git commit ID</dt>
<dd><code>{{commitId}}</code></dd>
<dd>
{{#commitUrl}}<a href="{{commitUrl}}">{{commitId}}</a>{{/commitUrl}}
{{^commitUrl}}<code>{{commitId}}</code>{{/commitUrl}}
</dd>
<dt>TFB git repository URL</dt>
<dd>{{#repositoryUrl}}<code>{{repositoryUrl}}</code>{{/repositoryUrl}}
{{^repositoryUrl}}(unknown, probably <code>https://github.com/TechEmpower/FrameworkBenchmarks.git</code>){{/repositoryUrl}}</dd>
<dd>{{#repositoryUrl}}<a href="{{repositoryUrl}}">{{repositoryUrl}}</a>{{/repositoryUrl}}
{{^repositoryUrl}}
(unknown, probably <a href="https://github.com/TechEmpower/FrameworkBenchmarks.git">
https://github.com/TechEmpower/FrameworkBenchmarks.git</a>)
{{/repositoryUrl}}</dd>
<dt>TFB git branch name</dt>
<dd>{{#branchName}}<code>{{branchName}}</code>{{/branchName}}
{{^branchName}}(unknown, probably <code>master</code>){{/branchName}}</dd>
Expand Down

0 comments on commit ccc4617

Please sign in to comment.