Skip to content

Commit

Permalink
Remove unused checkMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
timja committed May 7, 2023
1 parent d8fd7f9 commit 3c890bd
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 48 deletions.
Expand Up @@ -24,7 +24,7 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler" xmlns:t="/hudson/tools">
<f:entry title="${%Command}" field="command">
<f:textarea checkMethod="post"/>
<f:textarea />
</f:entry>
<f:entry title="${%Tool Home}" field="toolHome">
<f:textbox/>
Expand Down
Expand Up @@ -24,7 +24,7 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler" xmlns:t="/hudson/tools">
<f:entry title="${%Download URL for binary archive}" field="url">
<f:textbox checkMethod="post"/>
<f:textbox />
</f:entry>
<f:entry title="${%Subdirectory of extracted archive}" field="subdir">
<f:textbox/>
Expand Down
Expand Up @@ -26,7 +26,7 @@ THE SOFTWARE.
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:section title="${%Serve resource files from another domain}">
<f:entry title="${%Resource Root URL}" field="url">
<f:textbox checkMethod="post"/>
<f:textbox />
</f:entry>
</f:section>
</j:jelly>
5 changes: 0 additions & 5 deletions core/src/main/resources/lib/form/combobox.jelly
Expand Up @@ -62,11 +62,6 @@ THE SOFTWARE.
If @field is specified, this will be inferred automatically,
which is the recommended approach.
</st:attribute>
<st:attribute name="checkMethod" use="optional" type="String">
Specify 'get' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a POST to a GET.
If any other value is specified then requests will use POST.
The historical default was GET and 'post' had to be specified to change that, but this was changed in Jenkins 2.285.
</st:attribute>
</st:documentation>
<f:prepareDatabinding/>
${descriptor.calcFillSettings(field,attrs)} <!-- this figures out the 'fillUrl' and 'fillDependsOn' attribute -->
Expand Down
5 changes: 0 additions & 5 deletions core/src/main/resources/lib/form/number.jelly
Expand Up @@ -80,11 +80,6 @@ THE SOFTWARE.
If @field is specified, this will be inferred automatically,
which is the recommended approach.
</st:attribute>
<st:attribute name="checkMethod" use="optional" type="String">
Specify 'get' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a POST to a GET.
If any other value is specified then requests will use POST.
The historical default was GET and 'post' had to be specified to change that, but this was changed in Jenkins 2.285.
</st:attribute>
</st:documentation>
<f:prepareDatabinding />

Expand Down
3 changes: 0 additions & 3 deletions core/src/main/resources/lib/form/password.jelly
Expand Up @@ -83,7 +83,6 @@ THE SOFTWARE.
name="${attrs.name ?: '_.'+attrs.field}"
value="${value}"
type="hidden"
checkMethod="post"
ATTRIBUTES="${attrs}" EXCEPT="field clazz value"/>
<div class="hidden-password-placeholder">
<div class="hidden-password-legend">
Expand All @@ -103,7 +102,6 @@ THE SOFTWARE.
value="${value}"
type="text"
oninput="this.setAttribute('type', 'password'); return true;"
checkMethod="post"
ATTRIBUTES="${attrs}" EXCEPT="field clazz value"/>
<!-- TODO consider customizedFields -->
</j:otherwise>
Expand All @@ -115,7 +113,6 @@ THE SOFTWARE.
name="${attrs.name ?: '_.'+attrs.field}"
value="${h.getPasswordValue(resolvedValue)}"
type="password"
checkMethod="post"
ATTRIBUTES="${attrs}" EXCEPT="field clazz value"/>
</j:otherwise>
</j:choose>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/form/readOnlyTextbox.jelly
Expand Up @@ -70,7 +70,7 @@ THE SOFTWARE.
id="${attrs.id}"
type="text"
readonly="readonly"
checkUrl="${attrs.checkUrl}" checkDependsOn="${attrs.checkDependsOn}" checkMethod="${attrs.checkMethod}"
checkUrl="${attrs.checkUrl}" checkDependsOn="${attrs.checkDependsOn}"
checkMessage="${attrs.checkMessage}"
onchange="${attrs.onchange}" onkeyup="${attrs.onkeyup}"/>
</j:jelly>
5 changes: 0 additions & 5 deletions core/src/main/resources/lib/form/select.jelly
Expand Up @@ -51,11 +51,6 @@ THE SOFTWARE.
If @field is specified, this will be inferred automatically,
which is the recommended approach.
</st:attribute>
<st:attribute name="checkMethod" use="optional" type="String">
Specify 'get' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a POST to a GET.
If any other value is specified then requests will use POST.
The historical default was GET and 'post' had to be specified to change that, but this was changed in Jenkins 2.285.
</st:attribute>
</st:documentation>

<f:prepareDatabinding/>
Expand Down
7 changes: 1 addition & 6 deletions core/src/main/resources/lib/form/textarea.jelly
Expand Up @@ -57,11 +57,6 @@ THE SOFTWARE.
If @field is specified, this will be inferred automatically,
which is the recommended approach.
</st:attribute>
<st:attribute name="checkMethod" use="optional" type="String">
Specify 'get' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a POST to a GET.
If any other value is specified then requests will use POST.
The historical default was GET and 'post' had to be specified to change that, but this was changed in Jenkins 2.285.
</st:attribute>
<st:attribute name="codemirror-mode">
Turns this text area into CodeMirror-assisted code editing text area.
This attribute specifies the mode of CodeMirror, such as "text/x-java".
Expand Down Expand Up @@ -93,7 +88,7 @@ THE SOFTWARE.
<textarea id="${attrs.id}" style="${attrs.style}"
name ="${name}"
class="jenkins-input ${attrs.checkUrl!=null?'validated':''} ${attrs['codemirror-mode']!=null?'codemirror':''} ${attrs.class}"
checkUrl="${attrs.checkUrl}" checkDependsOn="${attrs.checkDependsOn}" checkMethod="${attrs.checkMethod}"
checkUrl="${attrs.checkUrl}" checkDependsOn="${attrs.checkDependsOn}"
rows="${h.determineRows(value)}"
readonly="${attrs.readonly}"
codemirror-mode="${attrs['codemirror-mode']}"
Expand Down
5 changes: 0 additions & 5 deletions core/src/main/resources/lib/form/textbox.jelly
Expand Up @@ -77,11 +77,6 @@ THE SOFTWARE.
If @field is specified, this will be inferred automatically,
which is the recommended approach.
</st:attribute>
<st:attribute name="checkMethod" use="optional" type="String">
Specify 'get' (must be lowercase) to change the HTTP method used for the AJAX requests to @checkUrl from a POST to a GET.
If any other value is specified then requests will use POST.
The historical default was GET and 'post' had to be specified to change that, but this was changed in Jenkins 2.285.
</st:attribute>
<st:attribute name="autoCompleteUrl">
Url to use for auto-completion

Expand Down
23 changes: 8 additions & 15 deletions war/src/main/webapp/scripts/hudson-behavior.js
Expand Up @@ -219,23 +219,19 @@ var FormChecker = {
*
* @param url
* Remote doXYZ URL that performs the check. Query string should include the field value.
* @param method
* HTTP method. GET or POST. I haven't confirmed specifics, but some browsers seem to cache GET requests.
* @param target
* HTML element whose innerHTML will be overwritten when the check is completed.
*/
delayedCheck: function (url, method, target) {
if (url == null || method == null || target == null) return; // don't know whether we should throw an exception or ignore this. some broken plugins have illegal parameters
this.queue.push({ url: url, method: method, target: target });
delayedCheck: function (url, target) {
if (url == null || target == null) return; // don't know whether we should throw an exception or ignore this. some broken plugins have illegal parameters
this.queue.push({ url: url, target: target });
this.schedule();
},

sendRequest: function (url, params) {
if (params.method !== "get") {
var idx = url.indexOf("?");
params.parameters = url.substring(idx + 1);
url = url.substring(0, idx);
}
const idx = url.indexOf("?");
params.parameters = url.substring(idx + 1);
url = url.substring(0, idx);

fetch(url, {
method: "post",
Expand All @@ -254,7 +250,6 @@ var FormChecker = {

var next = this.queue.shift();
this.sendRequest(next.url, {
method: next.method,
onComplete: function (x) {
x.text().then((responseText) => {
updateValidationArea(next.target, responseText);
Expand Down Expand Up @@ -644,15 +639,14 @@ function registerValidator(e) {
return url + q.toString();
}
};
var method = e.getAttribute("checkMethod") || "post";

var url = e.targetUrl();
try {
FormChecker.delayedCheck(url, method, e.targetElement);
FormChecker.delayedCheck(url, e.targetElement);
} catch (x) {
// this happens if the checkUrl refers to a non-existing element.
// don't let this kill off the entire JavaScript
YAHOO.log(
console.warn(
"Failed to register validation method: " +
e.getAttribute("checkUrl") +
" : " +
Expand All @@ -664,7 +658,6 @@ function registerValidator(e) {
var checker = function () {
const validationArea = this.targetElement;
FormChecker.sendRequest(this.targetUrl(), {
method: method,
onComplete: function (response) {
// TODO Add i18n support
response.text().then((responseText) => {
Expand Down

0 comments on commit 3c890bd

Please sign in to comment.