-
Notifications
You must be signed in to change notification settings - Fork 103
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-71909]: Revert https://github.com/jenkinsci/active-choices-p… #298
Conversation
Looks like more UiAcceptanceTest changes will have to be reverted. But haven't tested it the OP bug is fixed yet. Issue with the case to replicate it: https://issues.jenkins.io/browse/JENKINS-71909 |
Setting up new laptop; old one had temperature issues -- will update it over next days (more likely near next weekend). |
Hi @kinow, Thanks for working on getting this fixed. We are being affected by this issue and having to do several workarounds to keep 2.6.5 running in our environment. I tried testing the plugin and ran into a few issues which I've mentioned here. I was able to get the plugin working and confirmed that it did resolve our issues and the example in JENKINS-71909. |
Hi @asc3ns10n did you write a workaround on top of this change (which is pending a js/prototype issue), or did you come up with another solution for the time being? |
src/main/resources/org/biouno/unochoice/stapler/unochoice/UnoChoice.es6
Outdated
Show resolved
Hide resolved
src/main/resources/org/biouno/unochoice/stapler/unochoice/UnoChoice.es6
Outdated
Show resolved
Hide resolved
let a = []; | ||
for (let i=0; i<args.length-(callback!=null?1:0); i++) | ||
a.push(args[i]); | ||
if(window.jQuery3 === window.$) { //Is jQuery the active framework? |
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.
With the dependencies on Prototype/jQuery having been removed from Stapler in favor of using native JavaScript, should the same be done here and just use XMLHttpRequest?
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.
Stapler moved to fetch
, so let's try to use that. Not sure if making the proxy async
and then await
'ing the fetch
will work here, but I think it's worth a try. It should behave the same as XMLHttpRequest
+ async: false
that we had before 🤞
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.
I am testing this in our environment and seeing the same issues as 2.8.3. It still seems to be loading the params out of order in some of our jobs.
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.
Thanks for testing this, @asc3ns10n
src/main/resources/org/biouno/unochoice/stapler/unochoice/UnoChoice.es6
Outdated
Show resolved
Hide resolved
f965476
to
4618620
Compare
Tested a job with more parameters that was failing with this pull request, and after @asc3ns10n 's suggestions it rendered everything correctly. Found some issues in tests (silly things, mostly cosmetics), and one bug in radiobutton.jelly. But there are still tests failing that appear to be either/both due to the change here, or to Selenium update/API. Will continue investigating another day. |
FWIW, one of the errors from the tests run on Jenkins:
Looks related to this one, HtmlUnit/htmlunit#232, but there may be some solution if the error is happening after adding the new code for stapler... maybe just rewrite it so htmlunit is happy.... |
(rebased) |
@@ -113,7 +113,7 @@ | |||
maxCount = ${it.visibleItemCount}; | |||
} | |||
|
|||
var refElement = document.getElementById("${id}"); | |||
var refElement = document.getElementById("ecp_${h.escape(it.randomName)}_0"); |
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.
This var doesn't exit, resulting in a warning during runtime (browser console) and no element found.
<f:textbox name="parameter.referencedParameters" value="${instance.referencedParameters}" /> | ||
</f:entry> | ||
<f:advanced> | ||
<f:entry title="${%Omit value field}" field="omitValueField" help="${rootURL}/../plugin/uno-choice/help-omitValueField.html"> | ||
<f:entry title="${%Omit value field}" field="omitValueField" help="/plugin/uno-choice/help-omitValueField.html"> |
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.
A e2e test was failing on the IDE (didn't check if it was failing on Jenkins). There seems to be a new convention where parameters like omitValueField
automatically load if there is a file sitting next to the Jelly file with name omitValueField-help.html
, I think. But instead of trying that I just used another recent example (gitlab-plugin) as reference to update these.
let a = []; | ||
for (let i=0; i<args.length-(callback!=null?1:0); i++) | ||
a.push(args[i]); | ||
if(window.jQuery3 === window.$) { //Is jQuery the active framework? |
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.
Thanks for testing this, @asc3ns10n
4ec716a
to
7f8c60e
Compare
Refs: |
All tests passed on my local environment with the latest commit. If GH Actions build pass too, then the next step is to try to reproduce the bug again with this latest change. If I cannot reproduce, then will try with |
Couldn't reproduce the issue with the latest code. Could someone else try it, please? Maybe @asc3ns10n? When I have some time to volunteer here again, I will,
👋 |
Doing the easy steps first, so commits all squashed, with a changelog included. Just pending a unit test now, then it's ready to be released 🎉 |
Test written, used the |
The merge request mentions JENKINS-71365 (prototype.JS is removed from Jenkins core) but reverting this should not impact that. What we are doing is removing the async calls and promises, and instead using the synchronous code again. This is so that Active Choices parameters are rendering in order as they were before. Whilst rendering them asynchronously seemed like a good idea to provide a more responsive UI, in reality we oversaw an important aspect: users write their scripts relying on the order parameters are loaded. Users wrote their code using document.getElementId, for instance, which worked previously as users would put the parameter doing that after the parameter from which the ID was being used. There were several issues rendered, so this is not likely to be added back again any time soon. In order to have a more smart reactivity, we would need places to hook user callback code (like Vue or React do), but provided by Jenkins UI, or in a way that could take some time to create in the plug-in without breaking things, and that works well.
Tests failing on Windows, but appears to be something with the CI node. |
…lugin/pull/79
The merge request mentions JENKINS-71365 (prototype.JS is removed from Jenkins core) but reverting this should not impact that.
What we are doing is removing the async calls and promises, and instead using the synchronous code again. This is so that Active Choices parameters are rendering in order as they were before.
Whilst rendering them asynchronously seemed like a good idea to provide a more responsive UI, in reality we oversaw an important aspect: users write their scripts relying on the order parameters are loaded.
Users wrote their code using document.getElementId, for instance, which worked previously as users would put the parameter doing that after the parameter from which the ID was being used.
There were several issues rendered, so this is not likely to be added back again any time soon. In order to have a more smart reactivity, we would need places to hook user callback code (like Vue or React do), but provided by Jenkins UI, or in a way that could take some time to create in the plug-in without breaking things, and that works well.
Testing done
Submitter checklist