From 77620ca82db69ab470bab5bdb007c873f837dd6c Mon Sep 17 00:00:00 2001 From: "Bruno P. Kinoshita" Date: Sat, 6 Jul 2024 11:34:39 +0200 Subject: [PATCH] [JENKINS-71909]: Revert https://github.com/jenkinsci/active-choices-plugin/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. --- package.json | 5 - pom.xml | 2 +- .../CascadeChoiceParameter/index.jelly | 9 +- .../DynamicReferenceParameter/index.jelly | 9 +- .../unochoice/stapler/unochoice/UnoChoice.es6 | 144 +++++++++++++----- .../biouno/unochoice/UiAcceptanceTest.java | 2 +- webpack.config.js | 1 - yarn.lock | 118 +------------- 8 files changed, 127 insertions(+), 163 deletions(-) diff --git a/package.json b/package.json index 9009b4bc..65e5be2f 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,6 @@ "@babel/preset-flow": "^7.24.7", "@babel/preset-typescript": "^7.24.7", "@types/jquery": "^3.5.30", - "babel-loader": "^9.1.3", - "babel-plugin-transform-async-to-promises": "^0.8.18", "eslint": "^9.6.0", "eslint-config-prettier": "^9.1.0", "jest": "^29.7.0", @@ -54,9 +52,6 @@ ["@babel/preset-env", {"targets": {"node": "current"}}], "@babel/preset-typescript", "@babel/preset-flow" - ], - "plugins": [ - "babel-plugin-transform-async-to-promises" ] }, "jest": { diff --git a/pom.xml b/pom.xml index 002b0598..3f8e45a1 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ jenkinsci/active-choices-plugin 18.18.0 1.22.19 - PT60S + PT300S diff --git a/src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/index.jelly b/src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/index.jelly index 8c958bd9..8e45bccb 100644 --- a/src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/index.jelly +++ b/src/main/resources/org/biouno/unochoice/CascadeChoiceParameter/index.jelly @@ -2,7 +2,6 @@ ${it.parameters.clear()} - diff --git a/src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/index.jelly b/src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/index.jelly index 1309375c..981b5197 100644 --- a/src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/index.jelly +++ b/src/main/resources/org/biouno/unochoice/DynamicReferenceParameter/index.jelly @@ -55,7 +55,6 @@ -