-
Notifications
You must be signed in to change notification settings - Fork 144
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
[JENKINS-60082] Show pull request title in name column #476
Changes from all commits
0ef8d9b
13cedc4
a37b5d3
c3620a4
9de361d
315ce8d
02109d5
8718f94
c6198ed
4a3ebec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2104,22 +2104,16 @@ | |
throw new IllegalStateException( | ||
"Name of created project " + project + " did not match expected " + encodedName); | ||
} | ||
// HACK ALERT | ||
// ========== | ||
// We don't want to trigger a save, so we will do some trickery to ensure that observer.created(project) | ||
// performs the save | ||
BulkChange bc = new BulkChange(project); | ||
try { | ||
project.setDisplayName(getProjectDisplayName(project, rawName)); | ||
} catch (IOException e) { | ||
// ignore even if it does happen we didn't want a save | ||
} finally { | ||
bc.abort(); | ||
} | ||
// decorate contract is to ensure it does not trigger a save | ||
_factory.decorate(project); | ||
// ok it is now up to the observer to ensure it does the actual save. | ||
observer.created(project); | ||
try (BulkChange bc = new BulkChange(project);) { | ||
observer.created(project); | ||
project.setDisplayName(getProjectDisplayName(project, rawName)); | ||
bc.commit(); | ||
} catch (IOException e) { | ||
// Ignored | ||
} | ||
Comment on lines
+2110
to
+2116
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change fixed the tests. the observer.created is what creates the I'm not 100% sure on if there's any impact here and why it was so keen to avoid saving / why a bulk change couldn't be used around everything... |
||
doAutomaticBuilds(head, revision, rawName, project, revisionActions, null, null); | ||
} | ||
|
||
|
@@ -2137,8 +2131,9 @@ | |
.orElse(null); | ||
} | ||
|
||
// Default to displaying the project's display name if a trait hasn't been provided | ||
if (naming == null) { | ||
return rawName; | ||
naming = MultiBranchProjectDisplayNamingStrategy.RAW_AND_OBJECT_DISPLAY_NAME; | ||
timja marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
final ObjectMetadataAction action = naming.needsObjectDisplayName() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,14 @@ | |
return rawName; | ||
} | ||
|
||
return format("%s - %s", rawName, displayName); | ||
// The raw name provided here in the context of pull requests is the pull request ID | ||
// We tidy up the ID so that they display consistently between SCMs | ||
String cleanedUpBranchName = rawName; | ||
if (cleanedUpBranchName.startsWith("MR-") || cleanedUpBranchName.startsWith("PR-")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. may need a regex that it's PR-\d+ so its less likely to hit an actual branch name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a branch name won't be hit here because the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this would appear to be putting SCM specifics into an SCM agnostic piece of code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a blocker, and if so would this mean an API likely needs to be created where the SCMs set their prefix? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So initially I was not thinking it was a blocker, but something that should be addressed (in the future as a follow up) But now I am thinking is this just confusing? we use in other words could a user expect that by clicking that link below they get taken to build #7 of the job? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
cleanedUpBranchName = "#" + cleanedUpBranchName.substring(3); | ||
} | ||
|
||
return format("%s (%s)", displayName, cleanedUpBranchName); | ||
} | ||
}, | ||
; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,26 +25,28 @@ THE SOFTWARE. | |
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" | ||
xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt"> | ||
<td style="${indenter.getCss(job)}"> | ||
<d:taglib uri="local"> | ||
<d:tag name="link"> | ||
<a href="${jobBaseUrl}${job.shortUrl}" class='model-link jenkins-table__link'> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extracts the same code into one place and makes minor changes to the classes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why |
||
<l:breakable value="${h.getRelativeDisplayNameFrom(job, itemGroup)}"/> | ||
</a> | ||
</d:tag> | ||
</d:taglib> | ||
|
||
<td style="${indenter.getCss(job)}" xmlns:local="local"> | ||
<j:choose> | ||
<j:when test="${it.isOrphaned(job)}"> | ||
<s> | ||
<a href="${jobBaseUrl}${job.shortUrl}" class='model-link inside jenkins-table_link' title="${it.getTitle(job)}"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @janfaracik Why did you remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't do anything from what I've seen from core. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It controlled whether the context menu dropdown chevron was considered part of the area of the 2.332.x otherwise (ugly but this hover effect was fairly short-lived): |
||
<l:breakable value="${h.getRelativeDisplayNameFrom(job, itemGroup)}"/> | ||
</a> | ||
<local:link /> | ||
</s> | ||
</j:when> | ||
<j:when test="${it.isPrimary(job)}"> | ||
<strong> | ||
<a href="${jobBaseUrl}${job.shortUrl}" class='model-link inside jenkins-table_link' title="${it.getTitle(job)}"> | ||
<l:breakable value="${h.getRelativeDisplayNameFrom(job, itemGroup)}"/> | ||
</a> | ||
<local:link /> | ||
</strong> | ||
</j:when> | ||
<j:otherwise> | ||
<a href="${jobBaseUrl}${job.shortUrl}" class='model-link inside jenkins-table_link' title="${it.getTitle(job)}"> | ||
<l:breakable value="${h.getRelativeDisplayNameFrom(job, itemGroup)}"/> | ||
</a> | ||
<local:link /> | ||
</j:otherwise> | ||
</j:choose> | ||
</td> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing an old public method signature.