-
-
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][JENKINS-71051][JENKINS-71048] Un-inline 'Build Now' JS #7635
[JENKINS-60866][JENKINS-71051][JENKINS-71048] Un-inline 'Build Now' JS #7635
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.
Looks right. (There are a bunch of a different usage modes of l:task
so it is tricky to find examples of all of them to test, and HtmlUnit coverage is probably absent.)
core/src/main/resources/lib/hudson/project/configurable/adjunct.js
Outdated
Show resolved
Hide resolved
@Wadeck suggested this might be easier with a morph tag, I'll look into that. |
You mean to avoid duplication as per #7635 (comment) while still avoiding JS for parameterized builds? Sure, as in jenkins/core/src/main/resources/lib/hudson/iconSize.jelly Lines 29 to 53 in 193bda8
|
No, as an alternative to |
6f218aa
to
524c4bb
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Please take a moment and address the merge conflicts of your pull request. Thanks! |
} | ||
</script> | ||
<st:adjunct includes="lib.hudson.project.configurable.configurable"/> | ||
<l:task href="${url}/build?delay=0sec" icon="icon-clock icon-md" permission="${it.BUILD}" post="${!it.parameterized}" data-callback="lib_hudson_project_configurable_build_now_callback" data-build-success="${%Build scheduled}" data-parameterized="${it.parameterized}" title="${it.buildNowText}"/> |
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 only purpose of the callback seems to be to change the message from Done
to Build scheduled
.
So if we generalize the success message for the post we don't need the callback and the js here.
But I like the idea with the callback
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.
So if we generalize the success message for the post we don't need the callback and the js here.
I didn't want to remove functionality unless it really was necessary or required crazy workarounds. The solution here seems generally sensible and supportable.
Doing it this way also provides an additional nontrivial example that can help plugin developers adapt their own code.
/label ready-for-merge This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback. |
See JENKINS-60866.
Challenged by #5514 (comment). Conflicts with #7633 (but should be straightforward to resolve).
This implements a few different, related changes:
l:task
no longer has inline JS unlessonclick
is defined.l:task
gets support for specifying additional behaviors by making thea
element it renders (when it's not al:confirmationLink
) a morph tag, and have its default script check for the presence ofdata-callback
.l:task
fromp:configurable
is changed to specifydata-callback
, as well as further attributes needed for this link.Testing done
Commit tested: a205cc4
data-callback
from "Build Now", and repeated the first two tests (still works, just with a different message, the only difference before [JENKINS-49138] Build Now to redirect to new build #7633).configurable.jelly
(so it specifies the now deprecatedonclick
for thel:task
) and repeated the first two tests (still works, displays the custom "scheduled" message)./job/whatever
page, confirming there's no warning reported to the reporting endpoint.configurable.jelly
(so it specifies the now deprecatedonclick
for thel:task
) and navigated to the/job/whatever
page, confirming there is a CSP warning reported to the reporting endpoint.Proposed changelog entries
onclick
attributes containing inline JS onl:task
withdata-callback
.Proposed upgrade guidelines
N/A
Submitter checklist
@Restricted
or have@since TODO
Javadocs, as appropriate.@Deprecated(since = "TODO")
or@Deprecated(forRemoval = true, since = "TODO")
, if applicable.eval
to ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
@mention
Maintainer checklist
Before the changes are marked as
ready-for-merge
:upgrade-guide-needed
label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidate
to be considered (see query).