Skip to content

Commit

Permalink
Merge branch 'master' into confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
mawinter69 authored Jun 26, 2023
2 parents 7cdec17 + 9934222 commit 337ee17
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<j:choose>
<j:when test="${descriptor.isCurrentUser(it)}">
<button class="jenkins-button jenkins-!-destructive-color" type="button" name="reset-seed"
onclick="return resetSeed(this)"
id="user-seed-property-reset-seed"
data-target-url="${descriptor.descriptorFullUrl}/renewSessionSeed"
data-confirm="${%resetSeed.confirmation}"
data-redirect-url="${request.contextPath}/">
Expand All @@ -19,7 +19,7 @@
</j:when>
<j:otherwise>
<button class="jenkins-button jenkins-!-destructive-color" type="button" name="reset-seed"
onclick="return resetSeed(this)"
id="user-seed-property-reset-seed"
data-target-url="${descriptor.descriptorFullUrl}/renewSessionSeed"
data-confirm="${%resetSeed.confirmation}">
${%resetSeed.button}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
window.resetSeed = function (button) {
function resetSeed(button) {
var userSeedPanel = button.closest(".user-seed-panel");
var confirmMessage = button.getAttribute("data-confirm");
var targetUrl = button.getAttribute("data-target-url");
Expand All @@ -48,4 +48,14 @@ window.resetSeed = function (button) {
}
});
});
};
}

(function () {
document.addEventListener("DOMContentLoaded", function () {
document
.getElementById("user-seed-property-reset-seed")
.addEventListener("click", function (event) {
resetSeed(event.target);
});
});
})();
4 changes: 2 additions & 2 deletions core/src/main/resources/lib/form/expandableTextbox.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ THE SOFTWARE.
<f:textarea name='${attrs.name}' value="${value}" field="${attrs.field}"/>
</j:when>
<j:otherwise>
<st:adjunct includes="lib.form.expandableTextbox.expandableTextbox"/>
<!-- single line textbox with expand button -->
<f:possibleReadOnlyField>
<div class="expanding-input">
Expand All @@ -78,8 +79,7 @@ THE SOFTWARE.
</j:if>
</div>
<div class="expanding-input__button">
<input type="button" value="&#x25BC;" onclick="expandTextArea(this,'textarea.${h.jsStringEscape(name)}')"
tooltip="${%tooltip}"/>
<input type="button" value="&#x25BC;" tooltip="${%tooltip}"/>
</div>
</div>
</f:possibleReadOnlyField>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* The MIT License
*
* Copyright (c) 2023, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
function expandTextArea(button) {
button.style.display = "none";
var field = button.parentNode.previousSibling.children[0];
var value = field.value.replace(/ +/g, "\n");

var n = button;
while (!n.classList.contains("expanding-input") && n.tagName !== "TABLE") {
n = n.parentNode;
}

var parent = n.parentNode;
parent.innerHTML = "<textarea rows=8 class='jenkins-input'></textarea>";
var textArea = parent.childNodes[0];
textArea.name = field.name;
textArea.value = value;

layoutUpdateCallback.call();
}

Behaviour.specify(
".expanding-input__button > input[type='button']",
"expandable-textbox-expand-button",
0,
function (element) {
element.addEventListener("click", function () {
expandTextArea(element);
});
}
);
3 changes: 1 addition & 2 deletions core/src/main/resources/lib/form/password.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ THE SOFTWARE.
<j:when test="${h.useHidingPasswordFields()}">
<j:set var="value" value="${h.getPasswordValue(resolvedValue)}"/>
<j:choose>
<st:adjunct includes="lib.form.password.password"/>
<j:when test="${ value != null }">
<st:adjunct includes="lib.form.password.password"/>
<div class="hidden-password">
<m:input xmlns:m="jelly:hudson.util.jelly.MorphTagLibrary"
class="complex-password-field hidden-password-field jenkins-input ${attrs.checkUrl!=null?'validated ':''}${attrs.clazz}"
Expand All @@ -102,7 +102,6 @@ THE SOFTWARE.
name="${attrs.name ?: '_.'+attrs.field}"
value="${value}"
type="text"
oninput="this.setAttribute('type', 'password'); return true;"
checkMethod="post"
ATTRIBUTES="${attrs}" EXCEPT="field clazz value"/>
<!-- TODO consider customizedFields -->
Expand Down
11 changes: 11 additions & 0 deletions core/src/main/resources/lib/form/password/password.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,14 @@ Behaviour.specify(
};
}
);

Behaviour.specify(
"input[type='text'].complex-password-field",
"empty-password-text-input",
0,
function (element) {
element.addEventListener("input", function () {
element.setAttribute("type", "password");
});
}
);
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ THE SOFTWARE.
<bridge-method-injector.version>1.26</bridge-method-injector.version>
<spotless.check.skip>false</spotless.check.skip>
<!-- Make sure to keep the jetty-maven-plugin version in war/pom.xml in sync with the Jetty release in Winstone: -->
<winstone.version>6.11</winstone.version>
<winstone.version>6.12</winstone.version>
</properties>

<!--
Expand Down Expand Up @@ -332,7 +332,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.12.0</version>
<version>10.12.1</version>
</dependency>
</dependencies>
<executions>
Expand Down
2 changes: 1 addition & 1 deletion test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ THE SOFTWARE.
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>2028.vb_6e9c2a_8668a_</version>
<version>2034.v41c9cb_349299</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand Down
4 changes: 2 additions & 2 deletions war/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
"postcss-loader": "7.3.3",
"postcss-scss": "4.0.6",
"prettier": "2.8.8",
"sass": "1.63.4",
"sass": "1.63.6",
"sass-loader": "13.3.2",
"style-loader": "3.3.3",
"stylelint": "15.8.0",
"stylelint-checkstyle-reporter": "0.2.0",
"stylelint-config-standard": "33.0.0",
"webpack": "5.87.0",
"webpack": "5.88.0",
"webpack-cli": "5.1.4",
"webpack-remove-empty-scripts": "1.0.3"
},
Expand Down
21 changes: 0 additions & 21 deletions war/src/main/webapp/scripts/hudson-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -2106,27 +2106,6 @@ function AutoScroller(scrollContainer) {
};
}

// used in expandableTextbox.jelly to change a input field into a text area
// eslint-disable-next-line no-unused-vars
function expandTextArea(button, id) {
button.style.display = "none";
var field = button.parentNode.previousSibling.children[0];
var value = field.value.replace(/ +/g, "\n");

var n = button;
while (!n.classList.contains("expanding-input") && n.tagName != "TABLE") {
n = n.parentNode;
}

var parent = n.parentNode;
parent.innerHTML = "<textarea rows=8 class='jenkins-input'></textarea>";
var textArea = parent.childNodes[0];
textArea.name = field.name;
textArea.value = value;

layoutUpdateCallback.call();
}

// refresh a part of the HTML specified by the given ID,
// by using the contents fetched from the given URL.
// eslint-disable-next-line no-unused-vars
Expand Down
20 changes: 10 additions & 10 deletions war/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3994,15 +3994,15 @@ __metadata:
postcss-loader: 7.3.3
postcss-scss: 4.0.6
prettier: 2.8.8
sass: 1.63.4
sass: 1.63.6
sass-loader: 13.3.2
sortablejs: 1.15.0
style-loader: 3.3.3
stylelint: 15.8.0
stylelint-checkstyle-reporter: 0.2.0
stylelint-config-standard: 33.0.0
tippy.js: 6.3.7
webpack: 5.87.0
webpack: 5.88.0
webpack-cli: 5.1.4
webpack-remove-empty-scripts: 1.0.3
window-handle: 1.0.1
Expand Down Expand Up @@ -5666,16 +5666,16 @@ __metadata:
languageName: node
linkType: hard

"sass@npm:1.63.4":
version: 1.63.4
resolution: "sass@npm:1.63.4"
"sass@npm:1.63.6":
version: 1.63.6
resolution: "sass@npm:1.63.6"
dependencies:
chokidar: ">=3.0.0 <4.0.0"
immutable: ^4.0.0
source-map-js: ">=0.6.2 <2.0.0"
bin:
sass: sass.js
checksum: 12bde5beff85a7018157d90c8b9d5aec8b56832f89fcfeca146f10936eecf97e669d22fd41f812b3407ed259bbb114d69c9ecbfc7ee9b15308211fb910cdf5eb
checksum: 3372319904658eeafaf78a09a6fcb3368a68e6d76fe3c43c2d009f4f72e475ab22b82ef483ef5c00fcda3ab00066846c0bd88c36b42771b855f6ab80c7eda541
languageName: node
linkType: hard

Expand Down Expand Up @@ -6454,9 +6454,9 @@ __metadata:
languageName: node
linkType: hard

"webpack@npm:5.87.0":
version: 5.87.0
resolution: "webpack@npm:5.87.0"
"webpack@npm:5.88.0":
version: 5.88.0
resolution: "webpack@npm:5.88.0"
dependencies:
"@types/eslint-scope": ^3.7.3
"@types/estree": ^1.0.0
Expand Down Expand Up @@ -6487,7 +6487,7 @@ __metadata:
optional: true
bin:
webpack: bin/webpack.js
checksum: b7d0e390f9d30627e303d54b17cb87b62f49ecffe2d35481f830679904993bae208e23748ffe0e6091b6dd4810562b2f2e88bb0f23b96515d74fb1e3c2898210
checksum: 9fd1568b34ec2e99ba97c8509a15ab2576ec80c396e7015551ec814b24cfc11de173acba3e114dafe95f1a6d460781b09d6201e6a1fb15110e1d01a09f61a283
languageName: node
linkType: hard

Expand Down

0 comments on commit 337ee17

Please sign in to comment.