Skip to content

Commit

Permalink
Fix JENKINS-15048 - shorten build data display name
Browse files Browse the repository at this point in the history
Longer display name moves crucial data off screen to the right.
  • Loading branch information
Mark Waite committed Sep 9, 2012
1 parent c843a70 commit 786740d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/main/java/hudson/plugins/git/util/BuildData.java
Expand Up @@ -69,16 +69,19 @@ public BuildData(String scmName, Collection<UserRemoteConfig> remoteConfigs) {
}
}

/**
* Returns the build data display name, optionally with SCM name.
* This string needs to be relatively short because it is
* displayed in a column with other short links. If it is
* lengthened, it causes the other data on the page to shift
* right. The page is then difficult to read.
*
* @return build data display name
*/
public String getDisplayName() {
String out_name = "Git Build Data";

if (!remoteUrls.isEmpty())
out_name = out_name + " - " + remoteUrls;

if (scmName != null && !scmName.isEmpty())
out_name = out_name + " (" + scmName + ")";

return out_name;
return "Git Build Data:" + scmName;
return "Git Build Data";
}

public String getIconFileName() {
Expand Down
27 changes: 27 additions & 0 deletions src/test/java/hudson/plugins/git/util/BuildDataTest.java
@@ -0,0 +1,27 @@
package hudson.plugins.git.util;

import hudson.plugins.git.AbstractGitTestCase;

import hudson.plugins.git.util.BuildData;

/**
* @author Mark Waite
*/
public class BuildDataTest extends AbstractGitTestCase {
/**
* Verifies that the display name is "Git Build Data".
*/
public void testDisplayNameWithoutSCM() throws Exception {
final BuildData data = new BuildData();
assertEquals(data.getDisplayName(), "Git Build Data");
}

/**
* Verifies that the display name is "Git Build Data:scmName".
*/
public void testDisplayNameWithSCM() throws Exception {
final String scmName = "testSCM";
final BuildData data = new BuildData(scmName);
assertEquals("Git Build Data:" + scmName, data.getDisplayName());
}
}

0 comments on commit 786740d

Please sign in to comment.