-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-60866] Advanced button, build health, confirmation link, URI encoding monitor #5515
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this related to https://issues.jenkins.io/browse/JENKINS-60881 ?
@timja Thanks, updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The missing wrapping behavior could be potentially problematic but I have no examples to demonstrate that :-)
🐛 Only one where I have serious doubts about is the healthReport in the widget. The adjunct seems not loaded/effective.
Working proofs
In case something was wrong but I was not aware :pURICheckEncodingMonitor
Advanced button
Validate button
BuildHealth in the job table
The effect is working fine and the adjunct is inserted.
Hover working thanks to the added/removed class
Adjunct added as expected
Confirmation link
Not working proofs
🐛 BuildHealth in the left widget
[Disclaimer] To see anything, you need to have at least one build in the history of the job you are looking, otherwise the tooltip will not exist.
The effect is working because of :hover
, not because of the .hover
class added/removed by the script.
The script itself does not seem to be loaded, even if using the debugging I saw the code from AdjunctsInPage#generate being called.
💡 AFAICT the problem is coming from the widget/ajax nature of that feature.
Be careful, the "desired effect" is working, but not in the way you would expect, and thus could lead to other errors in the future that will be very complicated to solve as the code will "seem to work".
No hover, but tooltip displayed thanks to :hover
No adjunct for BuildHealth
On ci.jenkins.io
As you can see, the hover class is added and you can even see the mouseenter/out event inlined at that point.
Debug information
I compared the confirmationLink adjunct with the buildHealth. The first one is included correctly in the page, compared to the second that is not. The difference I have seen is about the out
, being an HTMLWriterOutput
for confirmationLink (and all other adjuncts) and an XMLOutput
for buildHealth.
Debug with intelligence (headache included for free 🎁)
We are changing HTMLWriterOutput to XMLOutput in the frames at ParseTag#parseBody:
More precisely at HistoryWidget/index.jelly#L28, that is then executed in HistoryWidget/index.jelly#L62.
The problem is that AdjunctsInPage#generate is writing the script "directly" to the output, meaning in text instead of as a tag. When the ParseTag#parseBody does the endDocument, it erases the textBuffer and so, delete the just added script. To correct this behavior we should write the script as a tag, like:
Which, is working fine.
💡 The quick workaround is to call manually the adjunct from buildHealth before the f:parse (manualy tested).
@@ -0,0 +1,3 @@ | |||
Behaviour.specify('.Behaviour-validateButton', 'Behaviour-validateButton', 0, function(element) { | |||
element.onclick = function() { safeValidateButton(this); }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Compared to current behavior, this could be executed after another script that is taken care of the existing onClick and wrap it, to have 2 listeners. Leading to erasing the previously (other) registered listener.
I am not aware of any of those for validateButton.onClick
in Jenkins from memory, but if that could trigger someone's memory, that could be nice :)
Example of wrapping behavior: UploadedKeyStoreSource/config.jelly#L50-L55, AFAICT this one is executed after "inline" (like current) and Behaviour (proposed one).
@@ -0,0 +1,18 @@ | |||
Behaviour.specify("A.confirmation-link", 'confirmation-link', 0, function (element) { | |||
element.onclick = function(event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as for validateButton
@Wadeck did you have a chance to re-review it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working fine and correctly now, thanks for the correct 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved once the merge conflict is resolved
This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback. Thanks! |
@Wadeck I noticed this PR still removes https://github.com/jenkinsci/jenkins/pull/5515/files#diff-633560a936835daf74727cace9bff8b456cce93c71f367710bd7865ff3d4d311L41-L43, do you know whether this is fine? I do not remember 😞 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(from Daniel) do you know whether this is fine? I do not remember 😞
(from my previous tests) The effect is working because of :hover, not because of the .hover class added/removed by the script.
So, it's a cleanup => 👍
Also, I checked the related CSS to this "feature", it's expecting any of :hover or .hover
. So another cleanup task could be to remove the .hover
part as a follow-up :) (code: style.less#L787-L792
(additional manual testing with the new BuildHistory from Jan 🎉)
See JENKINS-60866.
Testing Notes
confirmationLink
is e.g. the "Reload from Disk" item on/manage
, the script controls the confirmation dialog.buildHealth
is the weather column and the weather icon in the build history title, the script controls hover behavior.URICheckEncodingMonitor
is only available on/manage
. It shows fairly easily for me (who has Latin 1?) but the error I could only trigger by changingparams
in JS so that actual/expected are different. The monitor has nonstandard appearance since we styled them differently from 1.x, out of scope for this.advanced
is the script that controls whether the "something was edited" message appears to the left of the button; this is trivially the case with Mailer plugin's "Send a test email" misuse of this control.Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
Proposed changelog entries
section only if there are breaking changes or other changes which may require extra steps from users during the upgradeDesired reviewers
@mention
Maintainer checklist
Before the changes are marked as
ready-for-merge
:Proposed changelog entries
are correctupgrade-guide-needed
label is set and there is aProposed upgrade guidelines
section in the PR title. (example)lts-candidate
to be considered (see query).