From 41db33cda36ea4ef70e8c20655d241c3659b12de Mon Sep 17 00:00:00 2001 From: James Nord Date: Mon, 22 Jul 2024 00:41:04 +0100 Subject: [PATCH 1/3] [JENKINS-73404] SecretTextArea missing FormValidation support (#9450) * [JENKINS-73404] unit test * roundtrip as Secrets * [JENKINS-73404] add validation for SecretTextArea reworked the jelly and simplified the javascript. the textarea is now always present in the DOM, so no need to remove inputs to add a textarea. Rather we just remove /hide the "hidden" attribute from the elements we want to show/hide and give the textArea the expected class and attributes for validation to occur * remove unused data-prompt attribute * Adapt getHiddenSecretValue to backend changes * Adapt to Secrets being sent as "" rather than null values for SecretTextArea are now always sent. Whilst this is a change in behavior the only way once set to unset is to set the value to the mpty string "" which would still produce a Secret Additionally this matches the behaviour of f:password and f:textarea Given both of the above this change in behaviour should not break any production use cases. * Remove trailing spaces --------- Co-authored-by: Mark Waite (cherry picked from commit 81b90e4c118bcdc9b283037e819fb2d6217da18a) --- .../resources/lib/form/secretTextarea.jelly | 28 +++- .../lib/form/secretTextarea/secret.css | 6 +- .../lib/form/secretTextarea/secret.js | 35 ++--- .../hudson/util/FormFieldValidatorTest.java | 125 +++++++++++++++++- .../java/lib/form/SecretTextareaTest.java | 15 ++- .../ValidatingDescribable/config.jelly | 20 +++ 6 files changed, 195 insertions(+), 34 deletions(-) create mode 100644 test/src/test/resources/hudson/util/FormFieldValidatorTest/ValidatingDescribable/config.jelly diff --git a/core/src/main/resources/lib/form/secretTextarea.jelly b/core/src/main/resources/lib/form/secretTextarea.jelly index ca95219fc3f3..323a8435d0f3 100644 --- a/core/src/main/resources/lib/form/secretTextarea.jelly +++ b/core/src/main/resources/lib/form/secretTextarea.jelly @@ -2,7 +2,7 @@ org.jenkins-ci.plugins junit - 1265.v65b_14fa_f12f0 + 1291.v60776881903c hpi