forked from imod/managed-scripts-plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-42888] [FIXED ENKINS-44480] [FIXED JENKINS-45399] show…
… correct arguments for selected script and add details link to script
- Loading branch information
Showing
9 changed files
with
72 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/org/jenkinsci/plugins/managedscripts/DetailLinkDescription.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.jenkinsci.plugins.managedscripts; | ||
|
||
import hudson.model.Item; | ||
import jenkins.model.Jenkins; | ||
import org.apache.commons.lang.StringUtils; | ||
import org.jenkinsci.plugins.configfiles.utils.DescriptionResponse; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
|
||
public class DetailLinkDescription extends DescriptionResponse { | ||
private DetailLinkDescription(String linkHtml) { | ||
super(linkHtml); | ||
} | ||
|
||
public static DetailLinkDescription getDescription(StaplerRequest req, Item context, String fileId, String argumentDetails) { | ||
return new DetailLinkDescription(getDetailsLink(req, context, fileId, argumentDetails)); | ||
} | ||
|
||
private static String getDetailsLink(StaplerRequest req, Item context, String fileId, String argumentDetails) { | ||
String link = req.getContextPath(); | ||
link = StringUtils.isNotBlank(context.getUrl()) ? link + "/" + context.getUrl() : link; | ||
link = link + "configfiles/show?id=" + fileId; | ||
String html = "<a target=\"_blank\" href=\"" + link + "\">view selected file</a>"; | ||
|
||
if (StringUtils.isNotBlank(argumentDetails)) { | ||
html = html + "<br />" + argumentDetails; | ||
} | ||
|
||
// 1x16 spacer needed for IE since it doesn't support min-height | ||
html = "<div class='ok'><img src='" + | ||
req.getContextPath() + Jenkins.RESOURCE_PATH + "/images/none.gif' height=16 width=1>" + | ||
html + "</div>"; | ||
|
||
return html; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.