Skip to content

Commit

Permalink
[JENKINS-74013] Extract inline JavaScript event handler from `Subvers…
Browse files Browse the repository at this point in the history
…ionSCMSource` (#322)
  • Loading branch information
yaroslavafenkin authored Oct 29, 2024
1 parent 53233cf commit 5465ce1
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -938,10 +938,7 @@ public FormValidation doCheckCredentialsId(StaplerRequest req, @AncestorInPath I
} catch (SVNException e) {
LOGGER.log(Level.INFO, "Failed to access subversion repository "+url,e);
String message = hudson.scm.subversion.Messages.SubversionSCM_doCheckRemote_exceptionMsg1(
Util.escape(url), Util.escape(e.getErrorMessage().getFullMessage()),
"javascript:document.getElementById('svnerror').style.display='block';"
+ "document.getElementById('svnerrorlink').style.display='none';"
+ "return false;")
Util.escape(url), Util.escape(e.getErrorMessage().getFullMessage()))
+ "<br/><pre id=\"svnerror\" style=\"display:none\">"
+ Util.xmlEscape(Functions.printThrowable(e)) + "</pre>";
return FormValidation.errorWithMarkup(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SubversionSCM.doCheckRemote.badPath=\
SubversionSCM.doCheckRemote.badPathSuggest=\
"{0}/{1}" doesn''t exist in the repository. Maybe you meant "{0}{2}"?
SubversionSCM.doCheckRemote.exceptionMsg1=\
Unable to access {0} : {1} <a href="#" id="svnerrorlink" onclick="{2}">(show details)</a>
Unable to access {0} : {1} <a href="#" id="svnerrorlink">(show details)</a>
SubversionSCM.doCheckRemote.exceptionMsg2=\
(Maybe you need to <a href="{0}" target="_blank">enter credential</a>?)
SubversionSCM.doCheckRemote.invalidUrl=Invalid URL syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SubversionSCM.doCheckRemote.badPath=\
SubversionSCM.doCheckRemote.badPathSuggest=\
"{0}/{1}" existiert nicht im Repository. Meinten Sie vielleicht "{0}{2}"?
SubversionSCM.doCheckRemote.exceptionMsg1=\
Kein Zugriff auf {0} : {1} <a href="#" id="svnerrorlink" onclick="{2}">(Details)</a>
Kein Zugriff auf {0} : {1} <a href="#" id="svnerrorlink">(Details)</a>
SubversionSCM.doCheckRemote.exceptionMsg2=\
(Vielleicht müssen Sie sich zuvor <a href="{0}" target="_blank">authentifizieren</a>?)
SubversionSCM.doCheckRemote.invalidUrl=\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SubversionTagAction.DisplayName.HasNoTag=Etiquetar esta ejecuci
SubversionSCM.doCheckRemote.badPath={0} no existe en el repositorio

SubversionSCM.doCheckRemote.exceptionMsg1=\
Acceso imposible a {0} : {1} <a href="#" id="svnerrorlink" onclick="{2}">(ver detalles)</a>
Acceso imposible a {0} : {1} <a href="#" id="svnerrorlink">(ver detalles)</a>

SubversionTagAction.DisplayName.HasTags=Etiquetas
SubversionTagAction.Tooltip=Etiquetado
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SubversionSCM.doCheckRemote.badPath=\
SubversionSCM.doCheckRemote.badPathSuggest=\
"{0}/{1}" n''existe pas dans le d\u00e9p\u00f4t. Vous pensiez peut-\u00eatre \u00e0 "{0}{2}" ?
SubversionSCM.doCheckRemote.exceptionMsg1=\
Impossible d''acc\u00e9der \u00e0 {0} : {1} <a href="#" id="svnerrorlink" onclick="{2}">(voir les d\u00e9tails)</a>
Impossible d''acc\u00e9der \u00e0 {0} : {1} <a href="#" id="svnerrorlink">(voir les d\u00e9tails)</a>
SubversionSCM.doCheckRemote.exceptionMsg2=\
(Vous avez peut-\u00eatre besoin de <a href="{0}" target="_blank">saisir des identifiants</a> ?)
SubversionSCM.doCheckRemote.invalidUrl=\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SubversionSCM.doCheckRemote.badPath=\
SubversionSCM.doCheckRemote.badPathSuggest=\
"{0}/{1}" \u306f\u30ea\u30dd\u30b8\u30c8\u30ea\u306b\u5b58\u5728\u3057\u307e\u305b\u3093\u3002"{0}{2}"\u3067\u306f\u306a\u3044\u3067\u3059\u304b?
SubversionSCM.doCheckRemote.exceptionMsg1=\
{0}\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u305b\u3093\u3002 : {1} <a href="#" id="svnerrorlink" onclick="{2}">(\u8a73\u7d30)</a>
{0}\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u305b\u3093\u3002 : {1} <a href="#" id="svnerrorlink">(\u8a73\u7d30)</a>
SubversionSCM.doCheckRemote.exceptionMsg2=\
(<a href="{0}" target="_blank">\u8a8d\u8a3c\u3092\u5165\u529b</a>\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093)
SubversionSCM.doCheckRemote.invalidUrl=\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SubversionSCM.doCheckRemote.badPath=\
SubversionSCM.doCheckRemote.badPathSuggest=\
\u5132\u5b58\u5eab\u88e1\u6c92\u6709 "{0}/{1}"\u3002\u60a8\u6307\u7684\u662f "{0}{2}" \u55ce?
SubversionSCM.doCheckRemote.exceptionMsg1=\
\u7121\u6cd5\u5b58\u53d6 {0} : {1} <a href="#" id="svnerrorlink" onclick="{2}">(\u986f\u793a\u8a73\u7d30\u8cc7\u6599)</a>
\u7121\u6cd5\u5b58\u53d6 {0} : {1} <a href="#" id="svnerrorlink">(\u986f\u793a\u8a73\u7d30\u8cc7\u6599)</a>
SubversionSCM.doCheckRemote.exceptionMsg2=\
(\u6216\u8a31\u60a8\u8a72<a href="{0}" target="_blank">\u8f38\u5165\u6191\u8b49</a> \u4e86?)
SubversionSCM.doCheckRemote.invalidUrl=\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<?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:c="/lib/credentials">
<st:adjunct includes="jenkins.scm.impl.subversion.SubversionSCMSource.resource"/>
<f:entry title="${%Project Repository Base}" field="remoteBase">
<f:textbox/>
</f:entry>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Behaviour.specify("#svnerrorlink", "SubversionSCMSource_showDetails", 0, (element) => {
element.addEventListener("click", (event) => {
event.preventDefault();

document.getElementById("svnerror").style.display = "block";
event.target.style.display = "none";
});
});

0 comments on commit 5465ce1

Please sign in to comment.