mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
Using HyperlinkNote to make the upstream information clickable.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@31897 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
47d474fd57
commit
773a607c2f
1 file changed
+26
-2
@@ -27,6 +27,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import hudson.console.HyperlinkNote;
|
||||
import hudson.diagnosis.OldDataMonitor;
|
||||
import hudson.util.XStream2;
|
||||
import org.kohsuke.stapler.export.Exported;
|
||||
@@ -108,11 +109,25 @@ public abstract class Cause {
|
||||
|
||||
public UpstreamCause(Run<?, ?> up) {
|
||||
upstreamBuild = up.getNumber();
|
||||
upstreamProject = up.getParent().getName();
|
||||
upstreamProject = up.getParent().getFullName();
|
||||
upstreamUrl = up.getParent().getUrl();
|
||||
upstreamCauses = new ArrayList<Cause>(up.getCauses());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this cause points to a build in the specified job.
|
||||
*/
|
||||
public boolean pointsTo(Job<?,?> j) {
|
||||
return j.getFullName().equals(upstreamProject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this cause points to the specified build.
|
||||
*/
|
||||
public boolean pointsTo(Run<?,?> r) {
|
||||
return r.getNumber()==upstreamBuild && pointsTo(r.getParent());
|
||||
}
|
||||
|
||||
@Exported(visibility=3)
|
||||
public String getUpstreamProject() {
|
||||
return upstreamProject;
|
||||
@@ -130,7 +145,16 @@ public abstract class Cause {
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return Messages.Cause_UpstreamCause_ShortDescription(upstreamProject, Integer.toString(upstreamBuild));
|
||||
return Messages.Cause_UpstreamCause_ShortDescription(upstreamProject, upstreamBuild);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(TaskListener listener) {
|
||||
listener.getLogger().println(
|
||||
Messages.Cause_UpstreamCause_ShortDescription(
|
||||
HyperlinkNote.encodeTo('/'+upstreamUrl, upstreamProject),
|
||||
HyperlinkNote.encodeTo('/'+upstreamUrl+upstreamBuild, Integer.toString(upstreamBuild)))
|
||||
);
|
||||
}
|
||||
|
||||
public static class ConverterImpl extends XStream2.PassthruConverter<UpstreamCause> {
|
||||
|
||||
Reference in new issue
Block a user